Spaces:
Sleeping
Sleeping
Update utils/api_integrations.py
Browse files- utils/api_integrations.py +23 -0
utils/api_integrations.py
CHANGED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# genesis/utils/api_helpers.py
|
2 |
+
from genesis.api_clients import chembl_api, pubmed_api, bioportal_api, umls_api, ncbi_api
|
3 |
+
|
4 |
+
def get_molecule_info(query):
|
5 |
+
return {
|
6 |
+
"search": chembl_api.search_molecule(query),
|
7 |
+
"details": chembl_api.get_molecule_details(query)
|
8 |
+
}
|
9 |
+
|
10 |
+
def get_pubmed_articles(query):
|
11 |
+
search = pubmed_api.search_pubmed(query)
|
12 |
+
ids = search.get("esearchresult", {}).get("idlist", [])
|
13 |
+
details = pubmed_api.fetch_pubmed_details(ids) if ids else None
|
14 |
+
return {"search": search, "details": details}
|
15 |
+
|
16 |
+
def get_bioportal_results(query):
|
17 |
+
return bioportal_api.search_bioportal(query)
|
18 |
+
|
19 |
+
def get_umls_results(query):
|
20 |
+
return umls_api.search_umls(query)
|
21 |
+
|
22 |
+
def get_ncbi_gene(query):
|
23 |
+
return ncbi_api.search_gene(query)
|