REST_API_with_FHIR_data_scheme


Follow
0
Star
0
Details
Releases
Issues
This application is not supported by InterSystems Corporation. Use it at your own risk.
An example of how to customize API routes within the FHIR data schema.

iris-fhirserver-template

In this application, you find a simple REST API for vaccine control.

You can customize the application for execute other routes, inside the FHIR data scheme.

You also find a simple ANGULAR application, which can be useful for you to learn how to access this END POINT

Prerequisites

Make sure you have git and Docker desktop installed.

Installation

Clone/git pull the repo into any local directory

$ git clone https://github.com/Davi-Massaru/demo-fhir-iris

Open the terminal in this directory and run:

$ docker-compose up -d

Compile the RestHandler.cls in the path "demo-fhir-iris\src\HS\FHIRServer"

Patient data

The template goes with 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:

#./synthea-loader.sh 10

this will create 18 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:

FHIRSERVER>d ##class(fhirtemplate.Setup).LoadPatientData("/irisdev/app/data/fhir","FHIRSERVER","/fhir/r4")

with using the following project

Testing FHIR R4 API

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

Testing Postman calls

Get fhir resources metadata GET call for http://localhost:32783/fhir/r4/metadata Screenshot 2020-08-07 at 17 42 04

Open Postman and make a GET call for the preloaded Patient: http://localhost:32783/fhir/r4/Patient/1 Screenshot 2020-08-07 at 17 42 26

The file structure

In \demo-fhir-iris\src\Vaccine you have the vaccine example structure of the API.

In \demo-fhir-iris\fhirUI\Vaccines You have an example of ANGULAR application for consumption, to test make sure you have npm installed and run the commands:

npm install
ng serve --open

Development Resources

InterSystems IRIS FHIR Documentation FHIR API Developer Community FHIR section

How to start development

This repository is ready to code in VSCode with ObjectScript plugin. Install VSCode, Docker and ObjectScript plugin and open the folder in VSCode. Open /src/cls/PackageSample/ObjectScript.cls class and try to make changes - it will be compiled in running IRIS docker container. docker_compose

Feel free to delete PackageSample folder and place your ObjectScript classes in a form /src/Package/Classname.cls Read more about folder setup for InterSystems ObjectScript

The script in Installer.cls will import everything you place under /src into IRIS.

What's inside the repository

Dockerfile

The simplest dockerfile which starts IRIS and imports Installer.cls and then runs the Installer.setup method, which creates IRISAPP Namespace and imports ObjectScript code from /src folder into it. Use the related docker-compose.yml to easily setup additional parametes like port number and where you map keys and host folders. Use .env/ file to adjust the dockerfile being used in docker-compose.

.vscode/settings.json

Settings file to let you immedietly code in VSCode with VSCode ObjectScript plugin)

.vscode/launch.json

Config file if you want to debug with VSCode ObjectScript

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

ZPM installation
zpm "install objectscript-sample"
Category
Technology Example
Works with
InterSystems IRIS for Health
Tags
Info
Author
Version
1.0.0
Last updated
2020-08-23
Repository
Open
Documentation
Open
License
Link