Article
· 4 hr ago 4m read

Presenting the FHIR Data Explorer: AI-Powered Hybrid Semantic Search & Patient History Generation

Hello Developers! 👋

I’m excited to share the project I’ve submitted to the current InterSystems .Net, Java, Python, and JavaScript Contest — it’s called FHIR Data Explorer with Hybrid Search and AI Summaries, and you can find it on the InterSystems Open Exchange and on my GitHub page.

This project showcases how InterSystems IRIS can be integrated with Python through the Python Native SDK, combining healthcare data analysis, vector search, and local LLMs for generating intelligent, structured, private insights of clinical data extracted from FHIR messages, demonstrating how to:

  • Build and analyze a FHIR repository inside IRIS
  • Perform semantic and hybrid patient search
  • Use AI-powered text generation to create patient history summaries
  • Visualize and explore everything through an interactive Streamlit dashboard

Overview

The project highlights how InterSystems IRIS can serve as the data backbone for AI-powered healthcare analytics — combining:

  • InterSystems IRIS for robust data storage and SQL/vector operations
  • Python SDK (IRIS Native) for direct integration. In particular, the project is built over IRIStool module which I've developed (and candidated to the contest as well!)
  • Sentence Transformers for semantic embedding and hybrid search
  • Streamlit for visualization and user interaction
  • Ollama + local LLMs for generating synthetic patient summaries — ensuring data never leaves your local environment

The result is an end-to-end workflow for FHIR-based patient data exploration.


Usage Walkthrough

  1. Import FHIR examples and extract structured data First step is connecting to the InterSystems IRIS containerized instance using IRIStool module. Next step is creating the FHIR table and importing synthetic FHIR bundles while generating embeddings. This step is the only performed by code, the following steps will be performed directly on the Streamlit UI.
  2. Search Patients
    Use natural language queries and optional filters (gender, age, deceased status) to locate a patient.
  3. Select a Patient
    Click on a search result to view detailed clinical data.
  4. Explore Records
    Browse through multiple tabs representing FHIR categories.
  5. Generate History
    Use the prompt to generate a patient summary of all clinical data with your preferred local LLM

Key Features

🔹 FHIR Repository Creation & Analysis

The provided code automatically generate and analyze a synthetic FHIR repository, importing hundreds of structured FHIR bundles representing real-world clinical data (conditions, procedures, immunizations, etc.) and extracting structured data from FHIR messages. Data from each FHIR resource are stored into a different table and associated to a patient id.

🔹 Semantic & Hybrid Patient Search

Perform natural language searches like

"patients with diabetes and cardiovascular issues"
and retrieve the most relevant patients using vector embeddings and HNSW indexes for fast approximate nearest neighbor search.

Search results can be refined by:

  • Gender
  • Deceased status
  • Age range

The pritamdeka/S-PubMedBert-MS-MARCO transformer model is used to convert user input into a 768 dimensional vector. This model has been optimized for the information retrieval task in the medical/health text domain.

The following image provide and example of natural language search:

Input vector is compared with the vectorized form of the patient description column, which summarizes all the main patient clinical information. This field is generated and converted into a vector form during the data acquisition process.

🔹 Comprehensive Patient Profiles

Once a patient is selected, you can explore all medical records categorized as:

  • 🤧 Allergies & Intolerances
  • 💉 Immunizations
  • 📊 Observations & Lab Results
  • 🩺 Medical Conditions
  • ⚕️ Procedures
  • 📋 Care Plans

All structured data extracted from FHIR records is now easily accessible through a simple and comprehensive interface!

🔹 AI-Powered History Generation

Generate comprehensive patient summaries using local LLMs such as:

  • llama3.2:1b
  • gemma2:2b
  • gemma3:1b

This allows clinicians or analysts to get an AI-generated overview directly from the structured FHIR records — with full data control and no external API dependencies.


    Example Output

    You can find examples of generated patient histories in the /output_examples folder of the repository. The examples refers to the same patient, analyzed using three different local LLMs.

    Each model yields a unique writing style and clinical focus.


    Conclusions and remarks

    This project demonstrates how InterSystems IRIS can power AI-driven analytics pipelines to manage healthcare data information, while remaining:

    • Secure — all data processing stays local
    • Flexible — integrates seamlessly with Python and AI tools
    • Efficient — vector search and LLM inference optimized for local environments

    🔗 Try It Out

    👉 GitHub Repository: FHIR Data Explorer with Hybrid Search and AI Summaries
    👉 Vote for it in the InterSystems Developer Community Contest!

    Discussion (0)1
    Log in or sign up to continue