Lab 02 – Setting Up and Querying a FHIR Server
Activity
In this assignment, you will set up a FHIR server using Docker, verify its operation, and perform basic FHIR queries using Postman. This hands-on task will help you become familiar with the core concepts of FHIR and containerization.
Objectives
- Install and run a FHIR server in a Docker container.
- Use Postman to query the FHIR server for resources.
- Understand the basics of container management and RESTful API requests.
Task 1: Pull and Run a FHIR Server in Docker
- The HAPI FHIR server is a popular open-source implementation of FHIR and is widely used in the community.
- Please follow our official Downloading and Running a Product Stack: HAPI FHIR tutorial
- At this point you should have your very own FHIR server running on your local host.
Task 2: Perform Basic FHIR Queries Using Postman
Create a New Patient Resource
- To create a new patient resource, switch the method to POST and enter the same URL.
- Under the Body tab, select raw and choose JSON as the format.
- Paste the following JSON payload:
{
"resourceType": "Patient",
"id": "example",
"name": [
{
"use": "official",
"family": "Doe",
"given": [
"John"
]
}
],
"gender": "male",
"birthDate": "1980-01-01"
}
Click Send and verify Resource Creation:
- If the resource is created successfully, you will receive a
201 Created
response. - Go back to the GET request and resend it to see the new patient in the list of results.
Get a Patient Resource
- Launch Postman:
- Create a FHIR GET Request:
- Set up a GET request to query the
Patient
resource. - Enter the following URL in the request field:
http://localhost:8080/fhir/Patient
- Click the Send button.
- You should receive a response with the list of
Patient
resources in JSON format.
- You should receive a response with the list of
Task 3: Explore Additional FHIR Operations
Update the Patient Resource:
- Change the request method to PUT and use the same URL.
- Update the JSON body, changing the patient’s name:
{
"resourceType": "Patient",
"id": "example",
"name": [
{
"use": "official",
"family": "Doe",
"given": [
"Jane"
]
}
],
"gender": "female",
"birthDate": "1980-01-01"
}
- Click Send to update the patient’s information.
Delete the Patient Resource:
- To delete the patient resource, change the method to DELETE and use the same URL:
http://localhost:8080/fhir/Patient/
- Click Send. You should receive a
204 No Content
response indicating the deletion was successful.
For Submission
Update the Patient Resource to have an address and Marital Status. Then submit a screenshot of updated GET response for your patient. FHIR documentation is available here: https://hl7.org/fhir/R4/patient.html