diff --git a/src/disease/query.py b/src/disease/query.py index 381b1e5..3402fca 100644 --- a/src/disease/query.py +++ b/src/disease/query.py @@ -342,7 +342,7 @@ def _create_concept_mapping( :param relation: SKOS mapping relationship, default is relatedMatch :return: Concept mapping for identifier """ - source, source_id = concept_id.split(":") + source = concept_id.split(":")[0] try: source = NamespacePrefix(source) @@ -356,7 +356,7 @@ def _create_concept_mapping( system = NAMESPACE_TO_SYSTEM_URI.get(source, source) return ConceptMapping( - coding=Coding(code=code(source_id), system=system), relation=relation + coding=Coding(code=code(concept_id), system=system), relation=relation ) disease_obj = MappableConcept( diff --git a/src/disease/schemas.py b/src/disease/schemas.py index e5e7598..7125caa 100644 --- a/src/disease/schemas.py +++ b/src/disease/schemas.py @@ -310,39 +310,42 @@ class NormalizationService(BaseModel): "normalized_id": "ncit:C4989", "disease": { "id": "normalize.disease.ncit:C4989", - "type": "Disease", + "conceptType": "Disease", "label": "Childhood Leukemia", - "aliases": [ - "childhood leukemia (disease)", - "leukemia", - "pediatric leukemia (disease)", - "Leukemia", - "leukemia (disease) of childhood", - ], "mappings": [ { "coding": { - "code": "0004355", + "code": "mondo:0004355", "system": "http://purl.obolibrary.org/obo/mondo.owl", }, "relation": "relatedMatch", }, { "coding": { - "code": "7757", + "code": "DOID:7757", "system": "http://purl.obolibrary.org/obo/doid.owl", }, "relation": "relatedMatch", }, { "coding": { - "code": "C1332977", + "code": "umls:C1332977", "system": "https://www.nlm.nih.gov/research/umls/index.html", }, "relation": "relatedMatch", }, ], "extensions": [ + { + "name": "aliases", + "value": [ + "childhood leukemia (disease)", + "leukemia", + "pediatric leukemia (disease)", + "Leukemia", + "leukemia (disease) of childhood", + ], + }, { "name": "pediatric_disease", "value": True, diff --git a/tests/unit/test_query.py b/tests/unit/test_query.py index 54e26bb..af2282f 100644 --- a/tests/unit/test_query.py +++ b/tests/unit/test_query.py @@ -25,74 +25,77 @@ def neuroblastoma(): mappings=[ { "coding": { - "code": "0005072", + "code": "mondo:0005072", "system": "http://purl.obolibrary.org/obo/mondo.owl", }, "relation": "relatedMatch", }, { "coding": { - "code": "NBL", + "code": "oncotree:NBL", "system": "https://oncotree.mskcc.org", }, "relation": "relatedMatch", }, { "coding": { - "code": "769", + "code": "DOID:769", "system": "http://purl.obolibrary.org/obo/doid.owl", }, "relation": "relatedMatch", }, { "coding": { - "code": "C0027819", + "code": "umls:C0027819", "system": "https://www.nlm.nih.gov/research/umls/index.html", }, "relation": "relatedMatch", }, { "coding": { - "code": "9500/3", + "code": "icdo:9500/3", "system": "https://www.who.int/standards/classifications/other-classifications/international-classification-of-diseases-for-oncology/", }, "relation": "relatedMatch", }, { "coding": { - "code": "0000621", + "code": "efo:0000621", "system": "https://www.ebi.ac.uk/efo/", }, "relation": "relatedMatch", }, { "coding": { - "code": "7185", + "code": "gard:7185", "system": "https://rarediseases.info.nih.gov", }, "relation": "relatedMatch", }, { - "coding": {"code": "D009447", "system": "https://id.nlm.nih.gov/mesh/"}, + "coding": { + "code": "mesh:D009447", + "system": "https://id.nlm.nih.gov/mesh/", + }, "relation": "relatedMatch", }, { "coding": { - "code": "635", + "code": "orphanet:635", "system": "https://www.orpha.net", }, "relation": "relatedMatch", }, { "coding": { - "code": "C2751421", + "code": "umls:C2751421", "system": "https://www.nlm.nih.gov/research/umls/index.html", }, "relation": "relatedMatch", }, { "coding": { - "code": "18012", + "code": "medgen:18012", "system": "https://www.ncbi.nlm.nih.gov/medgen/", }, "relation": "relatedMatch", @@ -142,23 +145,26 @@ def mafd2(): label="major affective disorder 2", mappings=[ { - "coding": {"code": "309200", "system": "https://www.omim.org"}, + "coding": {"code": "MIM:309200", "system": "https://www.omim.org"}, "relation": "relatedMatch", }, { - "coding": {"code": "C564108", "system": "https://id.nlm.nih.gov/mesh/"}, + "coding": { + "code": "mesh:C564108", + "system": "https://id.nlm.nih.gov/mesh/", + }, "relation": "relatedMatch", }, { "coding": { - "code": "326975", + "code": "medgen:326975", "system": "https://www.ncbi.nlm.nih.gov/medgen/", }, "relation": "relatedMatch", }, { "coding": { - "code": "C1839839", + "code": "umls:C1839839", "system": "https://www.nlm.nih.gov/research/umls/index.html", }, "relation": "relatedMatch",