Skip to content

Commit b74327f

Browse files
committed
- Updates: Updated names of options/functions from 'SNOMED ICD map' to 'SNOMED complex map'.
- Docs: Added a page 'parsers.rst', and populated with 'SNOMED complex map' info.
1 parent f2eb9c9 commit b74327f

File tree

3 files changed

+132
-7
lines changed

3 files changed

+132
-7
lines changed

docs/parsers.rst

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
Parsers
2+
========
3+
4+
Field descriptions
5+
------------------
6+
7+
Taken from:
8+
9+
https://www.nlm.nih.gov/healthit/snomedct/us_edition.html
10+
11+
Download a zip file there, and inside there will be the following PDF, which documents the fields as shown below.
12+
13+
doc_Icd10cmMapReleaseNotes_Current-en-US_US1000124_20210901.pdf
14+
15+
More info:
16+
17+
https://www.nlm.nih.gov/research/umls/mapping_projects/snomedct_to_icd10cm.html
18+
19+
FIELD,DATA_TYPE,PURPOSE,SSSOM Dev Comments
20+
- id,UUID,A 128 bit unsigned integer, uniquely identifying the map record,
21+
- effectiveTime,Time,Specifies the inclusive date at which this change becomes effective.,
22+
- active,Boolean,Specifies whether the member’s state was active (=1) or inactive (=0) from the nominal release date specified by the effectiveTime field.,
23+
- moduleId,SctId,Identifies the member version’s module. Set to a child of 900000000000443000|Module| within the metadata hierarchy.,The only value in the entire set is '5991000124107', which has label 'SNOMED CT to ICD-10-CM rule-based mapping module' (https://www.findacode.com/snomed/5991000124107--snomed-ct-to-icd-10-cm-rule-based-mapping-module.html).
24+
- refSetId,SctId,Set to one of the children of the |Complex map type| concept in the metadata hierarchy.,The only value in the entire set is '5991000124107', which has label 'ICD-10-CM complex map reference set' (https://www.findacode.com/snomed/6011000124106--icd-10-cm-complex-map-reference-set.html).
25+
- referencedComponentId,SctId,The SNOMED CT source concept ID that is the subject of the map record.,
26+
- mapGroup,Integer,An integer identifying a grouping of complex map records which will designate one map target at the time of map rule evaluation. Source concepts that require two map targets for classification will have two sets of map groups.,
27+
- mapPriority,Integer,Within a map group, the mapPriority specifies the order in which complex map records should be evaluated to determine the correct map target.,
28+
- mapRule,String,A machine-readable rule, (evaluating to either ‘true’ or ‘false’ at run-time) that indicates whether this map record should be selected within its map group.,
29+
- mapAdvice,String,Human-readable advice that may be employed by the software vendor to give an end-user advice on selection of the appropriate target code. This includes a) a summary statement of the map rule logic, b) a statement of any limitations of the map record and c) additional classification guidance for the coding professional.,
30+
- mapTarget,String,The target ICD-10 classification code of the map record.,
31+
- correlationId,SctId,A child of |Map correlation value| in the metadata hierarchy, identifying the correlation between the SNOMED CT concept and the target code.,
32+
- mapCategoryId,SctId,Identifies the SNOMED CT concept in the metadata hierarchy which is the MapCategory for the associated map record. This is a subtype of 447634004 |ICD-10 Map Category value|.,
33+
34+
Mappings: SSSOM::SNOMED_Complex_Map
35+
-----------------------------------
36+
Copy/pasta of state of mappings as of 2022/03/04:
37+
38+
'subject_id': f'SNOMED:{row["referencedComponentId"]}',
39+
'subject_label': row['referencedComponentName'],
40+
41+
# 'predicate_id': 'skos:exactMatch',
42+
# - mapCategoryId: can use for mapping predicate? Or is correlationId more suitable?
43+
# or is there a SKOS predicate I can map to in case where predicate is unknown? I think most of these
44+
# mappings are attempts at exact matches, but I can't be sure (at least not without using these fields
45+
# to determine: mapGroup, mapPriority, mapRule, mapAdvice).
46+
# mapCategoryId,mapCategoryName: Only these in set: 447637006 "MAP SOURCE CONCEPT IS PROPERLY CLASSIFIED",
47+
# 447638001 "MAP SOURCE CONCEPT CANNOT BE CLASSIFIED WITH AVAILABLE DATA",
48+
# 447639009 "MAP OF SOURCE CONCEPT IS CONTEXT DEPENDENT"
49+
# 'predicate_modifier': '???',
50+
# Description: Modifier for negating the prediate. See https://github.com/mapping-commons/sssom/issues/40
51+
# Range: PredicateModifierEnum: (joe: only lists 'Not' as an option)
52+
# Example: Not Negates the predicate, see documentation of predicate_modifier_enum
53+
# - predicate_id <- mapAdvice?
54+
# - predicate_modifier <- mapAdvice?
55+
# mapAdvice: Pipe-delimited qualifiers. Ex:
56+
# "ALWAYS Q71.30 | CONSIDER LATERALITY SPECIFICATION"
57+
# "IF LISSENCEPHALY TYPE 3 FAMILIAL FETAL AKINESIA SEQUENCE SYNDROME CHOOSE Q04.3 | MAP OF SOURCE CONCEPT
58+
# IS CONTEXT DEPENDENT"
59+
# "MAP SOURCE CONCEPT CANNOT BE CLASSIFIED WITH AVAILABLE DATA"
60+
'predicate_id': f'SNOMED:{row["mapCategoryId"]}',
61+
'predicate_label': row['mapCategoryName'],
62+
63+
'object_id': f'ICD10CM:{row["mapTarget"]}',
64+
'object_label': row['mapTargetName'],
65+
66+
# match_type <- mapRule?
67+
# ex: TRUE: when "ALWAYS <code>" is in pipe-delimited list in mapAdvice, this always shows TRUE. Does this
68+
# mean I could use skos:exactMatch in these cases?
69+
# match_type <- correlationId?: This may look redundant, but I want to be explicit. In officially downloaded
70+
# SNOMED mappings, all of them had correlationId of 447561005, which also happens to be 'unspecified'.
71+
# If correlationId is indeed more appropriate for predicate_id, then I don't think there is a representative
72+
# field for 'match_type'.
73+
'match_type': MatchTypeEnum('Unspecified') if row['correlationId'] == match_type_snomed_unspecified_id \
74+
else MatchTypeEnum('Unspecified'),
75+
76+
'mapping_date': date_parser.parse(str(row['effectiveTime'])).date(),
77+
'other': '|'.join([f'{k}={str(row[k])}' for k in [
78+
'id',
79+
'active',
80+
'moduleId',
81+
'refsetId',
82+
'mapGroup',
83+
'mapPriority',
84+
'mapRule',
85+
'mapAdvice',
86+
]]),
87+
88+
# More fields (https://mapping-commons.github.io/sssom/Mapping/):
89+
# - subject_category: absent
90+
# - author_id: can this be "SNOMED"?
91+
# - author_label: can this be "SNOMED"?
92+
# - reviewer_id: can this be "SNOMED"?
93+
# - reviewer_label: can this be "SNOMED"?
94+
# - creator_id: can this be "SNOMED"?
95+
# - creator_label: can this be "SNOMED"?
96+
# - license: Is this something that can be determined?
97+
# - subject_source: URL of some official page for SNOMED version used?
98+
# - subject_source_version: Is this knowable?
99+
# - objectCategory <= mapRule?
100+
# mapRule: ex: TRUE: when "ALWAYS <code>" is in pipe-delimited list in mapAdvice, this always shows TRUE.
101+
# Does this mean I could use skos:exactMatch in these cases?
102+
# object_category:
103+
# objectCategory:
104+
# Description: The conceptual category to which the subject belongs to. This can be a string denoting
105+
# the category or a term from a controlled vocabulary.
106+
# Example: UBERON:0001062 (The CURIE of the Uberon term for "anatomical entity".)
107+
# - object_source: URL of some official page for ICD10CM version used?
108+
# - object_source_version: would this be "10CM" as in "ICD10CM"? Or something else? Or nothing?
109+
# - mapping_provider: can this be "SNOMED"?
110+
# - mapping_cardinality: Could I determine 1:1 or 1:many or many:1 based on:
111+
# mapGroup, mapPriority, mapRule, mapAdvice?
112+
# - match_term_type: What is this?
113+
# - see_also: Should this be a URL to the SNOMED term?
114+
# - comment: Description: Free text field containing either curator notes or text generated by tool providing
115+
# additional informative information.
116+
117+
118+
SNOMED mapping related codes
119+
----------------------------
120+
match_type_snomed_unspecified_id = 447561005
121+
https://www.findacode.com/snomed/447561005--snomed-ct-source-code-to-target-map-correlation-not-specified.html
122+
123+
Additional resources
124+
--------------------
125+
About SNOMED simple and complex refsets:
126+
https://github.com/HOT-Ecosystem/tccm/blob/master/docs/SNOMED/MapRefsets.md

sssom/parsers.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def parse_obographs_json(
264264
)
265265

266266

267-
def parse_snomed_icd10cm_map_tsv(
267+
def parse_snomed_complex_map_tsv(
268268
file_path: str,
269269
prefix_map: Dict[str, str] = None,
270270
meta: Dict[str, str] = None,
@@ -278,7 +278,7 @@ def parse_snomed_icd10cm_map_tsv(
278278
"""
279279
raise_for_bad_path(file_path)
280280
df = read_pandas(file_path)
281-
df2 = from_snomed_icd10cm_map_tsv(df, prefix_map=prefix_map, meta=meta)
281+
df2 = from_snomed_complex_map_tsv(df, prefix_map=prefix_map, meta=meta)
282282
return df2
283283

284284

@@ -687,7 +687,7 @@ def from_obographs(
687687
return to_mapping_set_dataframe(mdoc)
688688

689689

690-
def from_snomed_icd10cm_map_tsv(
690+
def from_snomed_complex_map_tsv(
691691
df: pd.DataFrame,
692692
prefix_map: Optional[PrefixMap] = None,
693693
meta: Optional[MetadataType] = None,
@@ -849,9 +849,8 @@ def get_parsing_function(input_format: Optional[str], filename: str) -> Callable
849849
return parse_alignment_xml
850850
elif input_format == "obographs-json":
851851
return parse_obographs_json
852-
elif input_format == "snomed-icd10cm-map-tsv":
853-
return parse_snomed_icd10cm_map_tsv
854-
852+
elif input_format == "snomed-complex-map-tsv":
853+
return parse_snomed_complex_map_tsv
855854
else:
856855
raise Exception(f"Unknown input format: {input_format}")
857856

sssom/util.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"tsv",
7676
"alignment-api-xml",
7777
"obographs-json",
78-
"snomed-icd10cm-map-tsv"
78+
"snomed-complex-map-tsv"
7979
]
8080
SSSOM_EXPORT_FORMATS = ["tsv", "rdf", "owl", "json", "fhir"]
8181

0 commit comments

Comments
 (0)