OHDSI Study Agent (development) demo with strategus

For those interested in the OHDSI study design assistant, please see this new demo video (no audio, use captions) that shows the agent used in an R session to design, run, and interpret the results of an OHDSI incidence rate analysis using the CohortIncidenceModule of OHDSI Strategus.

Note that this is a dev demo, the codebase has not been validated.

Please let me know any feedback / questions / suggestions.

Code is at this github site

3 Likes

Hello Dr. Boyce,

I would like to contribute to the StudyAgent project by implementing the Cohort Method component. I understand that the current focus is on phenotyping, but it appears that the long-term goal is to cover the full scope of OHDSI studies.

The attached image below outlines a simplified workflow I drafted for the strategus_cohort_method_shell.R process.

  • For the comparator settings, I plan to follow a structure similar to the currently implemented Strategus incidence shell.
  • For the analytic settings, I am considering two approaches:
    1. allowing users to manually specify each component (for users familiar with OHDSI studies)
    2. generating specifications automatically using an LLM based on study intent or more detailed free-text descriptions.

You may recall that I previously presented a framework called THESEUS with Minseong Kim (burnout909 (김민성) · GitHub) under the guidance of @SCYou .

It is designed to convert natural-language study descriptions into structured JSON-based specifications and Strategus scripts.
I believe this approach could be integrated via ACP/MCP to support analysis specification recommendations within the Strategus Cohort Method shell.

If this direction aligns with the project, I will proceed with the implementation and submit a pull request once it is complete.

1 Like

Hi Hanjae,

Thank you very much for reaching out on this forum and being willing to make this contribution! You have done a great job of summarizing the flow and I like the overview of the approach you provided. I am familiar with your great work on Theseus and think this will be a great contribution to Study Agent.

As you start work on it, take note please that I just added ACP services and MCP tools to assist with Keeper-like case reviews for concept generation, profile extraction, and row adjudication for phenotype validation. See it in action in this video. The SERVICE_REGISTRY.yaml shows these additions.

Also, it isn’t documented clearly yet but I would share with you that I am trying to keep it simple for users to set up the embedding and LLM API config needed for Study Agent. Because I have to use locally-hosted models within an air-gapped environment, I started with an API that implements Open AI style chat completion and embedding APIs (e.g., Open WebUI provides such). However, lots of folks (including myself in a different work setting) want to use commercial or cloud-based services. So, I created a new LLM Shim which provides the simple Open AI API interface but enables access to a variety of cloud-hosted models and Hugging Face’s Text Embedding Inference. I hope this is useful.

Since all of this is in early development, please know that I think all use cases are equally valuable to shape the development direction. I look forward to learning from you as you share your thoughts and suggestions.

FYI: My development focus these next few weeks is going to be on spinning up a sandbox version of Atlas 3 that brings a Study Agent panel into the UI and assists with concept set creation, phenotype selection, and validation. The plan is for UI to use the ACP/MCP services but within the no code environment of Atlas.

Please let me know if you ever want to find time for a call to discuss further.

kind regards,
Rich

Thank you for your prompt response! I’m glad that you are open to this proposal.
I will make sure to follow up on the newly added features and align my work accordingly.

The Atlas 3 with Study Agent sounds very promising! Beyond phenotyping, it would be great to see this evolve further to support PLP and PLE as well. Enabling AI-assisted analytic settings, generating Strategus scripts directly in the interface, and allowing users to download the resulting analysis specifications JSON after execution —all within ATLAS— would be valuable.

I will proceed with implementing the CohortMethod component together with my colleague Minseong Kim. I will reach out if I have further questions during development!

Best regards,
Hanjae.

@Hanjae_Kim It was great to see you on the Gen AI WG call this week and thank you for the great work on the pull request.

I wanted to update you that the main branch now has the latest merge where I refactor the R code into two packages that do a better job of separating concerns. I retained the merge that is closest to your accepted pull request in the branch main-pre-slash-ohdsi-extension.

I will be traveling allot these next couple of weeks and not adding much to the code. The work I plan will be 1) bug fixes to the R workflows and improved integration of /ohdsi contextualized questions, 2) demonstration of Atlas as a client, and 3) a flow for adapting concept-only cohort definitions or creating new cohort definitions from existing concept sets. None of these one should affect the fundamentals of the architecture in the main branch, just stabilize and add functionality.

Please let me know if how I can help with anything you all are planning or have worked on. Also, I would be able to meet with you all a 5:30 Eastern US which should be not too early in the morning your time. There is a team in in Australia that I meet with at that time on Thursdays US time. We could maybe arrange in as an official Gen AI WG team every 2 weeks to get broader Asia/Pacific involvement. Please let me know what you think!

Thanks! R

@rkboyce
My apologies for the late response.
I have had a very busy few weeks, with several deadlines continuing through next week, so I have not been able to focus much on Study Agent recently.

Yes, we would be happy to join meetings with the Austrailia team if it is arragned at 5:30 Eastern time.
I assume this week’s meeting has already taken place, but in any case, I may not be able to join this week.

I will make sure to add the new features for enabling sensitivity analyses in cohort method study before the next monthly meeting, which I believe will be after two weeks.
I will reach out right away if I have any questions while working on it.

Best regards,
Hanjae