From 18c7366c4fee3bc0d35ab746b54ecbcfc3f5787f Mon Sep 17 00:00:00 2001 From: ecwood Date: Sat, 19 Aug 2023 12:35:22 -0700 Subject: [PATCH] #316 ICD10 and ICD9 work --- kg2_util.py | 2 ++ umls_list_jsonl_to_kg_jsonl.py | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/kg2_util.py b/kg2_util.py index e5f3d50d..eb1b864f 100644 --- a/kg2_util.py +++ b/kg2_util.py @@ -75,6 +75,8 @@ CURIE_PREFIX_HMDB = 'HMDB' CURIE_PREFIX_HP = 'HP' CURIE_PREFIX_IAO = 'IAO' +CURIE_PREFIX_ICD10PCS = 'ICD10PCS' +CURIE_PREFIX_ICD9 = 'ICD9' CURIE_PREFIX_IDENTIFIERS_ORG_REGISTRY = 'identifiers_org_registry' CURIE_PREFIX_ISBN = 'ISBN' CURIE_PREFIX_KEGG = 'KEGG' diff --git a/umls_list_jsonl_to_kg_jsonl.py b/umls_list_jsonl_to_kg_jsonl.py index b05eb1b5..8df24faa 100644 --- a/umls_list_jsonl_to_kg_jsonl.py +++ b/umls_list_jsonl_to_kg_jsonl.py @@ -40,6 +40,8 @@ HGNC_PREFIX = kg2_util.CURIE_PREFIX_HGNC HL7_PREFIX = kg2_util.CURIE_PREFIX_UMLS HPO_PREFIX = kg2_util.CURIE_PREFIX_HP +ICD10PCS_PREFIX = kg2_util.CURIE_PREFIX_ICD10PCS +ICD9CM = kg2_util.CURIE_PREFIX_ICD9 UMLS_SOURCE_PREFIX = kg2_util.CURIE_PREFIX_UMLS_SOURCE @@ -310,7 +312,7 @@ def process_hl7_item(node_id, info, nodes_output, edges_output): def process_hpo_item(node_id, info, nodes_output, edges_output): accession_heirarchy = ['PT', 'SY', 'ET', 'OP', 'IS', 'OET'] # https://www.nlm.nih.gov/research/umls/knowledge_sources/metathesaurus/release/precedence_suppressibility.html - node_curie, iri, name, provided_by, category, synonyms, cuis, tuis = get_basic_info(HPO_PREFIX, node_id, info, accession_heirarchy) + node_curie, iri, name, provided_by, category, synonyms, cuis, tuis = get_basic_info(HPO_PREFIX, node_id.replace('HP:', ''), info, accession_heirarchy) # Currently not used, but extracting them in case we want them in the future attributes = info.get(INFO_KEY, dict()) @@ -323,6 +325,18 @@ def process_hpo_item(node_id, info, nodes_output, edges_output): make_umls_node(node_curie, iri, name, category, "2023", provided_by, synonyms, create_description("", tuis), nodes_output) +def process_icd10_item(node_id, info, nodes_output, edges_output): + accession_heirarchy = ['PT', 'PX', 'HX', 'MTH_HX', 'HT', 'HS', 'AB'] # https://www.nlm.nih.gov/research/umls/knowledge_sources/metathesaurus/release/precedence_suppressibility.html + node_curie, iri, name, provided_by, category, synonyms, cuis, tuis = get_basic_info(ICD10PCS_PREFIX, node_id, info, accession_heirarchy) + provided_by = make_node_id(UMLS_SOURCE_PREFIX, 'ICD10PCS') + + # Currently not used, but extracting them in case we want them in the future + attributes = info.get(INFO_KEY, dict()) + added_meaning = attributes.get('ADDED_MEANING', list()) + order_no = attributes.get('ORDER_NO', list()) + + make_umls_node(node_curie, iri, name, category, "2023", provided_by, synonyms, create_description("", tuis), nodes_output) + if __name__ == '__main__': print("Starting umls_list_jsonl_to_kg_jsonl.py at", kg2_util.date()) args = get_args()