🤖 AI and OpenMRS: Community Kick-off Discussion

There is rising interest among organizations in the OpenMRS community & ecosystem in the role of AI and what the explosion in Generative AI’s capabilities mean for the EMR world. For example:

  • IntelliSOFT is prototyping how GenAI could help summarize discharge instructions
  • Regenstrief & DIGI are excited about the role GenAI could play in Better Chart Search
  • Madiro is using LLMs to help convert paper forms into O3 Forms
  • …and more!

Goal: Hear from community organizations & members about the problems/needs they hope to solve, and plan next steps (e.g. AI squad?)

When: March 10, Monday, 3pm UTC / 6pm EAT / 8:30pm IST / 8am PST / 11am EST

Link: https://om.rs/zoomopenmrs

For more call info, see the public OpenMRS Community Calendar at: om.rs/cal

17 Likes

@grace another one that @akhilmalhotra advertised for Bahmni is their integration with Medispeak, quote:

Medispeak is a voice-to-text solution designed to enhance clinical workflows by enabling seamless data entry through voice commands. This integration aims to improve accessibility and efficiency for healthcare providers using Bahmni.

Demo here: https://www.youtube.com/watch?v=TfTON8oJhEs

4 Likes

hello @grace, could there be a recording for those who missed?

Thanks

Hello Community! Please find the recording from our AI conversation at this link, or in the embedded video below: https://iu.mediaspace.kaltura.com/media/t/1_hoei5nqb

Our whiteboard with the key points shared is public on the OpenMRS Wiki here: https://openmrs.atlassian.net/wiki/spaces/projects/whiteboard/389939204?atlOrigin=eyJpIjoiMDkzNjY2Y2FjNTdhNDM1ODhhYjMwZDBjNGU1NDIwYzQiLCJwIjoiYyJ9

Next Meetings

  • Terry Mochire will organize a follow-on general community session in 2-3 weeks.
  • Detailed presentation and demo of Content & Mappings Automation project coming to community in a few weeks!

What was discussed

The key ideas shared were:

1. Automated Concept Mapping help

  • @michaelbontyes from @Madiro and @paynejd from @OpenConceptLab shared their project to help implementers / form-builders to rapidly match form content with existing Concepts / Terminology codes. Saves days to weeks of refining content and terminology picking.

2. Generate SMS Discharge Instructions

  • Dr. Terry Mochire from @Intellisoft shared how they are using GPT’s API to generate discharge messages to patients after their OPD visit.
  • Next steps:
    • Looking to pilot test soon.
    • Talk post & docs coming.

3. Chart Search (LLM-supported)

4. Query Support: For Clinic Managers, or M&E Officers, or Report Generation

  • Clinic Query Support: A UI connected to an LLM, where a user (like a clinician or clinic manager) could ask questions of their EMR, and in the background the LLM would convert their plain english questions into OpenMRS-friendly SQL queries, then query the OpenMRS DB; e.g. “How many patients are sick with 1,2,3…”
  • Or, could first focus on helping M&E Officers: an LLM helping data managers with crafting SQL. Why focus on M&E staff? Because: End-user-generated SQL via LLM (other than very simple examples) sounds like a bridge too far at the moment. Knowing the types of questions clinicians ask and what it takes to answer these properly usually requires a data manager & skills beyond today’s LLMs.
  • Report Generation: Not waste a lot of time writing complicated report queries.
  • @bennyange from @EMR4All shared helpful detail about the practical investigations EMR4All has been pursuing with using LLMs in this regard:
    • Natural Language to SQL for Cohort Builder – AI to convert plain English queries into SQL to simplify data retrieval for Clinical Decision Support – AI to analyzes patient records for insights and recommendations.
    • EMR4All tested Ollama (Smollama2) allowing offline AI execution without relying on OpenAI APIs. We also tested DeepSeek More accurate but slower due to hardware constraints.
  • Next steps: EMR4All team will explore agent-based AI for OpenMRS automation for Medical Data Processing & Summarization to automate extraction of key insights from patient notes. They will keep us posted on how this goes.

5. Writing Clinical Visit Notes

  • Not discussed in detail, but this was raised as an example use case worth considering.

6. Use as data source for Drug-Drug Interactions

@muppasanipraneeth19 proposed the following ideas shared publicly on GitHub that would involve using existing LLMs to inform the content needed to help catch drug-drug interactions in Prescription Workflows: GitHub - Muppasanipraneeth/aashayams

8 Likes

Hi @dkayiwa and @grace,

I am interested in developing the ChartSearchAI project through to completion. I reviewed the ChartSearchAI wiki page and noted the project is currently in the “Requirements In Progress” phase.

My technical background aligns with the OpenMRS stack and the project’s AI requirements:

  • Backend & Frontend: Java, Spring Boot, ReactJS, Python, Go, and TypeScript.

  • AI/ML Architecture: LLM integration, Retrieval-Augmented Generation (RAG), and end-to-end AI system design.

  • Serving & Infrastructure: Local and scalable model serving (vLLM, Ray Serve, Triton) and microservices architecture.

Since the wiki mentions it is currently in the “Requirements In Progress” phase, I’d love to know the current status. What are the immediate blockers, and how can I best get started? If there is a Jira board, repo, or an upcoming squad meeting I should join, please let me know.

Looking forward to contributing.

1 Like

Did you want to do this as a GSoC project?

No, I am not looking to do this as a Google Summer of Code (GSoC) project. My goal is strictly to contribute to OpenMRS as a volunteer open-source developer and help drive the ChartSearchAI project to completion.

Please let me know how I can best get started with the current requirements or codebase.

1 Like

That is awesome! :+1:

This is the repository for the backend module: GitHub - openmrs/openmrs-module-chartsearchai: AI-powered chart search module for OpenMRS · GitHub

And this is the repository for the frontend module: GitHub - openmrs/openmrs-esm-chartsearchai: AI-powered chart search for OpenMRS O3 · GitHub

Do you wanna take a look at them and share your thoughts?

1 Like

@dkayiwa Thank you for providing the repositories.

My immediate next steps are to review the wiki documentation and set up my local development environment for both the backend and frontend modules.

Once I have the environment running and have reviewed the codebase, I will follow up here with my thoughts and any initial questions.

Thanks @mikoaro and we are anxiously looking forward to that. :+1:

@dkayiwa

Availability Update Just a quick heads-up on my schedule: I’m based in Austin, TX (CDT). My best times to contribute will primarily be on weekends, with some occasional availability during the evenings.

Architecture Progress I’ve been iterating on the architecture. Initially, I planned to use a Python worker to poll RabbitMQ, but I’ve decided to pivot to a Java worker. This keeps the logic natively aligned with OpenMRS’s Java-centric API backend. For the AI integration, I’m evaluating Spring AI versus LangChain4j, the final choice will depend on the specific Java runtime version our target OpenMRS environment uses.

Open Questions To help me finalize the design, I could use some clarity on the following:

  • Hardware Targets: Are we assuming CPU-only deployments, or will GPUs be available?

  • Performance Metrics: What are our target metrics and the expected peak number of concurrent users?

  • Deployment Spectrum: What do the absolute best-case and worst-case deployment environments look like?

1. The Worst-Case Target: Low-Resource & Remote

These are often rural clinics or temporary mobile units where stability is a luxury.

  • Hardware: Often a single Mini-Server.

  • Specs: 4–8 GB RAM, Quad-core ARM or low-power Intel CPU. No GPU.

  • Connectivity: intermittent or “Never-on.” The system must operate entirely offline.

  • Design Implication: The Java worker and Ollama instance may share a very small memory pool. This is where RabbitMQ is vital; it prevents the system from crashing if the CPU hits 100% during an LLM inference.

2. The Rugged Target: High-Vibration / Harsh Conditions

Found in mobile clinics, ambulances, or areas with frequent power surges/outages.

  • Hardware: Fanless, solid-state industrial PCs.

  • Power: Unreliable grid. Systems often rely on battery-backed UPS or tablets.

  • Design Implication: Database integrity is the primary risk. The architecture must handle abrupt shutdowns. Using a message broker ensures that a Chat Task isn’t lost if the power cuts mid-summary; it simply remains in the queue for the next boot.

3. The Best-Case Target: Regional Hospital / Cloud

These are large facilities or national-level implementations.

  • Hardware: Enterprise-grade rack servers or Cloud (AWS t3.xlarge+).

  • Specs: 32–128 GB RAM, 16+ Cores. Potential for NVIDIA L4/T4 GPUs in specialized setups.

  • Design Implication: High concurrency. This is where the Ollama parallel configuration and RabbitMQ throughput will be tested by 50+ clinicians using the chart search simultaneously.


Target Constraints Table

Feature Resource-Constrained (Rural) Enterprise / Cloud (Hospital)
Primary Goal Survival & Data Persistence High Concurrency & Speed
LLM Model Tiny/Quantized (e.g., Llama-3-3B-Q4, Gemma) Large/Vision (e.g., MedGemma, LLaVA or MedLlama)
Inference CPU-only (Slow, ~1-2 tokens/sec) GPU-accelerated (Fast, 50+ tokens/sec)
User Load 1–5 concurrent clinicians 50–200+ concurrent clinicians

Gemma and MedGemma Constraint Mapping

Target Environment Recommended Model Hardware Requirements Performance Expectation
Worst-Case (Rural/Remote) Gemma 3 4B or MedGemma 4B (Quantized Q4) CPU Only: 8GB+ RAM (e.g., Mini-PC). Functional but Slow: ~2–4 tokens per second. Best for simple summarization.
Rugged (Mobile/Industrial) MedGemma 4B or Gemma 3 12B CPU + Fast SSD: 16GB+ RAM. Fanless industrial PCs. Consistent: Stable inference. The 4B model is highly responsive on modern CPUs.
Best-Case (Hospital/Cloud) MedGemma 27B (Multimodal or Text-only) GPU Required: NVIDIA L4 (24GB VRAM) or A100. Clinical Grade: Fast (~30+ tokens/sec). High accuracy for complex reasoning.

For Java Logic

Deciding between Spring AI and LangChain4j:

  • Choosing LangChain4j if supporting the Worst-Case targets. It has a smaller footprint and works better with the older Java versions still common in some long-standing remote OpenMRS installations.

  • Choosing Spring AI if certain the target environment is running Java 17+ and a modern OpenMRS Platform (2.6+).

**OpenMRS Local Chart Search and Multimodal AI Architecture **

This architecture introduces a comprehensive multimodal search system, encompassing both semantic text search and visual image search, alongside the AI chat feature. By integrating multimodal capabilities, clinicians can query patient records using text or medical images, such as X rays or scanned documents.

To clarify how the UI maps to the architecture: The OpenMRS O3 ESM Frontend block represents the entire React application. Within that application, there are two distinct interfaces:

  1. A Search Box: Used for direct record retrieval (text or image uploads). This triggers Flow A.

  2. A Chat UI: Used for conversational AI and summarization. This triggers Flow B.

Here is the direct, step-by-step operational flow of the consolidated Java architecture, explicitly detailing the multimodal and UI routing steps.

Core Components

  • Frontend: OpenMRS O3 ESM (Contains both Search Box UI and Chat UI)

  • Backend: Single Java Module (Hosts the REST API Receiver and Async AMQP Worker)

  • Broker: RabbitMQ (Task queue)

  • Database: FHIR Store, PostgreSQL with pgvector, and Image Storage (Data layer)

  • LLM: Ollama (Multimodal Local AI engine)


Step-by-Step Execution

Initial Routing

  • Step 1: The user interacts with the Frontend.

    • If the user submits text or uploads an image via the Search Box, the frontend calls the search API endpoint.

    • If the user submits a prompt via the Chat UI, the frontend calls the chat API endpoint.

    • The Java Module REST API receives the HTTP request and routes it down the appropriate path.

Flow A: Synchronous Multimodal Search (Fast Path) This path runs when a user uses the Search Box to find specific records or visually similar X-rays.

  • Step 2a: The REST API bypasses the message broker entirely. It takes the text string or the uploaded image and queries the Database. It performs a semantic search for text similarities OR a visual search comparing image embeddings to find visually comparable medical files.

  • Step 3a: The Database returns the exact matching medical records or similar image files.

  • Step 4a: The REST API instantly returns this data to the Frontend as a standard JSON response, which renders the results under the Search Box.

Flow B: Asynchronous Chat Synthesis (Slow Path) This path runs when a user uses the Chat UI to ask the AI to analyze data and generate a summary.

  • Step 2b: The REST API receives the chat prompt. Because LLM generation is slow, it packages the request into a message, publishes it to RabbitMQ, and returns an immediate HTTP 202 Accepted to the Frontend to keep the UI responsive.

  • Step 3b: The internal Java Async AMQP Worker, running on a separate thread, continuously listens to RabbitMQ and consumes the pending task.

  • Step 4b: The Worker queries the Database for the patient’s relevant textual history and medical images based on the prompt’s context.

  • Step 5b: The Database returns this multimodal context (text + images) to the Worker.

  • Step 6b: The Worker combines the user’s prompt with the retrieved text and images, sending the augmented payload to the Ollama LLM via HTTP.

  • Step 7b: Ollama processes the text and visual data, then streams the generated text summary back to the Worker.

  • Step 8b: The Worker streams the incoming text directly to the Frontend’s Chat UI via Server-Sent Events (SSE) for the user to read in real time.

2 Likes

That you so much @mikoaro for a very nice and thoughtful plan! :+1:

Do you mind starting a new talk thread dedicated to chartsearchai, such that we leave this one for general ideas about AI applications in OpenMRS?

@burke on today’s O3 call, you brought up a very cool OpenMRS AI Assistant idea, do you mind expanding it here?

I think that the chart and query support if implemented will be very powerful force multipliers for staff members, at least in my line of work. I’m in behavioral/mental health, specifically residential treatment which is long term and/or transitional care in a house setting, and currently seeing if I can adapt OpenMRS for my purposes. Schizo -phrenia/affective, bipolar, drug addiction, etc.

I will soon be open to testing these two functionalities with a local server, and others if needed. I currently have a HP dl385p gen 8 that I can build. I am new to hardware, but I believe Tesla P40s can work and are within my budget. So if I have 2x P40s 48GB VRAM to fit larger models, albeit slower and no tensor cores to optimize concurrency, this would fit below the Best-Case target that @mikoaro identified.

I see that there is already a repo lol, I have deleted my rambling as much of it is already talked about in the repo

Hi everyone!

I saw this discussion and it is really interesting. I’m particularly interested in the use of AI for healthcare applications.

I’ve worked on projects like a healthcare chatbot (MedIQ) and an AI-based skin analysis system, and I find ideas like AI-powered chart search and patient interaction very exciting and want to expand in this field myself further.

I would love to explore how I can contribute to some of these AI-related initiatives in OpenMRS. Are there any beginner friendly tasks or areas where I can get started?

Im looking forward to learning and contributing!

Please feel free to explore any idea that crosses your mind. We are at the stage where we greatly encourage AI innovations in OpenMRS. Here is an example of what @nethmi tried out and shared: AI-generated visit summaries in OpenMRS - a prototype

Thank you so much for the reassurance! I was thinking of focusing on improving the ChartSearchAI module by enhancing how patient data is summarized and presented to clinicians using AI.

I’m particularly interested in improving response quality, adding better context handling, and making the interaction more intuitive.

Would this be a good direction for a GSoC proposal?

This is not a GSoC project.