medkit.core.attribute_container
medkit.core.attribute_container#
Classes:
|
Manage a list of attributes attached to another data structure. |
- class AttributeContainer(owner_id)[source]#
Manage a list of attributes attached to another data structure. For example, it may be a document or an annotation.
This behaves more or less like a list: calling len() and iterating are supported. Additional filtering is available through the get() method.
The attributes will be stored in a
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.
Methods:
add
(attr)Attach an attribute to the annotation.
get
(*[, label])Return a list of the attributes of the annotation, optionally filtering by label.
get_by_id
(uid)Return the attribute corresponding to a specific identifier.
- get(*, label=None)[source]#
Return a list of the attributes of the annotation, optionally filtering by label.
- Parameters
label (
Optional
[str
]) – Label to use to filter attributes.- Return type
List
[Attribute
]