medkit.text.ner.tnm_attribute
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 (str) – Identifier of the attribute
label (str) – The attribute label, always set to
TNMAttribute.LABEL
value (Optional[Any]) – Normalized string representation of the TNM (ex: “pTxN1M1”)
tumour (Optional[edsnlp.pipelines.ner.tnm.model.Tumour]) – Tumour score
tumour_specification (Optional[edsnlp.pipelines.ner.tnm.model.Specification]) – Tumour specification
tumour_suffix (Optional[str]) – Tumour suffix
node (Optional[edsnlp.pipelines.ner.tnm.model.Node]) – Node score
node_specification (Optional[edsnlp.pipelines.ner.tnm.model.Specification]) – Node specification
node_suffix (Optional[str]) – Node suffix
metastasis (Optional[edsnlp.pipelines.ner.tnm.model.Metastasis]) – Metastasis score
resection_completeness (Optional[int]) – Resection completeness (R factor)
version (Optional[str]) – Version (ex: “uicc”, “accj”)
version_year (Optional[int]) – 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
[str
,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.