medkit.text.ner.tnm_attribute#
This package needs extra-dependencies not installed as core dependencies of medkit. To install them, use pip install medkit[edsnlp].
Classes:
|
Attribute destructuring the fields of a TNM string. |
- class TNMAttribute(prefix=None, tumour=None, tumour_specification=None, tumour_suffix=None, node=None, node_specification=None, node_suffix=None, metastasis=None, resection_completeness=None, version=None, version_year=None, metadata=None, uid=None)[source]#
Attribute destructuring the fields of a TNM string.
The TNM (Tumour/Node/Metastasis) system is used to describe cancer stages.
This class is replicating EDS-NLP’s TDM class, making it a medkit
Attribute.- Variables:
uid – Identifier of the attribute
label – The attribute label, always set to
TNMAttribute.LABELvalue – Normalized string representation of the TNM (ex: “pTxN1M1”)
tumour – Tumour score
tumour_specification – Tumour specification
tumour_suffix – Tumour suffix
node – Node score
node_specification – Node specification
node_suffix – Node suffix
metastasis – Metastasis score
resection_completeness – Resection completeness (R factor)
version – Version (ex: “uicc”, “accj”)
version_year – Version year
Attributes:
Label used for all TNM attributes
Methods:
copy()Create a new attribute that is a copy of the current instance, but with a new identifier
from_dict(tnm_dict)Creates an Attribute from a dict
get_subclass_for_data_dict(data_dict)Return the subclass that corresponds to the class name found in a data dict
to_brat()Return a value compatible with the brat format
to_spacy()Return a value compatible with spaCy
-
LABEL:
ClassVar[str]= 'TNM'# Label used for all TNM attributes
- copy()#
Create a new attribute that is a copy of the current instance, but with a new identifier
This is used when we want to duplicate an existing attribute onto a different annotation.
- Return type:
- classmethod get_subclass_for_data_dict(data_dict)#
Return the subclass that corresponds to the class name found in a data dict
- Parameters:
data_dict (dict of str to Any) – Data dict returned by the to_dict() method of a subclass (or of the base class itself)
- Return type:
Optional[type[Self]]- Returns:
subclass – Subclass that generated data_dict, or None if data_dict correspond to the base class itself.