-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Let's Build DevDays US 2020
This page contains instructions for the DevDays US 2020 Let's Build session. In this exercise we will take a few key features of the HAPI FHIR JPA Server for a spin.
First, check out the project here: https://github.com/hapifhir/hapi-fhir-jpaserver-starter (or if you already have, perform a git pull
to ensure you have the latest code.
You will also need a Java JDK with version 8 or 11 (others may work but we recommend one of these two as they are the focus of our testing). You can get JDK 11 here: https://adoptopenjdk.net/
Finally, you will need Apache Maven. You can get Maven here: https://maven.apache.org/download.cgi
Out of the box, HAPI FHIR JPA uses an embedded database called H2. H2 is a nice database for testing things, because it doesn't require you to install anything. We will use it for this session, but if you are building a server that you are going to put real data on you will definitely want to swap this for a production grade database such as Postgresql.
To start the JPA server, issue the following command:
mvn clean jetty:run
You will see some messages in the console while it starts. After a few moments, it should settle down and you'll see a message like this:
[INFO] Started ServerConnector@3f867060{HTTP/1.1,[http/1.1]}{0.0.0.0:8080}
[INFO] Started @17521ms
[INFO] Started Jetty Server
Let's add two patients to our server. First, we'll do a FHIR Update with Client Assigned ID to create a patient with the ID Patient/A
. This is a useful feature of FHIR that allows the client to pick the ID assigned to the resource:
- PUT the following contents to the URL: http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient/A
{
"resourceType": "Patient",
"id": "A",
"identifier": [ {
"system": "http://springfieldhospital.edu/patient",
"value": "3894746"
} ],
"name": {
"family": "Simpson",
"given": [ "Homer", "J" ]
},
"gender": "male",
"birthDate": "1956-05-12"
}
Next, let's create a Patient/B
- PUT the following contents to the URL: http://localhost:8080/hapi-fhir-jpaserver/fhir/Patient/B
{
"resourceType": "Patient",
"id": "B",
"identifier": [ {
"system": "http://springfieldhospital.edu/patient",
"value": "1234567"
} ],
"name": {
"family": "Simpson",
"given": [ "Marge" ]
},
"gender": "female",
"birthDate": "1956-10-01"
}