Skip to content

Commit

Permalink
use curie for concept mapping code
Browse files Browse the repository at this point in the history
  • Loading branch information
korikuzma committed Dec 31, 2024
1 parent fb70350 commit 7750db3
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/disease/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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(
Expand Down
25 changes: 14 additions & 11 deletions src/disease/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
36 changes: 21 additions & 15 deletions tests/unit/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down

0 comments on commit 7750db3

Please sign in to comment.