INTERSYSTEMS FHIR SQL BUILDER functionality added
irisChatGPT application leverages the functionality of one of the hottest python framework LangChain built around Large Language Models (LLMs).
LangChain is a framework that enables quick and easy development of applications that make use of Large Language Models.
Application is built by using objectscript with the help of intersystems Embedded Python functionality. It also contains Streamlit web application which is an open-source Python app framework to create beautiful web apps for data science and machine learning.
To start coding with this repo, you do the following:
git clone https://github.com/mwaseem75/irisChatGPT.git
docker-compose build
docker-compose up -d
zpm "install irisChatGPT.ZPM"
Application requires OpenAI API Key, sign up for OpenAI API on this page. Once you signed up and logged in, click on Personal, and select View API keys in drop-down menu. Create and copy the API Key
docker-compose exec iris iris session iris
set chat = ##class(dc.irisChatGPT).%New()
do chat.SetAPIKey("Enter your Open API Key here")
write chat.irisDocs("Give me details of %$PIECE function with syntax")
write chat.irisContest("Give me Prizes and nominations")
Repository will load FHIR Resources, All you need is to configure FHIR SQL BUILDER.
For configuration, Navigate to http://localhost:55037/csp/fhirsql/index.html
For more details about configuration, please watch this Tutorial Video and check
iris-fhirsqlbuilder application by @Guillaume Rongier
Please note that I am using FHIR as package name
To view the specification, Navigate to http://localhost:55037/csp/fhirsql/index.html/spec#/1
After the configuration, we can do ChatGPT with FHIR SQL
write chat.irisFHIRSQL("Give me total patients")
write chat.irisFHIRSQL("List down all the Male Patients")
write chat.irisFHIRSQL("Give me patients where birthdate < 2000")
write chat.irisFHIRSQL("Give me observation details of patient 175")
write chat.irisFHIRSQL("Give me total encounter of 175")
write chat.irisFHIRSQL("Give me goal of Patient 175")
write chat.irisFHIRSQL("Give me details of Organization 80")
We need to first set FHIR Endpoint by using SetFHIRUrl method.
Currently, I am setting the FHIR server End point running in docker
do chat.SetFHIRUrl("http://localhost:52773/csp/healthshare/fhirserver/fhir/r4/")
Once URL is set, Now we can ask questions about Patient and Observation resources
write chat.irisFHIR("Give me total patients")
write chat.irisFHIR("List down all the Male Patients")
write chat.irisFHIR("Give me observation details of patient 175")
write chat.irisFHIR("Give me procedure of patients id 1")
write chat.irisFHIR("Give me Immunizations of patients id 175")
write chat.irisFHIR("Give me all the encounters of year 2012")
write chat.irisFHIR("Give me condition of patient id 175")
write chat.irisFHIR("Give me all female practioners")
write chat.irisDB("Give me total tables")
Copy your document to ManagerDirectory()+‘pdfdata/’ folder and then use the below command to ingest the data.
(The repository already contains Defining and Using Classes PDF which we will upload by using the below command)
set doc = ##class(dc.irisChatGPT).ingest("GOBJ.pdf")
w chat.personalGPT("Give me details of objects and properties")
w chat.openAI("Give me details of Intersystems")
w chat.wikiPedia("LangChain")
w chat.duckDuckGo("What is the Capital of USA")
w chat.pythonREPL("Write a function to check if 11 a prime number and test it")
Navigate to Streamlit Web Application or CSP Web application