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

  1. Install and run a FHIR server in a Docker container.
  2. Use Postman to query the FHIR server for resources.
  3. Understand the basics of container management and RESTful API requests.

Task 1: Pull and Run a FHIR Server in Docker

  1. The HAPI FHIR server is a popular open-source implementation of FHIR and is widely used in the community.
  2. Please follow our official Downloading and Running a Product Stack: HAPI FHIR tutorial
  3. 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

  1. To create a new patient resource, switch the method to POST and enter the same URL.
  2. Under the Body tab, select raw and choose JSON as the format.
  3. 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

  1. Launch Postman:
  2. Create a FHIR GET Request:
  3. Set up a GET request to query the Patient resource.
  4. Enter the following URL in the request field: http://localhost:8080/fhir/Patient
  5. Click the Send button.
    • You should receive a response with the list of Patient resources in JSON format.

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

Additional Resources: