medkit.core.attribute
=====================

.. py:module:: medkit.core.attribute


Classes
-------

.. autoapisummary::

   medkit.core.attribute.Attribute


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

.. py:class:: Attribute(label: str, value: Any | None = None, metadata: dict[str, Any] | None = None, uid: str | None = None)

   Bases: :py:obj:`medkit.core.dict_conv.SubclassMapping`


   
   Medkit attribute, to be added to an annotation.














   :Attributes:

       **label: str**
           The attribute label

       **value: Any, optional**
           The value of the attribute. Should be either simple built-in types (int,
           float, bool, str) or collections of these types (list, dict, tuple). If
           you need structured complex data you should create a subclass of
           `Attribute`.

       **metadata: dict of str to Any**
           The metadata of the attribute

       **uid: str**
           The identifier of the attribute


   ..
       !! processed by numpydoc !!

   .. py:attribute:: label
      :type:  str


   .. py:attribute:: value
      :type:  Any | None


   .. py:attribute:: metadata
      :type:  dict[str, Any]


   .. py:attribute:: uid
      :type:  str


   .. py:method:: __init_subclass__()
      :classmethod:



   .. py:method:: to_dict() -> dict[str, Any]


   .. py:method:: to_brat() -> Any | None

      
      Return a value compatible with the brat format.
















      ..
          !! processed by numpydoc !!


   .. py:method:: to_spacy() -> Any | None

      
      Return a value compatible with spaCy.
















      ..
          !! processed by numpydoc !!


   .. py:method:: copy() -> Attribute

      
      Create a copy of the attribute with a new identifier.

      This is used when we want to duplicate an existing attribute onto a
      different annotation.















      ..
          !! processed by numpydoc !!


   .. py:method:: from_dict(attribute_dict: dict[str, Any]) -> typing_extensions.Self
      :classmethod:


      
      Create an Attribute from a dict.


      :Parameters:

          **attribute_dict: dict of str to Any**
              A dictionary from a serialized Attribute as generated by to_dict()














      ..
          !! processed by numpydoc !!


