medkit.text.ner.tnm_attribute#

Classes#

TNMAttribute

Attribute destructuring the fields of a TNM string.

Module Contents#

class medkit.text.ner.tnm_attribute.TNMAttribute(prefix: edsnlp.pipelines.ner.tnm.model.Prefix | None = None, tumour: edsnlp.pipelines.ner.tnm.model.Tumour | None = None, tumour_specification: edsnlp.pipelines.ner.tnm.model.Specification | None = None, tumour_suffix: str | None = None, node: edsnlp.pipelines.ner.tnm.model.Node | None = None, node_specification: edsnlp.pipelines.ner.tnm.model.Specification | None = None, node_suffix: str | None = None, metastasis: edsnlp.pipelines.ner.tnm.model.Metastasis | None = None, resection_completeness: int | None = None, version: str | None = None, version_year: int | None = None, metadata: dict[str, Any] | None = None, uid: str | None = None)#

Bases: medkit.core.Attribute

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.

Attributes:
uid:

Identifier of the attribute

label:

The attribute label, always set to TNMAttribute.LABEL

value:

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

prefix: edsnlp.pipelines.ner.tnm.model.Prefix | None#
tumour: edsnlp.pipelines.ner.tnm.model.Tumour | None#
tumour_specification: edsnlp.pipelines.ner.tnm.model.Specification | None#
tumour_suffix: str | None#
node: edsnlp.pipelines.ner.tnm.model.Node | None#
node_specification: edsnlp.pipelines.ner.tnm.model.Specification | None#
node_suffix: str | None#
metastasis: edsnlp.pipelines.ner.tnm.model.Metastasis | None#
resection_completeness: int | None#
version: str | None#
version_year: int | None#
LABEL: ClassVar[str] = 'TNM'#

Label used for all TNM attributes

value#
to_brat() str#

Return a value compatible with the brat format.

to_spacy() str#

Return a value compatible with spaCy.

to_dict() dict[str, Any]#
classmethod from_dict(tnm_dict: dict[str, Any]) typing_extensions.Self#

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()