Article
· May 30, 2022 3m read

FHIR Client to connect any open FHIR Server by using embedded python

Hi Community,

This post is a introduction of my open exchange iris-fhir-client application.

 iris-fhir-client can connect to any open FHIR Server by using embedded python with the help of fhirpy Library.
Get Resource information by terminal and by using CSP web application.

View and Activate Registered Servers 

Connect to IRIS Terminal

docker-compose exec iris iris session iris

Application will register InterSystems FHIR Server and SmartHealthIT Open FHIR Server by default and both are ready to use. 
Use below command to list down registered Severs 

do ##class(dc.FhirClient).ServerList()

image

InterSystems FHIR Server is active. In order to select SmartHealthIT Open FHIR Server use SetFhirServer function of dc.FhirClient class by passing server ID  

do ##class(dc.FhirClient).SetFhirServer(2)

 

Registered FHIR Servers

To Register New Server use RegisterServer() function of dc.FhirClient class
class(dc.FhirClient).RegsterServer("Server Name","Endpoint","ApiKey"[optional],"EndpointOAuth"[optional]

do ##class(dc.FhirClient).RegisterServer("INTERSYSTEMS FHIR Server","http://localhost:52773/csp/healthshare/samples/fhir/r4/","","")

image

Get Resources from the FHIR Servers

To Retrieve all the resources for the current server use ListResources() method of dc.FhirClient class

do ##class(dc.FhirClient).ListResources()

In order to display number of records 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)

To get details of the resource use GetResource() by passing Resource of dc.FhirClient class
Below command will retrieve all the Patients from the active FHIR Server

do ##class(dc.FhirClient).GetResource("Patient")

image

Below command will retrieve all the Observations from the active FHIR Server

do ##class(dc.FhirClient).GetResource("Observation")

image

 

Get Resources for particular patient from the FHIR Servers

Below command will retrieve Observations detail against Patinet ID 1 from the active FHIR Server

do ##class(dc.FhirClient).GetPatientResources("Observation","1")

image

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
170881284-b18aebca-e6a2-4a6e-ad20-a537c13ff51c

 

Index page will display FHIR Server List with active server selected. Select other server from the list to view details of selected server
image

Hover to Patient ID and select to get details of Patient Resources
image

This page will display count of some of Patient Resources along with Patient Observations details
170881340-a9cd0c77-bf24-4e8e-85f7-84e04b527b49

If you found this app useful, consider voting for my app.


Thanks

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