medkit.core.annotation_container
================================

.. py:module:: medkit.core.annotation_container


Classes
-------

.. autoapisummary::

   medkit.core.annotation_container.AnnotationContainer


Module Contents
---------------

.. py:class:: AnnotationContainer(doc_id: str)

   Bases: :py:obj:`Generic`\ [\ :py:obj:`medkit.core.annotation.AnnotationType`\ ]


   
   Manage a list of annotations belonging to a document.

   This behaves more or less like a list: calling `len()` and iterating are
   supported. Additional filtering is available through the `get()` method.

   The annotations will be stored in a :class:`~medkit.core.Store`, which can
   rely on a simple dict or something more
   complicated like a database.

   This global store may be initialized using :class:~medkit.core.GlobalStore.
   Otherwise, a default one (i.e. dict store) is used.

   :Parameters:

       **doc_id** : str
           The identifier of the document which annotations belong to.














   ..
       !! processed by numpydoc !!

   .. py:method:: add(ann: medkit.core.annotation.AnnotationType)

      
      Attach an annotation to the document.


      :Parameters:

          **ann** : AnnotationType
              Annotation to add.





      :Raises:

          ValueError
              If the annotation is already attached to the document
              (based on `annotation.uid`)









      ..
          !! processed by numpydoc !!


   .. py:method:: __len__() -> int

      
      Add support for calling `len()`.
















      ..
          !! processed by numpydoc !!


   .. py:method:: __iter__() -> Iterator[medkit.core.annotation.AnnotationType]

      
      Add support for iterating over each attribute.
















      ..
          !! processed by numpydoc !!


   .. py:method:: __getitem__(key: int | slice) -> medkit.core.annotation.AnnotationType | list[medkit.core.annotation.AnnotationType]

      
      Add support for subscript access.
















      ..
          !! processed by numpydoc !!


   .. py:method:: get(*, label: str | None = None, key: str | None = None) -> list[medkit.core.annotation.AnnotationType]

      
      Return a list of the annotations of the document.


      :Parameters:

          **label** : str, optional
              Label to use to filter annotations.

          **key** : str, optional
              Key to use to filter annotations.














      ..
          !! processed by numpydoc !!


   .. py:method:: get_ids(*, label: str | None = None, key: str | None = None) -> Iterator[str]

      
      Return an iterator of the identifiers of the annotations of the document.

      This method is provided to facilitate additional filtering by subclasses.

      :Parameters:

          **label** : str, optional
              Label to use to filter annotations.

          **key** : str, optional
              Key to use to filter annotations.














      ..
          !! processed by numpydoc !!


   .. py:method:: get_by_id(uid: str) -> medkit.core.annotation.AnnotationType

      
      Return the annotation corresponding to a specific identifier.


      :Parameters:

          **uid** : str
              Identifier of the annotation to return.














      ..
          !! processed by numpydoc !!


   .. py:method:: __eq__(other: object) -> bool

      
      Return self==value.
















      ..
          !! processed by numpydoc !!


   .. py:method:: __repr__() -> str

      
      Return repr(self).
















      ..
          !! processed by numpydoc !!


