Skip to content

ikram-shah/fhir-ai-and-openapi-chain

Repository files navigation

FHIR - AI and OpenAPI Chain

Gitter Quality Gate Status

💻 Contributors - Ikram Shah and Sowmiya Nagarajan.

💪 Built with OpenAI, LangChain & Streamlit

Demo

apichain.demo.mp4

Overview

🤖 Ask question to any of your chosen FHIR API in natural language 🤖

Screenshot 2023-07-04 at 12 31 35 AM

Try online on Streamlit

  1. Get OpenAI Key from OpenAI Platform
  2. Get FHIR Server API endpoint
    • You may either enter your own sample FHIR server (unauthenticated access needed)
    • You may create a temporary sample server in Intersystems IRIS FHIR platform

Try locally using local FHIR server

OpenAI API Key

Get OpenAI Key from OpenAI Platform

Setup Local FHIR Server

  1. Prerequisites: Git & Docker desktop
  2. Installation:
    $ git clone https://github.com/ikram-shah/fhir-ai-and-openapi-chain.git
    
    $ docker-compose up -d
    
  3. Generate sample patient data ref
    ./synthea-loader.sh 10
    
    docker-compose exec iris iris session iris -U FHIRServer
    
    FHIRSERVER>d ##class(fhirtemplate.Setup).LoadPatientData("/irisdev/app/output/fhir","FHIRSERVER","/fhir/r4")
    
  4. Test FHIR R4 API by visitng http://localhost:32783/fhir/r4/metadata

Streamlit

pip install -r requirements.txt
streamlit run src/streamlit/src/main.py

Folder Structure

fhir-ai-and-openapi-chain/
├──src
│   ├── streamlit/              //streamlit code             
│   │   ├── src/
│   │   │   ├── main.py                 
│   │   │   └── ...
│   └── fhirtemplate/
│       ├── setup.cls
│       └── ...
.
.
.
├── requirements.txt            //requirements for streamlit to run
├── docker-compose.yml
├── Dockerfile
├── README.md
└── LICENSE

Known Limitations

Due to the limitations imposed by OpenAI's token usage, if the reference data + prompt being sent to the OpenAI API exceeds the specified limit, an error may be encountered.

Screenshot 2023-07-04 at 12 46 09 AM

Useful Resouces

HL7 OpenAPI Specifications

FHIR Postman collection by apievangelist

Run in Postman

InterSystems IRIS FHIR Documentation

FHIR API

Intersystems Community

License

This project is licensed under the MIT License.

You can find the full text of the license in the LICENSE file.