You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: documentation/plugins.rst
+6
Original file line number
Diff line number
Diff line change
@@ -28,6 +28,7 @@ To add a document location handler plugin, you need to implement a Python `"pack
28
28
29
29
#. the package must be named ``mmif_docloc_<SCHEME>``. For example, to implement a handler for ``s3`` scheme, the package name must be ``mmif_docloc_s3``. The prefix is important as it's used in the plugin discovery process from the core ``mmif-python`` modules.
30
30
#. the top module of the package must have a function named ``resolve``. The function must take a single argument, which is a :class:`str` of the document location URI. The function must return a :class:`str` of the local file path. For example, if the document location is ``s3://mybucket/myfile.mp4``, a Python user should be able to to something like this;
31
+
#. Optionally (but highly recommended), the top module also can provide another function named ``help``. The function must take no arguments and return a :class:`str` that explains how the input string to the ``resolve`` function should be formatted.
# additional iteration of views, to find a proper view to add the
305
330
# generated annotations. If none found, use the last view as the kitchen sink
306
331
last_view_for_docs=defaultdict(lambda: last_view)
307
332
doc_ids=set(anns_to_write.keys())
308
333
fordoc_idindoc_ids:
334
+
iflen(last_view.annotations) ==0:
335
+
# meaning, this new app didn't generate any annotation except for these document properties
336
+
# thus, we should add capital annotations to the last (empty) view
337
+
last_view_for_docs[doc_id] =last_view
338
+
break
309
339
forviewinreversed(self.views):
310
340
# first try to find out if this view "contains" any annotation to the doc
311
341
# then, check for individual annotations
312
-
if [contforcontinview.metadata.contains.values() ifcont.get('document', None) ==doc_id] \
342
+
# TODO (krim @ 7/15/24): update id checking once https://github.com/clamsproject/mmif/issues/228 is resolved
343
+
if [contforcontinview.metadata.contains.values() ifdoc_id.endswith(cont.get('document', 'TODO:this endswith test is a temporal solution we use until long_id is forced everywhere'))] \
specialized getter implementation to workaround https://github.com/clamsproject/mmif/issues/228
447
+
# TODO (krim @ 7/12/24): annotation ids must be in the long form in the future, so this check will be unnecessary once https://github.com/clamsproject/mmif/issues/228 is resolved.
0 commit comments