HAPI FHIR in Azure (PaaS)
Fast Healthcare Interoperability Resources (FHIR) is a draft standard describing data formats and elements (known as "resources") and an application programming interface (API) for exchanging electronic health records. In a previous blog post, I discussed running FHIR Servers in Azure PaaS Services. In this blog post I will be expanding on the list of FHIR Servers you can run in Azure PaaS. Specifically, I will be sharing templates and instructions for running the HAPI FHIR JPA Example Server in an Azure Web App with Azure SQL backend.
In my fhir-azure GitHub repo, I have added a template for configuring the resources for HAPI-FHIR. It will deploy an Azure Web App, Azure SQL Server, and configure JAVA and connection string settings. This will be your environment ready for deploying HAPI-FHIR.
Next you need a
*.war file for deployment. I have forked the HAPI-FHIR code repository and made the required changed to use Azure SQL server. The changes are pretty modest. In order to build the project, you need JAVA and Maven installed. Please consult the README file for details. You can build the required
*.war file with:
git clone https://github.com/hansenms/hapi-fhir.git
git checkout azuresql
Then copy the
hapi-fhir-jpaserver-example.war (from the
target folder) to the
D:\home\site\wwwroot\webapps folder on your web app. You can use the Kudu console for this (drag and drop).
After copying the war file, it will be expanded and that will take a while. The initial database will also be created and so on, so it may take some time (several minutes) before. Once deployed, open it up and you should see something like the screenshot below:
If you would like to load some data into the HAPI FHIR server, I recommend using the Synthea project. To download and build that tool (you need Java 1.8 or above):
git clone https://github.com/synthetichealth/synthea.git
.\gradlew build check test
Then to generate a population of say 10 patients:
.\run_synthea -p 10
The 10 patient dataset will be in
output\fhir. It's a bit of a technical detail, but Synthea produces FHIR bundles of type
collection and typically you need a type
transaction to upload to the server. You could create a script to make the required changes yourself, but I use the "tag-uploader" from the SMART on FHIR project. You can find the source code for the tag-uploader on GitHub. It is written in NodeJS (sorry about the language mixture in this post). To install and use it, first:
git clone https://github.com/smart-on-fhir/tag-uploader.git
Then use the uploader:
node . -d PATH-TO-SYNTHEA\output\fhir\ -S https://HAPI-WEBSITE-NAME.azurewebsites.us/hapi-fhir-jpaserver-example/baseDstu3
And that's it. You now have a HAPI FHIR example server with some synthetic datasets. Let me know if you have questions/comments/suggestions.