OHDSI Home | Forums | Wiki | Github

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?

t