Skip to content

Implement appTags field and view filtering methods #375

@keighrim

Description

@keighrim

Because

When appTags is added to the MMIF spec (see clamsproject/mmif#247), mmif-python needs to implement the field and provide filtering methods. Currently Mmif supports filtering views by annotation type (get_views_contain) and by document (get_views_for_document), but there's no way to filter by which app produced a view or what task tags it carries.

Done when

  • appTags: List[str] = [] field on ViewMetadata, serialized/deserialized
  • get_views_by_app(*app_ids) — filter views by app identifier, supporting *args for multiple app IDs as OR; useful for querying across version ranges (e.g., get_views_by_app("app-foo/v3.1", "app-foo/v3.2", "app-foo/v4.0")). NOTE: * is Python args syntax, not regex or globbing
  • get_views_by_tag(*tags) — filter views where any of the given tags appear in appTags (same OR semantics across arguments)
  • Both follow the existing pattern: get_views_* returns a list, get_view_* returns the last match or None
  • Tests for all new methods

Additional context

this is to implement the decision made in clamsproject/clams-python#262

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions