dhti-cli
    Preparing search index...

    dhti-cli

    npm version npm Build Known Vulnerabilities Documentation

    • πŸš€ Dhanvantari rose out of the water with his four hands, holding a pot full of elixirs!

    TL; DR: dhti-cli is for quick prototyping, developing, sharing and testing of Gen AI applications, models, and UI elements within the context of an electronic health record. Paper coming soon!

    Gen AI can transform medicine. But it needs a framework for collaborative research and practice. DHTI is a reference architecture and an implementation for such a framework that integrates an EMR (OpenMRS), :link: Gen AI application server (LangServe), self-hosted LLMs for privacy (Ollama), tools on MCP server, vector store for RAG (redis), monitoring (LangFuse), πŸ”₯ FHIR repository with CQL support (HAPI) and graph utilities (Neo4j) in one docker-compose! DHTI is inspired by Bahmni and aims to facilitate GenAI adoption and research in areas with low resources. The MCP server hosts pluggable, agent-invokable tools (FHIR query, summarization, terminology lookup, custom analytics, etc.) that you can extend without modifying core services.

    The essence of DHTI is modularity with an emphasis on configuration! It is non-opinionated on LLMs, hyperparameters and pretty much everything. DHTI supports installable Gen AI routines through LangChain templates (which we call :curry: elixir) and installable UI elements through OpenMRS O3 React container (which we call :shell: conch). πŸ”₯ FHIR is used for backend and CDS-Hooks for frontend communication, decoupling conches from OpenMRS, making them potentially usable with any health information system. We have a fork of the cds-hook sandbox for testing that uses the order-select hook, utilizing the contentString from the FHIR CommunicationRequest within the cds-hook context for user inputs (recommended).

    πŸš€ dhti-cli is a CLI tool for quick prototyping and testing of elixirs and conches. You can create a new docker-compose with required modules, start/stop services, install Elixirs and conch, create Docker images for them, and more. πŸš€ This helps to test new ideas and share them with others quickly. πŸš€ Once tested, you can transition them to the production team for deployment. Adoption of standards makes this transition easier!

    ⭐️ Pitched at Falling Walls Lab Illinois and released on 09/12/2025.

    Why How
    I know LangChain, but I don’t know how to build a chain/agent based on data in our EHR. This template adopts FHIR and cds-hooks as standards for data retrieval and display. The base class provides reusable artifacts
    I need a simple platform for experimenting. This repository provides everything to start experimenting fast. The command-line tools help to virtualize and orchestrate your experiments using Docker
    I am a UI designer. I want to design helpful UI for real users. See this template. It shows how to build interface components (conches) for OpenMRS an open-source EMR used by many. Read more about OpenMRS UI
    We use another EMR Your EMR may support CDS-Hook for displaying components. In that case, you can use cds-hooks-sandbox for testing
    Our IT team is often unable to take my experiments to production. Use DHTI, follow the recommended patterns, and you will make their lives easier.

    • Modular: Supports installable Gen AI routines and UI elements.
    • Quick prototyping: CLI helps in quick prototyping and testing of Gen AI routines and UI elements.
    • Easy to use: Can be installed in a few minutes.
    • Developer friendly: Copy working files to running containers for testing.
    • Dependency Injection: Dependency injection for models and hyperparameters for configuring elixirs.
    • Generate synthetic data: DHTI supports generating synthetic data for testing.
    • CQL support: CQL for clinical decision support.
    • FHIR: Data exchange with FHIR schema.
    • MCP: Built in MCP server for pluggable tools.
    • EMR: Built in EMR, OpenMRS, for patient records.
    • Vector store: Redis for vector store.
    • Monitoring: LangFuse for monitoring.
    • Graph utilities: Neo4j for graph utilities.
    • LLM: Ollama for self-hosting LLM models.

    Developers can build elixirs and conchs for DHTI.

    :curry: Elixirs are LangChain templates for backend GenAI functionality. By convention, Elixirs are prefixed with dhti-elixir- and all elixirs depend on dhti-elixir-base which provides some base classes and defines dependencies. You can use this template to build new elixirs, and license it the way you want (We :heart: open-source!).

    :shell: Conches are OpenMRS O3s and follow the standard naming convention openmrs-esm-. A separate OpenMRS independant container for conchs is on our roadmap for use outside OpenMRS. You can use this template to build new conches.

    :white_check_mark:

    • Developer friendly: Copy working files to running containers for testing.
    • Dependency Injection: Dependency injection for models and hyperparameters for configuring elixirs.

    DHTI provides a platform to deploy language models and Gen AI applications in the context of an electronic health record.

    DHTI serves as a platform for testing prompts, chains and agents in healthcare applications. Since the stack uses the :fire: FHIR data model, it is easy to load synthetic data.

    Tools to fine-tune language models for the stack are on our roadmap. We encourage all language models built for this platform to be open sourced on HuggingFace with the names starting with dhti-.

    :white_check_mark:

    • Generate synthetic data: DHTI supports generating synthetic data for testing.
    • CQL support: CQL for clinical decision support.
    • FHIR: Data exchange with FHIR schema.
    • EMR: Built in EMR, OpenMRS, for patient records.

    🌈 Join us to make the Gen AI equitable and help doctors save lives!

    • fhiry: FHIR to pandas dataframe for data analytics, AI and ML!
    • pyOMOP: For OMOP CDM support
    • dhti-elixir-fhire: An elixir for extracting embeddings from FHIR resources for Q&A on patient records.
    • dhti-elixir-fhirs: An elixir for text to FHIR search query conversion.
    • dhti-elixir-upload: Upload documents to the vector store for clinical knowledgebase and clinical trial matching.
    • openmrs-esm-qa: A sample conch for Q&A on patient records using the dhti-elixir-fhire elixir.
    dhti-cli help
    
    • As an example, get help for compose:
    dhti-cli compose --help
    

    You only need:

    • docker
    • nodejs
    • Git clone this repository: git clone https://github.com/dermatologist/dhti.git && cd dhti
    • Install the required packages: npm install
    • Build the CLI: npm run build
    • Install CLI locally: npm link
    • Test the CLI: dhti-cli help This will show the available commands.
    • The working directory is ~/dhti (Customizable)
    • Create a new docker-compose file: dhti-cli compose add -m openmrs -m langserve

    • The docker-compose.yml is created with the following modules:

      • OpenMRS (EMR)
      • LangServe (API for LLM models)

    Other available modules: ollama, langfuse, cqlFhir, redis, neo4j and mcpFhir (Documentation in progress)

    You can read the newly created docker-compose by: dhti-cli compose read

    • Start the services: dhti-cli docker -u

    It may take a while to download the images and start the services. (OpenMRS may take upto 45 mins the first time to setup the database)

    • Go to http://localhost/openmrs/spa/home
    • Login with the following credentials:
      • Username: admin
      • Password: Admin123
      • Choose any location and click on 'confirm'.
    • Go to localhost:8001/docs (Empty Swagger UI)
    • Shut down the services: dhti-cli docker -d
    • Let's install the elixir here: https://github.com/dermatologist/dhti-elixir-template. This is just a template that uses a Mock LLM to output random text. You can use this template to build your own elixirs! (Cookiecutter to be released soon!) Later you will see how to add real LLM support.

    :running:

    dhti-cli elixir install -g https://github.com/dermatologist/dhti-elixir-template.git -n dhti-elixir-template.

    You may also install from PyPi or a wheel file!

    cat ~/dhti/elixir/app/bootstrap.py

    This is where you can override defaults in the elixir for LLM, embedding model, hyperparameters etc that are injected at runtime. Refer to each elixir for the available options. You may check out how to inject a real LLM using Google Gemini!

    dhti-cli docker -n beapen/genai-test:1.0 -t elixir

    (You may replace beapen/genai-test:1.0 with your own image name)

    While developing you can copy the app folder to a running container for testing (provided there are no changes in dependencies). Read more here.

    :shell: dhti-cli conch install -g https://github.com/dermatologist/openmrs-esm-dhti-template.git -n openmrs-esm-dhti-template

    We can also install from a dev folder after cloning the repository. While developing you can copy the dist folder to a running container for testing. Read more here.

    dhti-cli docker -n beapen/conch-test:1.0 -t conch

    dhti-cli docker -u

    • Go to http://localhost/openmrs/spa/home
    • Login with the following credentials:
      • Username: admin
      • Password: Admin123

    You will see the new conch in the left margin. Click on Dhti app to see the UI. This is just a template, though. You can build your own conchs!

    Add some text to the text area and click on Submit. You will see the text above the textbox.

    You can remove the services by: dhti-cli docker -d

    :hugs: Thank you for trying out DHTI!

    If you find this project useful, give us a star. It helps others discover the project.