Home Applications ai-query

ai-query

This application is not supported by InterSystems Corporation. Please be notified that you use it at your own risk.
5
2 reviews
2
Awards
315
Views
0
IPM installs
1
2
Details
Releases
Reviews  (2)
Awards  (2)
Issues
Videos  (1)
Our AI-driven eligibility query tool streamlines patient identification by leveraging FHIR data, making it easier to find patients with care gaps and suitable cohorts for clinical trials. It integrates with IRIS, handling requests across diverse data sources, asking clarifying questions, and executing tasks asynchronously

What's new in this version

Initial Release

Gitter

AI Query

Overview

Revolutionize patient care with our groundbreaking app, AIQuery, which turns complex data queries into simple, natural language requests, leveraging the power of AI. In the fast-paced world of healthcare, identifying patients with gaps in care is crucial for enhancing care quality, patient satisfaction, and achieving superior outcomes. Yet, many organizations struggle with outdated systems, relying on inefficient manual processes that are costly and error-prone.
Clinovera addresses these challenges head-on by enabling healthcare professionals to effortlessly identify patients in need of attention and suitable candidates for clinical trials.

Our AI-based eligibility query tool dramatically simplifies finding patients with gaps in care and identifying cohorts of patients for clinical trials and studies. We loaded FHIR resources for test patients into IRIS and exposed them to the AI query tool using IRIS FHIR SQL builder. The AI tool recognizes requests against heterogeneous data sources, asks clarifying questions and executes asynchronous tasks.

Usage

Utilizing AIQuery is straightforward and designed with the user in mind. Begin by simply typing or speaking your query into the app, using natural language as if you were asking a colleague.

Here’s how our solution stands out:

  • Simplify complexity: Forget navigating complex databases. Say what you need in plain language, like “Find me all Hispanic patients with diabetes born after January 1, 1960, with elevated blood pressure, who are obese and on statins.”
  • Incremental queries: Start with a broad request and refine it as you go, such as adding “I only want female patients” to your initial query, making data exploration intuitive and dynamic.
  • Smart classification: Our AI doesn’t just take your words at face value. It understands medical terminology, turning a query for “statin” into a search across all relevant medications.
  • Interactive clarification: When queries are ambiguous, AIQuery seeks clarity. If you mention “ibuprofen,” the app confirms whether you’re referring to the drug specifically or its broader class.
  • Effortless asynchronicity: Request your data and move on with your day. AIQuery works in the background, delivering results when you’re ready, even if it’s “by tomorrow morning.”

Components

Container 1: InterSystems FHIR Database

Functionality: This container runs an InterSystems FHIR database. The database schema is meticulously crafted using the FHIR SQL Builder, ensuring an optimized structure for storing and retrieving patient information efficiently and securely.

Container 2: .NET Application

Front-End Interface: The .NET application features a user-friendly front-end interface. Users can input their data queries into a text box, making the process of data retrieval straightforward and accessible.
Integration with OpenAI: Utilizing the OpenAI API, the application translates natural language queries into precise SQL commands. This innovative approach allows users without SQL knowledge to interact with the database effortlessly.
Data Retrieval: The generated SQL queries interact with the InterSystems FHIR database to fetch requested patient data, demonstrating a seamless integration between the front-end interface and the database.

Prerequisites

Make sure you have git and Docker desktop installed.

Installation

Docker (e.g. for dev purposes)

Clone/git pull the repo into any local directory

$ git clone https://github.com/flnaves-firstline/ai-query.git

The application requires an OpenAI API key to work. Insert the key to the src/app/PatientQuery.Back/appsettings.json config file in the OpenAi.ApiKey field

  ...
  "OpenAi": {
    "Url": "https://api.openai.com",
    "ApiKey": "your-openai-api-key-here",
  ...

Open the terminal in this directory and run:

$ docker-compose up -d

After successful launch, you can open the application in the browser http://localhost:5000

NOTE: It may take a couple of minutes before opening the application until the databases in the containers are initialized

Patient data

The template goes with 19 preloaded patents in /data/fhir folder which are being loaded during docker build
You can generate more patients doing the following. Open shel terminal in repository folder and call:

docker run --rm -v $PWD/output:/output --name synthea-docker intersystemsdc/irisdemo-base-synthea:version-1.3.4 -p 10

this will create 10 more patients in data/fhir folder.
Then open IRIS terminal in FHIRSERVER namespace with the following command:

docker-compose exec iris iris session iris -U FHIRServer

and call the loader method:

do ##class(HS.FHIRServer.Tools.DataLoader).SubmitResourceFiles("/home/irisowner/irisdev/app/output/fhir/", "FHIRSERVER", "/fhir/r4")

with using the following project

Testing FHIR R4 API

Open URL http://localhost:52773/fhir/r4/metadata
you should see the output of fhir resources on this server

Testing Postman and FHIR SQL calls

Open Postman and make a GET call for all preloaded Patient:

http://localhost:52773/fhir/r4/Patient
Screenshot 2024-01-24 at 18 27 30

Access the FHIR SQL Builder view at http://localhost:52773/csp/fhirsql/index.html#/ to verify if all settings have been uploaded:
Screenshot 2024-01-26 at 10 38 43

Open Intersystems SQL Editor http://localhost:52773/csp/sys/exp/%25CSP.UI.Portal.SQL.Home.zen?$NAMESPACE=FHIRSERVER and perform the following query:

SELECT 
ID, BirthDate, DeceasedDateTime, Gender, IdentifierValue, Key, UsCoreEthnicityOmbCategoryValueCodingDisplay, UsCoreEthnicityTextValueString, UsCoreEthnicityUrl, UsCoreRaceOmbCategoryValueCodingDisplay, UsCoreRaceTextValueString, UsCoreRaceUrl
FROM TransformationSparta.Patient
Screenshot 2024-01-24 at 18 37 03

Troubleshooting

ERROR #5001: Error -28 Creating Directory /usr/irissys/mgr/FHIRSERVER/
If you see this error it probably means that you ran out of space in docker.
you can clean up it with the following command:

docker system prune -f

And then start rebuilding image without using cache:

docker-compose build --no-cache

and start the container with:

docker-compose up -d

This and other helpful commands you can find in dev.md

Demo

Experience AIQuery in action through these simple steps:

  • Basic query execution:
    Begin with a straightforward request. For example, you might ask for “all patients with diabetes.”
    AIQuery 1
  • Refining your search:
    Add details to narrow down your search: “Show me those who were born after 1960”
    AIQuery 2
  • Complex queries simplified:
    Use natural language for complex requests. “Find patients who take simvastatin”:
    AIQuery 3
  • Interactive Clarifications:
    When clarification is needed, AIQuery interacts with you. If you ask to find all patients who take aspirin, AIQuery will specify if it is a brand name or a drug generic / class name:
    AIQuery 4

AIQuery isn’t just an app; it’s a revolution in healthcare data management. By translating free-form human requests into precise SQL queries against the FHIR database, it opens up a world of possibilities without the need for technical expertise or understanding complex data models.
Transform the way you manage healthcare data with AIQuery. Dive into a seamless, efficient, and user-friendly experience that puts powerful data queries at your fingertips, all through the simplicity of natural language. Try AIQuery today and step into the future of healthcare analytics.

Team

  • Intersystems certified BE developer: Flavio Naves
  • Full stack developer: Denis Kiselev
  • Data analyst: Maria Ogienko
  • BA: Anastasia Samoilova
  • QA: Kseniya Hoar
Made with
Version
1.0.027 Jan, 2024
Category
Technology Example
Works with
InterSystems IRIS for Health
First published
27 Jan, 2024