OHDSI Home | Forums | Wiki | Github

Running a JSON cohort definition using the WebAPI?

Hello,
I am looking for a way to run a cohort definition written in OHDSI JSON format against an OMOP repository. Is there a way for the program I am writing to use the WebAPI to submit the query and retrieve the results? Any suggestions/advice is appreciated.
Thank you
Rick

1 Like

You can use the Web Development Tools (started by F12 in common browsers) to inspect the Network
requests triggered by any action. Alternatively, you can also check out the WebAPI sources for the URL endpoint annotations.
After you know the URL and parameters, any HTTP client could replicate the request.

PS: For example, you can try http://127.0.0.1:8080/WebAPI/cohortresults/CDM/3/tornado to fetch the results of a previous report (third cohort definition of the CDM database, in this example).
The server will answer with a plain-text JSON response:

{"tornadoRecords":[{"genderConceptId":8532,"ageGroup":50,"personCount":2691},{"genderConceptId":8532,"ageGroup":40,"personCount":1156},{"genderConceptId":8532,"ageGroup":10,"personCount":13},{"genderConceptId":8532,"ageGroup":30,"personCount":261},{"genderConceptId":8507,"ageGroup":40,"personCount":1459},{"genderConceptId":8532,"ageGroup":70,"personCount":2982},{"genderConceptId":8507,"ageGroup":30,"personCount":284},{"genderConceptId":8507,"ageGroup":10,"personCount":16},{"genderConceptId":8507,"ageGroup":60,"personCount":3776},{"genderConceptId":8507,"ageGroup":80,"personCount":379},{"genderConceptId":8532,"ageGroup":20,"personCount":54},{"genderConceptId":8507,"ageGroup":20,"personCount":74},{"genderConceptId":8532,"ageGroup":60,"personCount":3417},{"genderConceptId":8532,"ageGroup":80,"personCount":416},{"genderConceptId":8507,"ageGroup":50,"personCount":3218},{"genderConceptId":8507,"ageGroup":70,"personCount":3143}],"profileSamples":[{"genderConceptId":8532,"personId":65395...

To give some more information - the application I am working on is for the PhEMA project.
http://informatics.mayo.edu/phema/index.php/Main_Page

This portion of the workflow is the elm-to-ohdsi executer

It is a Java application where I convert a file in elm format to OHDSI JSON format. My hope is to use the WebAPI to submit the JSON definition and retrieve a cohort. The user will indicate whether they want a count or a patient list. Currently working on a simple definition for a cohort of diabetes patients. Once that is complete, will expand the transform to handle more advanced definitions.

Will look into Daniel’s suggestions. Any other suggestions will be appreciated.

Thank you
Rick

1 Like
t