Patient Access API
In this tutorial you will learn how to enable Patient Access API (Smart on FHIR) in your Aidbox
Patient Access API enables Smart App to get Patient's healthcare data after Patient provided corresponding consent. Patient Access API is delivered as aidbox-project which can configured within any Aidbox instance.
In order to enable Patient Access API in your Aidbox instance you have to:
  1. 1.
    Set up Devbox.
  2. 2.
    Set up patient-access-smart-api sample project. You need to add next env variables and restart your Devbox
    1
    AIDBOX_ZEN_ENTRYPOINT=aidbox.patient-access-smart-api.sample
    2
    AIDBOX_ZEN_PATHS=url:edn:https://raw.githubusercontent.com/Aidbox/aidbox-project-samples/main/aidbox-project-samples/smart-on-fhir/aidbox/patient-access-smart-api.edn,url:edn:https://raw.githubusercontent.com/Aidbox/aidbox-project-samples/main/aidbox-project-samples/smart-on-fhir/aidbox/patient-access-smart-api/sample.edn,url:zip:https://github.com/zen-lang/fhir/releases/download/0.2.14/hl7-fhir-r4-core.zip,url:zip:https://github.com/zen-lang/fhir/releases/download/0.2.14/hl7-fhir-us-core.zip
    Copied!
    aidbox-project is a configuration of Aidbox. It uses zen-lang. You can learn our single-patient-api project and a sample entrypoint. If you are not satisfied with current smart-api distribution you can copy the config and build you own one.
  3. 3.
    Create allowing access policy for "/smart" api.
    1
    id: patient-access-smart-api
    2
    resourceType: AccessPolicy
    3
    engine: matcho
    4
    matcho:
    5
    uri: '#/smart'
    Copied!
Now you have your Smart on FHIR server.
Patient Access API expects that you have User in your system bound with Patient resources. You can do this by specifying fhirUser for a User.
1
resourceType: User
3
password: password
4
fhirUser:
5
id: <patient-id>
6
resourceType: Patient
Copied!

Inferno testing

Here you can find steps to pass inferno tests.
  1. 1.
    At first, you have to create Client for inferno
    1
    # Run this request in REST Console
    2
    3
    PUT /Client/inferno-client
    4
    5
    id: inferno-client
    6
    resourceType: Client
    7
    secret: inferno-secret
    8
    auth:
    9
    authorization_code:
    10
    redirect_uri: https://inferno.healthit.gov/inferno/oauth2/static/redirect
    11
    refresh_token: true
    12
    secret_required: true
    13
    access_token_expiration: 36000
    14
    grant_types:
    15
    - authorization_code
    16
    - basic
    Copied!
  2. 2.
    Upload synthetic data
    1
    # Run this request in REST Console
    2
    3
    POST /fhir/$load
    4
    5
    source: https://storage.googleapis.com/aidbox-public/inferno/inferno-community-fixtures.ndjson.gz
    Copied!
  3. 3.
    You should have a user bound with Patient.
  4. 4.
    You need to expose your localhost devbox to the public. You can use ngrok for instance.
    1
    ngrok http 8888
    Copied!
    You will see something like this:
    Then copy forwading https connection and update base url env. In my case it's AIDBOX_BASE_URL=https://4eb9-178-66-82-76.ngrok.io
Now you are ready to run Inferno test.
Pay attention that FHIR base url for Smart on FHIR is [hostname]/smart
After running Standalone Patient App test you should open [host]/auth/grants and revoke the provided access for Inferno client
Inferno starting page
Standalone Patient App test
Limited App test
Other Inferno tests are related to Provider Access API. So, it's out of scope of Patient Access API which we are considering in current tutorial.
Copy link