This agent provides tools for interacting with a FHIR server using PhenoML's lang2fhir API for natural language processing of healthcare data.
Demo of an agent that you can build using this repo!
Check out this fork for Carely, the entire AI caregiver app we built during the OOP Hackathon: includes an agent built for EHR workflows powered by PhenoML, and task management with Todoist and Google Maps support!
- Convert natural language descriptions to FHIR resources using PhenoML's lang2fhir API
- Convert natural language queries to FHIR search parameters
- Perform direct FHIR searches and resource creation on a FHIR server
- Automatically handle patient context for related resources
- PhenoML account with access to the lang2fhir API
- Medplum or Canvas Medical account (or other FHIR server) for storing created resources and executing FHIR searches
- Python 3.8+
- Gemini API access: sign up for a Gemini API key here
-
Clone this repository
-
Create your virtual environment
python3 -m venv .venv
-
Activate (each new terminal) for macOS/Linux
source .venv/bin/activate
-
Install dependencies
pip install -r requirements.txt
-
Authenticate and set up environment variables:
a. Set .env credentials: Open the file
agents/.env
in your text editor of choice and set your PhenoML credentials and either Medplum or Canvas credentials based on which EMR you have chosen.b. Obtain PhenoML Token:
# Run the PhenoML authentication script with --save flag to save to .env automatically. Assumes your credentials are in your .env already python3 auth/phenoml_auth.py --save
c. Obtain Medplum Token (if using Medplum):
# Run the Medplum authentication script with --save flag to save to .env automatically. Assumes your credentials are in your .env already python3 auth/medplum_auth.py --save
d. Obtain Canvas Token (if using Canvas):
# Run the Canvas authentication script with --save flag to save to .env automatically. Assumes your credentials are in your .env already python3 auth/canvas_auth.py --save
-
Run your agent!
adk run multi_lang2fhir_agent
You can also run your agent in a dev UI or spin up an api server. Check out google's ADK quick start
This agent uses PhenoML's lang2fhir API, which provides:
- Create endpoint: Converts natural language to structured FHIR resources
- Search endpoint: Converts natural language to FHIR search parameters
For more information, visit: PhenoML Documentation