How to enable patient data access API

This guide explains how safe API for Patients and their resources can be enabled


Docker and Docker Compose

You should have Docker and Docker Compose installed before go further. To get it installed follow the instructions.

Aidbox license

To get the Aidbox License:

  1. Go the Aidbox user portal

  2. Login to the portal

  3. Create new self-hosted Aidbox License or use the license that you already have

Create Aidbox project

Aidbox is configured by the Aidbox Configuration Projects. To create sample project run command below

git clone \
  --branch=main \
  --depth=1 \ \
  aidbox-project && \
  cd aidbox-project && \
  rm -rf .git

See more details related the running Aidbox locally

Apply the license

Populate the .env file with the Aidbox License.


Enable Patients data access API

To enable safe Patients API add necessary imports to the zrc/main.edn file.

Add aidbox.patient-api.v1 to the import section.

{ns main
 import #{aidbox
          aidbox.patient-api.v1 ;; import safe API
 {:zen/tags #{aidbox/system}
  :config   config/base-config
  :services {:admin-user-seed config/admin-user-seed
             :root-client-seed config/root-client-seed}}}

Start Aidbox with Docker Compose

To start Aidbox run the command in the aidbox-project directory.

docker compose up --force-recreate

When Aidbox starts, navigate to the http://localhost:8888 and sign in to the Aidbox UI using the credentials admin / password.

Ensure Patient data access API works

Create sample resources

Use Aidbox UI Rest Console to create nested Organization resources.

status: 200 Ok
content-type: text/yaml

- id: pt-1
  resourceType: Patient
- id: pt-2
  resourceType: Patient
- id: obs-1
  resourceType: Observation
  status: registered
    - system:
      code: 15074-8
      display: Glucose [Moles/volume] in Blood
    resourceType: Patient
    id: pt-1

You should have 2 Patients and 1 Observation resources.

└── Observation/obs-1


Check safe Patient access API works

Patient/pt-1 sees its data

status: 200
GET /patient/fhir/Observation/obs-1
content-type: text/yaml
X-Patient-Id: pt-1

Patient/pt-2 cannot see other Patient's data

status: 404 Not found
GET /patient/fhir/Observation/obs-1
content-type: text/yaml
X-Patient-Id: pt-2

Last updated