Initial Release
This repository demonstrates a Proof of Concept (PoC) application leveraging InterSystems IRIS For Health to perform semantic search on FHIR data. It combines the capabilities of the FHIR SQL Builder for relational data projection and Vector Search for meaning-based retrieval.
This project supports semantic search on FHIR data using InterSystems IRIS. By combining the FHIR SQL Builder with Vector Search, it allows users to query clinical records in natural language, bridging the gap between complex FHIR structures and human-readable search.
In this project, we work with FHIR Questionnaire and QuestionnaireResponse data from 100 patients, containing names, family history, allergies, and other information. While this data is standardized, its nested structure makes it challenging to query directly. By flattening the data into relational tables and generating semantic embeddings, we implement intuitive, meaning-based search—allowing users to find relevant patient information without needing to understand FHIR’s complexity.
Before running this project, make sure you have the following:
OpenAI API Key
In the App folder,edit the existing .env file and replace the placeholder with your own key:
OPENAI_API_KEY= your_api_key_here
Docker
Used to run InterSystems IRIS and supporting services in a containerized environment.
Install Docker from: https://www.docker.com/get-started
Clone the repository
git clone https://github.com/fanji-isc/IRIS-FHIR-sqlbuilder-vectorsearch.git
cd IRIS-FHIR-sqlbuilder-vectorsearch
Build and Start IRIS For Health
docker-compose up -d --build iris4health
Configure FHIR SQL Builder
http://localhost:8080/csp/sys/UtilHome.csp
In IRIS Portal, navigate to Health–> Click on the DEMO Namespace–> FHIR Server Management–>FHIR SQL Builder(left side menu)
,
fill out each section with below information.
Analysis
, then under FHIR Repository,click
,
In the New FHIR Analysis
Click “Launch Analysis Task”
This will return you to the InterSystems FHIR SQL Builder page
Transformation Specifications
transform1.json file located in the fhirdata/ folder of this repository.
,Projections
, fill out the form with below information
Accessing FHIR Data via SQL
Open a new tab with the IRIS Management Portal: http://localhost:8080/csp/sys/UtilHome.csp
Click System Explorer ->> SQL
In the Management Portal SQL interface, select DEMO as Namespace. Under Tables, you will see the SQL table generated from your QuestionnaireResponse data, ready for querying and analysis.
SELECT * FROM sql1.QuestionnaireResponse

Application Setup & Vectorization
Now that the data is projected to SQL, start the Python application to generate embeddings and perform searches.
After running
docker-compose up -d --build flask
you should be able to access your application’s user interface at:
http://localhost:8000
(this build takes several minutes to complete)
Usage & Demo

In the Chat Tab, when a user asks, “Which patients have a family history of heart disease and take cholesterol-lowering medication?”, the system semantically links related data—connecting cardiac conditions with drugs like propranolol, spironolactone, or atorvastatin—and returns a concise summary of at-risk patients.
This shows the benefit of semantic search: users don’t need to know exact database fields, FHIR structure, or medication names. The system interprets clinical meaning, retrieves the most relevant information, and summarizes it in a human-readable form.
Users can explore additional prompts such as:
“I will see Luna Walker today. Please summarize this patient’s medical history.”
“Which patients may require follow-up based on their questionnaire responses?”
