Skip to content

intersystems-community/FHIR-AI-Hackathon-Kit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Using IRIS with Python for FHIR and AI applications

This repository contains tutorials for how to use InterSystems IRIS with an external Python Application to combine FHIR data with generative AI methods.

Contents

This repo has 4 main sections:

Requirements

  • Python - The tutorial is Python based, so will need Python installed on your computer

  • Docker - The IRIS-health instance and FHIR server in all examples are run in a docker container, for this you will need to install Docker

  • Ollama - The last step of the main tutorial is to query a local Large Language model, which I have done through Ollama. If you are interested in using a local chatbot, you're best to install Ollama which can be done from their website.

  • Python Packages - Various other python packages are used throughout, these are listed in the requirements.txt file and can be installed easily: pip install -r requirements.txt. I've stated whenever a new pacakage is used throughout the demos, so if you'd rather only install the packages you need you can skip this and install the remaining packages when you need them.

FHIR + AI Chatbot Demo

Introduction

The main tutorial demonstrates how FHIR data can be combined with IRIS vector search capabilities to build a powerful tool for medical professionals wanting to quickly understand the medical history of a patient.

We are going to take the data from 'DocumentReference' resources, these consist of clinical notes attached in plain text. This plain text is encoded within the resource and will need to be decoded.

This tutorial is based on a demo created by Simon Sha for the 2025 InterSystems Demo Games. His demonstration is shown here:

IMAGE ALT TEXT HERE

Tutorial

This is a start-to-finish tutorial which goes through:

  1. Create instance of IRIS-health and FHIR server
  2. Load Data into FHIR Server
  1. Use the IRIS FHIR-SQL builder to create a SQL table from the FHIR data
  2. Query this SQL table from Python
  1. Fetch data using SQL queries.
  2. Decode Clinical Notes to plain text
  3. Use a text-embedding model to encode the Clinical Notes to Vectors
  4. Create a new table in IRIS with these Vectors
  1. Convert a user query into Vectors
  2. Perform a rapid Vector search to find related notes
  1. Create a prompt that includes system instructions, relevant notes, and a user query
  2. Pass prompt to a Large Language Model
  3. Return output to user

About

A kit for using IRIS with Python to create FHIR applications with AI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •