DHTI ELIXIR BASE¶
Base library for creating new DHTI Elixirs.
What is DHTI? DHTI (Digital Health Tooling Interface) provides building blocks for interoperable, healthcare-focused AI tooling. This repository is the minimal foundation you extend to build your own "Elixir"—a reusable, testable component (chain/agent/server) that plugs into the wider DHTI ecosystem.
Status: WIP, but stable enough to scaffold new Elixirs and iterate quickly.
Overview¶
This package exposes lightweight, composable base classes:
BaseChain– a LangChain-compatible chain scaffold with sensible defaults.BaseAgent– an agent scaffold that can bind tools and work with LangGraph.BaseGraph,BaseLLM,BaseServer,BaseSpace, andBaseDhtiModel– helpers to organize more complex Elixirs.
Use these to rapidly create a new Elixir with a consistent structure, tests, and docs.
Dependency Injection (mydi.py / di)¶
The codebase uses a simple dependency injection pattern via mydi.py and the get_di function. This allows you to:
- Configure FHIR endpoints, authentication, and other settings at runtime
- Swap out implementations for testing or customization
- Keep your code modular and maintainable
CDS Hook Module (Frontend Integration)¶
The cds_hook module now provides request parsing and context extraction for CDS Hooks workflows. It supports:
- Parsing various CDS Hooks request formats
- Extracting patient and order context
This enables integration with frontend CDS Hooks clients.
FHIR Module (Backend Integration: SMART on FHIR & FHIRPath)¶
The fhir module includes advanced backend features:
- SMART on FHIR: The SmartOnFhirSearch class provides secure, standards-based access to FHIR resources using OAuth2 and the SMART on FHIR protocol. It supports:
- Patient-centric resource queries (Conditions, Observations, Procedures, MedicationRequests, AllergyIntolerances)
- $everything operation for comprehensive patient data
- Automatic token management and authentication
- FHIRPath Support: All resource queries can apply FHIRPath expressions for flexible data extraction and transformation.
CrewAI Integration (Optional)¶
The crewai module provides wrapper classes that make DHTI's LangChain-based components compatible with the CrewAI framework:
- CrewAILLMWrapper: Wraps BaseLLM and BaseChatLLM for use with CrewAI agents
- CrewAIAgentWrapper: Wraps BaseAgent to create CrewAI-compatible agents
- CrewAIChainToolWrapper: Wraps BaseChain as a CrewAI tool
- CrewAILangChainToolWrapper: Wraps LangChain tools for use in CrewAI
To use CrewAI integration, install with the optional dependency:
pip install dhti-elixir-base[crewai]
See the CrewAI documentation for detailed usage examples.
Project layout¶
src/dhti_elixir_base/– base classes and minimal utilities.tests/– example tests to keep your Elixir robust.examples/– quick patterns for chains/graphs.docs/– MkDocs configuration for documentation.
Learn more¶
- DHTI home: https://github.com/dermatologist/dhti
- This template docs: https://dermatologist.github.io/dhti-elixir-base/
Give us a star ⭐️¶
If you find this project useful, give us a star. It helps others discover the project.