PyMedTermino (Medical Terminologies for Python) is a Python module for easy access to the main medical terminologies in Python, including SNOMED CT, ICD10, MedDRA, UMLS and VCM icons.
PyMedTermino is available under the GNU LGPL licence, and it has been created by Jean-Baptiste Lamy, LIMICS, Paris 13 University, Sorbonne Paris Cité, INSERM UMRS 1142, Paris 6 University 74 rue Marcel Cachin 93017 Bobigny, France
This module includes Pymedtermino’s global parameters, the base classes for terminology-specific modules, and utility classes.
the directory where SQLite3 database files containing terminologies are located. Default : PyMedTermino directory.
the default language used for terms, when several translations are available. If the desired language is not available, it defaults to English.
Warning
this parameter must be set BEFORE loading terminologies. Default : “en” (English).
if True, concepts tagged as suppressed or depreciated in terminologies are skipped.
if True, terms (=translations) tagged as suppressed or depreciated in terminologies are skipped.
if True, relations tagged as suppressed or depreciated in terminologies are skipped.
The following function can get any concept from a “terminology:code” string:
Return a concept from a ‘full code’ including both terminology name and concept code (for example “icd10:I10”).
This module also defined the Terminology, Concept, Mapping classes that are used as base classes for the various terminologies.
Base class for all terminologies.
name of the terminology
Returns the root concepts in the terminology (=concepts without parents).
Searches for concepts whose terms match the given text (free-text search).
Returns: | a list of concept. |
---|
Retuns a generator for iterating over all concepts in the terminology.
Retuns a generator for iterating over all concepts in the terminology, each concept being iterated only once (for multiaxial terminologies).
Retuns the concept of the given code, or None if no such concept.
Retuns True if the terminology has a concept of the given code.
Retuns the concept of the given code; raise ValueError if it does not exist. Also available as Terminology[code] (i.e. Terminology.__getitem__).
Base class for all concepts, in any terminology.
the terminology this concept is extracted from.
the code of the concept
the preferred term (i.e. label) of the concept
the list of terms for this concept.
the list of parent concepts.
Note
Concept.parents is always a list, even for terminologies with single inheritance (like ICD10). This allows to write terminology-independent code.
the list of children concepts.
the list of the available relations for this concept. The available relations depend of the terminology, and is-a relations are not included (use parents and children attributes). Each relation corresponds to an attribute of the concept.
Returns the ‘full code’ for this concept, including both terminology name and concept code (for example “icd10:I10”).
Returns the preferred term for this concept, in the given language. Not supported by all terminology.
Returns all concept’s terms, in the given language. Not supported by all terminology.
Returns True if this concept is a child of the given concept (or if both concepts are the same).
Maps the concept to the destination_terminology. See PyMedTermino tutorial for more info.
Returns a generator for iterating over all ancestors of this concept.
Returns a generator for iterating over all ancestors of this concept. Each concept is only yielded once (useful for multiaxial terminologies).
Returns a generator for iterating over all ancestors of this concept, including the concept itself.
Returns a generator for iterating over all ancestors of this concept, including the concept itself. Each concept is only yielded once (useful for multiaxial terminologies).
Returns a generator for iterating over all descendants of this concept.
Returns a generator for iterating over all descendants of this concept. Each concept is only yielded once (useful for multiaxial terminologies).
Returns a generator for iterating over all descendants of this concept, including the concept itself.
Returns a generator for iterating over all descendants of this concept, including the concept itself. Each concept is only yielded once (useful for multiaxial terminologies).
Base class for a mapping between two terminologies.
Maps the given concept(s) using this mapping.
Note
You only need this method if you have several mappings with the same origin and destination terminologies. In other situations, you should rather use concept(s) >> destination_terminology.
origin terminology for the mapping
destination terminology for the mapping
Registers the mapping as the default mapping between its origin and destination terminologies.
A set of concepts. The set can contain each concept only once, and it inherits from Python’s set the methods for computing intersection, union, difference, ..., of two sets.
Maps the set of concepts to the destination_terminology. See PyMedTermino tutorial for more info.
returns the first concept of the set that is a descendant of parent_concept (including parent_concept itself).
returns true if all concepts in the OTHER set are descendants of (at least) one of the concept in this set.
returns true if all concepts in this set are descendants of (at least) one of the concept in the OTHER set.
keeps only the most specific concepts, i.e. remove all concepts that are more general that another concept in the set.
keeps only the most general concepts, i.e. remove all concepts that are more specific that another concept in the set.
returns all concepts of the set that are descendant of parent_concept (including parent_concept itself).
returns a new set after removing all concepts that are descendant of parent_concept (including parent_concept itself).
same as func:subtract, but modify the set in place.
returns the lowest common ancestors between this set of concepts.
returns all the subsets included in this set.
PyMedtermino module for SNOMEDCT.
The SNOMED CT terminology. See pymedtermino.Terminology for common terminology members; only SNOMED CT-specific members are described here.
Returns a generator iterating over all SNOMED CT concepts that are included in the CORE problem list.
A group, grouping several SNOMED CT relation together in the definition of a Concept.
A SNOMED CT concept. See pymedtermino.Concept for common terminology members; only SNOMED CT-specific members are described here.
True if this concept belongs to the SNOMED CT CORE problem list.
A list of the groups in the concept’s definition. Each group include one or more relations, grouped together.
A special group that includes all relations that do not belongs to a group.
True if this concept is still active in SNOMED CT; False if it has been removed.
Additional attributes are available for relations, and are listed in the relations attribute.
Returns the sub-parts of this concept, recursively.
Returns the super-part of this concept, recursively.
Return the clinical finding concepts associated to this concept (which is expected to be a anatomical structure, a morphology, etc).
PyMedtermino module for ICD10. Currently supports English and (ATIH) French version of ICD10.
The ICD10 terminology. See pymedtermino.Terminology for common terminology members; only ICD10-specific members are described here.
If set to True, include ATIH extension to ICD10 (available only in French). Defaults to false. Must be set before loading ICD10 concepts.
A text in an ICD10 definition for a concept (for example, an exclusion, and inclusion, etc).
Translates this text in the given language.
An ICD10 concept. See pymedtermino.Concept for common terminology members; only ICD10-specific members are described here.
True if the concept is an ATIH extension.
Restriction of use of this concept for PMSI coding in France.
Additional attributes can be available, and are listed in the relations attribute.
PyMedtermino module for MedDRA.
Several concepts can share the same code in MedDRA. For example, a preferred term (PT) and a low-level term (LLT) can have the same code and label. In order to distinguish them, PyMedTermino does not use directly the MedDRA codes, but associates the term’s level with the code to obtain a unique code, for example “SOC_10019805” or “PT_10069435”.
The MedDRA terminology. See pymedtermino.Terminology for common terminology members; only MedDRA-specific members are described here.
Returns the root concepts in MedDRA (=the SOC), in international order.
Returns a list of MedDRA concepts corresponding to the given MedDRA numeric code (e.g. 10073496).
A MedDRA concept. See pymedtermino.Concept for common terminology members; only MedDRA-specific members are described here.
Additional attributes are available for relations, and are listed in the relations attribute.
The original numeric MedDRA code.
The type of MedDRA term (SOC, HLGT, HLT, PT or LLT).
The abbreviated name associated to a SOC (only available for SOC).
The international order associated to a SOC (only available for SOC).
The primary SOC associated to a PT (only available for PT).
PyMedtermino module for CDF (Thériaque French drug database).
The CDF terminology. See pymedtermino.Terminology for common terminology members; only CDF-specific members are described here.
A CDF to ICD10 mapping (from Thériaque) is also provided.
Connects to a Thériaque PostgreSQL database. This function must be called before using CDF. Default values should be OK for a local Theriaque installation with PostgresQL.
A CDF concept. See pymedtermino.Concept for common terminology members; only CDF-specific members are described here.
Additional attributes are available for relations, and are listed in the relations attribute.
The original CDF “numero” code.
The original CDF “code”.
PyMedtermino module for UMLS.
The UMLS CUI terminology (concepts). See pymedtermino.Terminology for common terminology members; only UMLS-specific members are described here.
The UMLS AUI terminology (atoms). See pymedtermino.Terminology for common terminology members; only UMLS-specific members are described here.
Extract a terminology from UMLS.
Parameters: |
|
---|---|
Returns: | a new terminology, that uses the source codes (and not UMLS AUI codes). |
The UMLS SRC terminology (source terminology). See pymedtermino.Terminology for common terminology members; only UMLS-specific members are described here.
Connects to an UMLS MySQL database. This function must be called before using UMLS.
A UMLS concept. See pymedtermino.Concept for common terminology members; only UMLS-specific members are described here.
The name of the terminology this concept comes from.
The concept’s definitions (if available); in a dict mapping original terminology names to the definition in these terminologies.
True if this concept is still active in UMLS; False if it has been removed / suppressed.
Additional attributes are available for relations, and are listed in the relations attribute.
PyMedtermino module for VCM icons.
The VCM icons terminology. See pymedtermino.Terminology for common terminology members; only VCM-specific members are described here.
The VCM medical concept terminology. It is used to describe the medical concept represented by VCM icons. See pymedtermino.Terminology for common terminology members; only VCM-specific members are described here.
A mono-axial (=single inheritance) version of pymedtermino.vcm.VCM_CONCEPT. All anatomical structures have been associated to a single parents. See pymedtermino.Terminology for common terminology members; only VCM-specific members are described here.
The VCM lexicon terminology. It describes the colors, shapes and pictograms used by VCM icons. See pymedtermino.Terminology for common terminology members; only VCM-specific members are described here.
A VCM lexicon concept. See pymedtermino.Concept for common terminology members; only VCM-specific members are described here.
VCM lexicon defines “graphical is a” relation in addition to standard “is a”. A concept A is considered as “graphically being” a concept B if (and only if) the pictogram associated to A include the pictogram associated to B.
The category of lexicon (0: central color, 1: modifier, etc).
The list of concepts that are graphically more general than this one.
The list of concepts that are graphically more specific than this one.
True if this concept is a lexicon category, rather than a concrete color, shape or pictogram.
True if this concept is an ‘empty’ lexicon, such as “no pictogram”.
The priority of this lexicon concept, for icon sorting.
The second priority of this lexicon concept, for icon sorting. Only used (non-zero) for some transverse modifiers ; these modifiers use a different priority if they are used along with a central pictogram or not.
Additional attributes can be available, listed in the relations attribute.
Same as pymedtermino.Concept.is_a() but using “graphically is a” relation rather than standard “is a”.
Same as pymedtermino.Concept.ancestors() but using “graphically is a” relation rather than standard “is a”.
Same as pymedtermino.Concept.descendants() but using “graphically is a” relation rather than standard “is a”.
Same as pymedtermino.Concept.self_and_ancestors() but using “graphically is a” relation rather than standard “is a”.
Same as pymedtermino.Concept.self_and_ancestors_no_double() but using “graphically is a” relation rather than standard “is a”.
Same as pymedtermino.Concept.self_and_descendants() but using “graphically is a” relation rather than standard “is a”.
Same as pymedtermino.Concept.self_and_descendants_no_double() but using “graphically is a” relation rather than standard “is a”.
Same as pymedtermino.Concept.ancestors_no_double() but using “graphically is a” relation rather than standard “is a”.
Same as pymedtermino.Concept.descendants_no_double() but using “graphically is a” relation rather than standard “is a”.
A VCM icon (=a concept in the VCM terminology). See pymedtermino.Concept for common terminology members; only VCM-specific members are described here.
The list of lexicon concept in this icon.
All these attributes returns the shape modifier of the corresponding category (or None if no such modifiers).
The short icon code, compressed.
The entire icon code, including optional component.
True if the icon is consistent, according to the VCM ontology.
The set of VCM medical concepts associated to this icon.
The priority of this icon (for sorting purpose).
Creates and returns a new VCM icon, using this icon as a string point, and adding the given VCM lexicon concepts.
Creates and returns a new VCM icon, using this icon as a string point, and adding the given VCM lexicon concepts, as a list.
Same as pymedtermino.Concept.is_a() but using “graphically is a” relation rather than standard “is a”.
keeps only the most specific icons, i.e. remove all concepts that are more general that another concept in the set, using “graphical is a” relations.
Parameters: |
|
---|---|
Returns: | the new list of icons. |
keeps only the most generic icons, i.e. remove all concepts that are more general that another concept in the set, using “graphical is a” relations.
Parameters: |
|
---|---|
Returns: | the new list of icons. |
Generalizes the given list of icons, and returns the lowest common ancestor icon.
Parameters: |
|
---|---|
Returns: | the new list of icons. |
Simplifies the given list of icons, and returns a new list. The list is simplified by keeping the lowest common ancestor icons, whenever possible without loosing any central pictograms.
Parameters: |
|
---|---|
Returns: | the new list of icons. |
Removes dupplicated icons in the given list, and returns a new list.
Parameters: |
|
---|---|
Returns: | the new list of icons. |