-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9f55969
commit 59d7183
Showing
13 changed files
with
301 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from unittest.mock import MagicMock, patch | ||
|
||
from fastapi.testclient import TestClient | ||
from httpx import Response | ||
from monarch_py.api.search import router | ||
|
||
client = TestClient(router) | ||
|
||
|
||
def test_mappings(search): | ||
with patch.object( | ||
client, "get", MagicMock(return_value=Response(200, json=search, headers={"content-type": "application/json"})) | ||
): | ||
response = client.get("/mappings?entity_id=MONDO:0000015") | ||
assert response.status_code == 200 | ||
assert response.headers["content-type"] == "application/json" | ||
assert response.json() == search | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def mapping_query(): | ||
return { | ||
"q": "*:*", | ||
"rows": 20, | ||
"start": 0, | ||
"facet": True, | ||
"facet_fields": [], | ||
"facet_queries": [], | ||
"filter_queries": ['subject_id:"MONDO\\:0020121" OR object_id:"MONDO\\:0020121"'], | ||
"query_fields": None, | ||
"def_type": "edismax", | ||
"q_op": "AND", | ||
"mm": "100%", | ||
"boost": None, | ||
"sort": None, | ||
"facet_min_count": 1, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def mapping_response(): | ||
return { | ||
"responseHeader": { | ||
"QTime": 0, | ||
"params": { | ||
"mm": "100%", | ||
"q": "*:*", | ||
"defType": "edismax", | ||
"facet_min_count": "1", | ||
"start": "0", | ||
"q.op": "AND", | ||
"fq": 'subject_id:"MONDO\\:0020121" OR object_id:"MONDO\\:0020121"', | ||
"rows": "20", | ||
"facet": "true", | ||
}, | ||
}, | ||
"response": { | ||
"num_found": 7, | ||
"start": 0, | ||
"docs": [ | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "DOID:9884", | ||
"object_label": "muscular dystrophy", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "cda26856-16a7-499c-956f-119cbaac5b96", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "ICD10CM:G71.0", | ||
"object_label": "Muscular dystrophy", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "25777569-b997-4c8f-a1f3-5af352a16ee1", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "MESH:D009136", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "819ab197-2ab1-4b73-8d0f-d7d4ec14d8a7", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "NCIT:C84910", | ||
"object_label": "Muscular Dystrophy", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "adb4b8ed-c4dc-4353-a08e-a4cb02b1826e", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "SCTID:73297009", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "f6417283-c9d1-4289-aee6-16d30a4445b1", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "UMLS:C0026850", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "93968631-eedb-448b-b58a-e31e3e411dde", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "Orphanet:98473", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "e39e8ba9-8d7e-4b33-9f46-3867b652bdb5", | ||
}, | ||
], | ||
}, | ||
"facet_counts": {"facet_fields": {}, "facet_queries": {}}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import pytest | ||
|
||
|
||
@pytest.fixture | ||
def mappings(): | ||
return { | ||
"limit": 20, | ||
"offset": 0, | ||
"total": 7, | ||
"items": [ | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "DOID:9884", | ||
"object_label": "muscular dystrophy", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "cda26856-16a7-499c-956f-119cbaac5b96", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "ICD10CM:G71.0", | ||
"object_label": "Muscular dystrophy", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "25777569-b997-4c8f-a1f3-5af352a16ee1", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "MESH:D009136", | ||
"object_label": None, | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "819ab197-2ab1-4b73-8d0f-d7d4ec14d8a7", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "NCIT:C84910", | ||
"object_label": "Muscular Dystrophy", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "adb4b8ed-c4dc-4353-a08e-a4cb02b1826e", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "SCTID:73297009", | ||
"object_label": None, | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "f6417283-c9d1-4289-aee6-16d30a4445b1", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "UMLS:C0026850", | ||
"object_label": None, | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "93968631-eedb-448b-b58a-e31e3e411dde", | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "Orphanet:98473", | ||
"object_label": None, | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "e39e8ba9-8d7e-4b33-9f46-3867b652bdb5", | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{ | ||
"limit": 20, | ||
"offset": 0, | ||
"total": 7, | ||
"items": [ | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "DOID:9884", | ||
"object_label": "muscular dystrophy", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "cda26856-16a7-499c-956f-119cbaac5b96" | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "ICD10CM:G71.0", | ||
"object_label": "Muscular dystrophy", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "25777569-b997-4c8f-a1f3-5af352a16ee1" | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "MESH:D009136", | ||
"object_label": null, | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "819ab197-2ab1-4b73-8d0f-d7d4ec14d8a7" | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "NCIT:C84910", | ||
"object_label": "Muscular Dystrophy", | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "adb4b8ed-c4dc-4353-a08e-a4cb02b1826e" | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "SCTID:73297009", | ||
"object_label": null, | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "f6417283-c9d1-4289-aee6-16d30a4445b1" | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "UMLS:C0026850", | ||
"object_label": null, | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "93968631-eedb-448b-b58a-e31e3e411dde" | ||
}, | ||
{ | ||
"subject_id": "MONDO:0020121", | ||
"subject_label": "muscular dystrophy", | ||
"predicate_id": "skos:exactMatch", | ||
"object_id": "Orphanet:98473", | ||
"object_label": null, | ||
"mapping_justification": "semapv:UnspecifiedMatching", | ||
"id": "e39e8ba9-8d7e-4b33-9f46-3867b652bdb5" | ||
} | ||
] | ||
} |
Oops, something went wrong.