Summary
InterSystems FHIR Client to connect any open FHIR Server and get resources information either by terminal or by using CSP Web application. Application is using functionality of embedded python by using fhirpy (FHIR client for python Library)
Application Layout
Online Demo
https://irisfhirclient.demo.community.intersystems.com/csp/fhirclient/index.csp by using SuperUser | SYS
Video on YouTube
https://youtu.be/xaRoIcuDD_M
Features
- Registered any Open FHIR Servers
- List Down Server Details and Connect to any FHIR Server
- InterSystem FHIR Accelerator Service and SmartHealthIT Open FHIR Server are registered by default and ready to use
- Get Resources information by providing resource from active server
- Get Resources for particular patient from the FHIR Servers
- Search in Patient Resource
- Create Patient Resource
- Create Patient Observation Resource
- View FHIR Server information from CSP Web application
Recommendation
How to Run
To start coding with this repo, you do the following:
- Clone/git pull the repo into any local directory
git clone https://github.com/mwaseem75/iris-fhir-client.git
- Open the terminal in this directory and run:
docker-compose build
- Run the IRIS container with your project:
docker-compose up -d
Installation with ZPM
zpm "install iris-fhir-client"
Repo Contents
- Dockerfile, docker-compose.yml, and module.xml files
- iris.script, contains script to execute during container initialization
- /src with source files of classes and CSP application
- /python with python source files
- /.vscode/settings.json for automatic server connections when opened in VS Code.
Requirements:
Getting Started
Registered FHIR Servers
Connect to IRIS Terminal
docker-compose exec iris iris session iris
To list down registered server use ServerList() of dc.FhirClient class
do ##class(dc.FhirClient).ServerList()
To Register New Server use RegisterServer() function of dc.FhirClient class
class(dc.FhirClient).RegsterServer("Server Name","Endpoint","ApiKey"[optional],"EndpointOAuth"[optional]
To Register New Server use RegisterServer class method
do ##class(dc.FhirClient).RegisterServer("INTERSYSTEMS FHIR Server","http://localhost:52773/csp/healthshare/samples/fhir/r4/"," "," ")
To Activate server, call below method by passing server ID
do ##class(dc.FhirClient).SetFhirServer(2)
Get Resources from the FHIR Servers
To Retrieve all the resouces for the current server use ListResources() method of dc.FhirClient class
do ##class(dc.FhirClient).ListResources()
In order to display number of recordes of any resources use CountResource() method by passing Resource of dc.FhirClient
Below command will get counter of Patient Resource against active FHIR Server
set count = ##class(dc.FhirClient).CountResource("Patient")
write count
To Retrieve all the created Resources along with their count just pass 1 to ListResource() function
do ##class(dc.FhirClient).ListResources(1)
Get Resources information by providing resource from active server
To get details of the resource use GetResource() by passing Resource of dc.FhirClient class
Currently list of following resources is available
- Patient
- Observation
- Procedure
- Immunization
- Encounter
- Organization
- Condition
- Practitioner
Below command will retrieve all the Patients from the active FHIR Server
do ##class(dc.FhirClient).GetResource("Patient")
Below command will retrieve all the Observations from the active FHIR Server
do ##class(dc.FhirClient).GetResource("Observation")
Get Resources for particular patient from the FHIR Servers
Currently list of following resources against the patient is available
Below command will retrieve detail of Encounters against Patinet ID 1 from the active FHIR Server
do ##class(dc.FhirClient).GetPatientResources("Encounter","1")
Search in Patient Resource
Patient Resource search parameter detaisl can be found here
Below command will search agaisnt Patient Id 2395
do ##class(dc.FhirClient).GetResource("Patient","_id","2395")
Below command will search Patient given Name and family Name contaning "Don"
do ##class(dc.FhirClient).GetResource("Patient","name","Don")
Below command will search all the male patients
do ##class(dc.FhirClient).GetResource("Patient","gender","male")
Create Patient Resource
below CreatePatient() function of dc.FhirClient can be use to Create Patient Resource
ClassMethod CreatePatient(givenName As %String, familyName As %String, birthDate As %String,gender As %String)
function requires giveName,failyName,birthDate and gender to create Patient Resource
below command will create Patient
do ##class(dc.FhirClient).CreatePatient("PatientGN","PatientFN","2000-06-01","male")
Let's search the newly created resource by it's name
do ##class(dc.FhirClient).CreatePatient("PatientGN","PatientFN","2000-06-01","male)
Patient ID 8111 is created
Create Patient Observation Resource
Let us create Observation against our newly created Patient Resource
below CreateObservatoin() function of dc.FhirClient can be use to Create Patient Observatoins
ClassMethod CreateObservation(patientId As %String, loincCode As %String, ObrCategory As %String, ObrValue As %Integer, ObrUOM As %String, effectiveDate As %String)
Parametres
- patientId is the Id of Patient
- LioncCode is Lionc Code, Detail can be found here
- ObrCategory is Observation Category, Detail can be found here
- ObrValue is Observatoin Value
- ObrUOM is Observation Unit
- EffectiveDate
below command will create Patient Vital Sign Observation
do ##class(dc.FhirClient).CreateObservation("8111","8310-5","vital-signs",96.8,"degF","2022-01-22")
Let's List down patient observations
do ##class(dc.FhirClient).GetPatientResources("Observation","8111")
Observation ID 8114 is created
View FHIR Server information from CSP Web application
Navigate to http://localhost:55037/csp/fhirclient/index.csp
Index Page will show active server Patients,Observations,Practitioners and Encounters count along with Patient and Registered Servers details
Index page will display FHIR Server List with active server selected. Select other server from the list to view details of selected server
Hover to Patient ID and select to get details of Patient Resources
This page will display count of some of Patient Resources along with Patient Observations details
Other information
Template used in web application is from Bootstrap 4 Admin Dashboard and it is free to use to develop non-commercial applications.
Thanks