IRIS FHIR Transcribe-Summarize-Export
๐ป Contributors - Ikram Shah and Sowmiya Nagarajan.
๐ Built with IRIS FHIR, OpenAI, Langchain, Vue.js, Google Docs/Sheets API.
Demo
https://github.com/ikram-shah/iris-fhir-transcribe-summarize-export/assets/20276568/9edfedab-2d3d-442c-8853-21123bc49224
Overview
This is a full-stack application that allows practitioners and other clinicians to record voice notes linked to a subject and also export them to Google Docs/Sheets.
- The UI enables voice recording and the audio is transcribed to text using Open AI Whisper API.
- Then the notes are summarized using Open AI text-davinci-003 model and stored as Document References in FHIR server.
- Finally, there is an option to export the stored documents to Google Docs in an account of userโs choice through OAuth2. Other data like Observations can be exported to Google Sheets.
Note - This implements a Community idea๐ก. Docs and Sheets export is directly handled via REST api in IRIS now. Itโs not an interoperability adapter yet and itโs WIP.
The application also acts as a dashboard to view patient and other information like observations and encounters.
The frontend UI is built as a Vue.js app. The backend is powered by IRIS REST api and there is an underlying FHIR server running to store all data. The application uses embedded-python to connect to FHIR api via fhirpy
module.
Folder Structure
iris-fhir-transcribe-summarize-export/
โโโsrc
โ โโโ fhir/
โ โ โโโ ...
โ โโโ python/ //backend
โ โ โโโ ...
โ โโโ vue/ //frontend
โ โ โโโ src/
โ โ โโโ .env //environment file to add the openai_api_key and google_client_id
โ โ โโโ ...
โโโ Other/
โ โโโ IRIS-FHIR-... //postman collection
โโโ Scripts/
โ โโโ iris.script
โ โโโ rebuild.sh
โ โโโ synthea-loader.sh
โโโ Scripts/
โโโ docker-compose.yml
โโโ Dockerfile
โโโ README.md
โโโ https://github.com/ikram-shah/iris-fhir-transcribe-summarize-export/blob/master/LICENSE
Build and run
- Refer here to create an OpenAI API key. This is used in the transcription and summarizing the voice notes features. Set the key in .env for frontend.
- Follow steps in following section to configure OAuth Client ID for Google docs/sheets export. Set it in .env.
- Run below script to start frontend and backend apps. UI hot reloads, so no need to rebuild for every change. But backend needs a rebuild every time.
./scripts/rebuild.sh
Useful Links
- UI - http://localhost:8080
- Backend - http://localhost:52773/fhir/api/patient/all
- FHIR server - http://localhost:52773/fhir/r4/Patient
Configure Google OAuth Client ID
โThe below steps take only a few minutes to get a new Client ID for testing. But, feel free to raise an issue to add specific mail IDs to our existing client ID to test quickly.โ
- Follow steps here to create a OAuth consent screen and client ID for a test project.
- Add scope required for docs and sheets export -
https://www.googleapis.com/auth/documents, https://www.googleapis.com/auth/spreadsheets
- Configure authorized javascript origin and authorized redirect URI as
http://localhost:8080
or whichever port you run the frontend vue app on.
- Add some test user email IDs to allow testing. Only these users can authorize via the OAuth flow. If you need to open it up for more users, then a mandatory review process is required. More details here.
- Set the obtained client ID in .env
Test FHIR REST API
Find the full list of APIs in Postman Collection.
Basic Auth credentials, username - SuperUser
, password - SYS
.
Test IRIS commands
Uncomment print(rows)
in irisfhirclient to view results
- Exec into container
docker-compose exec iris iris session iris
- IRIS commands
do ##class(fhir.dc.FhirClient).GetResource("Patient")
do ##class(fhir.dc.FhirClient).GetPatientResources("Observation","1")
Run Unit Tests
- Exec into container
docker-compose exec iris iris session iris
- IRIS commands
zn "FHIRSERVER"
Set ^UnitTestRoot = "/irisdev/app/src"
Do ##class(%UnitTest.Manager).RunTest("fhir","/loadudl")
License
This project is licensed under the MIT License.
You can find the full text of the license in the https://github.com/ikram-shah/iris-fhir-transcribe-summarize-export/blob/master/LICENSE file.