Create clinical_nlp/umls_bioportal.py
Browse files
clinical_nlp/umls_bioportal.py
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import requests
|
2 |
+
from config.settings import settings
|
3 |
+
|
4 |
+
def lookup_umls(term):
|
5 |
+
url = f"https://uts-ws.nlm.nih.gov/rest/search/current?string={term}&apiKey={settings.umls_api_key}"
|
6 |
+
return requests.get(url).json().get("result",{}).get("results",[])[:5]
|
7 |
+
|
8 |
+
def lookup_bioportal(term):
|
9 |
+
url = f"https://data.bioontology.org/search?q={term}&apikey={settings.bioportal_api_key}"
|
10 |
+
return requests.get(url).json().get("collection",[])[:5]
|