Need API access

Hi Team,
We are looking to get Athena vocabulary data programmatically through an API.

Athena (ohdsi.org)

Is there any way we can get this ?

The reason I have contacted you is because Athena is the service offered by OHDSI .Also please provide us the correct contact information in case you are not the correct contact.

We highly appreciate all help here.

Note :- We require this data for analysis purpose.

Regards,
Nihar Handoo

There isn’t currently any API from Athena available. As of now, you need to use the web app to download the files and then you could automate the CPT batch file from there.

But this is something that has been discussed in the OHDSI Technical board as a need. What blockers are there? Security? Cost?

Tagging @gregk @lee_evans @Paul_Nagy.

As far as I know the main blocker is required infrastructure, its costs and resources to support it. Adding API for third-party integration will require significant investments in infrastructure to support high load and Athena API development.

@Konstantin_Yaroshove As part of the OHDSI Perseus roadmap I would like to discuss the feasibility of your team implementing a minimal Athena API. Supporting the ability for an Athena user to request an OHDSI Athena API key from the Athena website and implementing an API request to trigger a vocabulary file download programmatically, would be my initial thought.

I’ll follow up with Greg.

3 Likes

@Konstantin_Yaroshove I believe there is a plan within OHDSI this year to move the Athena website into the OHDSI cloud infrastructure - so that may also help address the infrastructure/resource cost concerns.

1 Like

It is a topic that has been raised multiple times in a landscape assessment (report in progress!), so it should go on the map for sure. Where to place it exactly depends on, as pointed out here by Kostya and Lee and Ajit, on the resources available. @admin Lee, if/when you follow-up with Greg, would be great if you could loop in me & Patrick/George for more context regarding the infrastructure support.

1 Like

@aostropolets will do.

1 Like

Hi All,

I appreciate quick responses from all.
What I understand there is no API currently we can consume, and We have to manually download and then run the batch jobs on them.

@Ajit_Londhe @admin
I would love to hear on this if there are any development on Athena API scope. Please update the post if anything comes up.

Appreciate all help.
Regards,
Nihar Handoo

Hi Nihar,
While digging into scraping data from OHDSI-ATHENA website I came across APIs to interact with ATHENA. Below is the python code to create a pandas df on the results.


size is the pageSize in the query
number is the page in the query
numberOfElements is the actual number of elements returned
empty is a boolean that indicates if any elements have been retuned


import pandas as pd
import requests
import json
import datetime
baseUrl = “https://athena.ohdsi.org/api/v1/concepts
df = pd.DataFrame({‘id’:pd.Series(dtype=int),
‘code’:pd.Series(dtype=‘str’),
‘name’:pd.Series(dtype=‘str’),
‘className’:pd.Series(dtype=‘str’),
‘standardConcept’:pd.Series(dtype=‘str’),
‘invalidReason’:pd.Series(dtype=‘str’),
‘domain’:pd.Series(dtype=‘str’),
‘vocabulary’:pd.Series(dtype=‘str’),
‘score’:pd.Series(dtype=‘str’)})
empty = False
pageNum=1
pageSize=10000
index=1
while not empty:
parameters = {“pageSize”:pageSize,“page”:pageNum,“query”:“aspirin”}
response = requests.get(baseUrl,params=parameters)
data=json.loads(response.content)
empty=data[‘empty’]
if empty:
break
now = datetime.datetime.now()
print(now.strftime("%H:%M:%S"),“page”,pageNum,“contains”,data[‘numberOfElements’],“elements”)
for i in range(0,data[‘numberOfElements’]):
df.loc[index]=data[‘content’][i]
index = index + 1
pageNum = pageNum + 1

Sounds like back in the days of undocumented MS-DOS functions.

Not so fast, folks. There is an API, but there is no machinery, yet, to feed it. Will happen as part of the Vocabulary project led by @aostropolets.

2 Likes

Hi all! Have there been any updates on this?

1 Like

Hello, I’m also interested in this topic, is there any update about this?

Currently [ROhdsiWebApi fails (at least in my hands) fails and doesn’t return Athena queries. Is there a reason (security etc) why Athena should not have an exposed API. s it only designed to work with a local installation ? Is the hades group the best contact regarding this? I

@Aedin_Culhane:

Well, there can only be one Athena, because we need to manage the licenses for non-public vocabularies. But no, there is no reason for not having an API. It just needs somebody to come up with the resources. In the Open Source community - if you need something and it is not there - it is your job. :slight_smile:

Actually there IS an open API that hosts the OHDSI Standardized Vocabularies on a FHIR terminology server!! Have a look at:

https://echidna.fhir.org/

& please provide any feedback. We would love to hear from you!!

Best
Davera Gabriel (gabriel@ohdsi.org)

We presented “Athena-Client: A Community Python SDK for Programmatic Access to the OHDSI Athena Vocabulary Repository” at the latest OHDSI Symposium: Athena-Client: A Community Python SDK for Programmatic Access to the OHDSI Athena Vocabulary Repository – OHDSI

If you need a simple way to query Athena concepts programmatically, check out the unofficial Python SDK “athena-client.” It works anonymously against the public OHDSI server and includes a handy CLI.

  • Install
pip install -U athena-client
  • Basic Python usage
from athena_client import Athena
athena = Athena()  # public server; no token needed

# Search
results = athena.search("aspirin")
print("Top 3:", [c.name for c in results.top(3)])

# Concept details
d = athena.details(1127433)
print(d.id, d.name, d.domainId, d.vocabularyId)

# Relationships (only standard concepts)
rels = athena.relationships(1127433, only_standard=True)
print("Groups:", rels.count)

# Graph (small depth)
g = athena.graph(1127433, depth=2)
print("Graph terms:", len(g.terms), "links:", len(g.links))
  • CLI (optional)
athena search "aspirin" --limit 3
athena details 1127433
athena relationships 1127433 --only-standard

PyPI: athena-client · PyPI

Happy to hear feedback or feature requests!