Skip to content

Commit

Permalink
add ips-subscriptions-no-zen
Browse files Browse the repository at this point in the history
  • Loading branch information
spicyfalafel committed Jan 22, 2025
1 parent 7f93a75 commit ae8e824
Show file tree
Hide file tree
Showing 19 changed files with 6,942 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ips-subscriptions-no-zen/.dockerfileignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.env
36 changes: 36 additions & 0 deletions ips-subscriptions-no-zen/.env.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
AIDBOX_LICENSE=

BOX_INIT_BUNDLE=file:///tmp/init-bundle.json

AIDBOX_DEV_MODE=true
AIDBOX_FHIR_SCHEMA_VALIDATION=true
AIDBOX_FHIR_PACKAGES=hl7.fhir.r4b.core#4.3.0:ca.infoway.io.psca#1.1.0
AIDBOX_TERMINOLOGY_SERVICE_BASE_URL="https://tx.health-samurai.io/fhir"
AIDBOX_COMPLIANCE=enabled
AIDBOX_CORRECT_AIDBOX_FORMAT=true

PGPORT=5432
PGHOST=aidbox-db
PGHOSTPORT=5438
PGUSER=postgres
PGPASSWORD=postgres
PGDATABASE=aidbox

AIDBOX_BASE_URL=http://aidbox:8888
AIDBOX_PORT=8888

AIDBOX_CLIENT_SECRET=123
AIDBOX_CLIENT_ID=root
AIDBOX_ADMIN_PASSWORD=password

APP_PORT=4000
APP_URL=http://node-app:4000
APP_SECRET=secret
APP_CALLBACK_URL=/aidbox
APP_ID=my-app

BOX_AUTH_KEYS_SECRET=auth-key-secret
BOX_AUTH_KEYS_PRIVATE="-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEApbUYGNmCz1P8G0j/FFOjx1d5GNssJ/jj6xasSwTIbjjt6FtY\nCDw8o7hayOc/u8aUqXCGhK3JD2T9gtKv9/rV30w4YzmHhA8OOuLJE7tfh/PJA4Hn\n4i2JJ30BuoZ7rPTlTRGdc1FS3XFdmBQtnplEkJ7y8qbdrVme3Kbtn+BR1BdtgwSy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1tZhirUneECgYAxNmARVQDKuYLXdM/jbEgJJD4FHXSNHqSi/I9C\nm5DgtQZkmCg/d4rdI+JW9Dlc6DGlFmHog2GskiqSfxcLFhB7gZeoAziS2fexynqT\nYlG06QZQ5fij24z/RP5hW3XSdgY7AqF5c/8p2Y7+h+PDmDXGD4esM6NoprlIcxbe\nkfOOvwKBgQCoOpkW+OWnxPLawmG/gv8+s5CsfOPUpURwAjltSXz9LXvsJmWQPQVG\np4sKEOJidYyt24YrIHi9/UEqRi+uuRQ4zCuXS6UjXftjAarPIPGkL/1S6B1Z91zg\nE5C0rXOvAlrvK09p4HGXLrwQxjrWt8R7rPvaD2yqVKLP4liFj8RMdg==\n-----END RSA PRIVATE KEY-----\n"
BOX_AUTH_KEYS_PUBLIC="-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApbUYGNmCz1P8G0j/FFOj\nx1d5GNssJ/jj6xasSwTIbjjt6FtYCDw8o7hayOc/u8aUqXCGhK3JD2T9gtKv9/rV\n30w4YzmHhA8OOuLJE7tfh/PJA4Hn4i2JJ30BuoZ7rPTlTRGdc1FS3XFdmBQtnplE\nkJ7y8qbdrVme3Kbtn+BR1BdtgwSybpNH2yqh3bb6PwpgNSMH7BIkBWL4A6QDpaFf\n1/9jSNE1vO25ssLC+bhFQNWLYriu+HogzEf9NWIrR2W29mI1QiA7wqvEuhg1yx38\nylWD8GhCGL6+2QLKBYgp7DIGv6UoTnqcVISatdQ51lVcCPmU6L1BhmcXVti6dWBI\n+wIDAQAB\n-----END PUBLIC KEY-----\n"


11 changes: 11 additions & 0 deletions ips-subscriptions-no-zen/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM node:20

WORKDIR /app
RUN corepack enable
COPY . .
RUN pnpm install --frozen-lockfile
RUN pnpm run build

EXPOSE 4000

CMD [ "node", "build/index.js" ]
16 changes: 16 additions & 0 deletions ips-subscriptions-no-zen/Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM node:20-slim

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y
RUN apt-get install -y rsync
RUN corepack enable

WORKDIR /usr/src/app-cache

COPY package.json .
RUN pnpm install

WORKDIR /usr/src/app

EXPOSE 4000
73 changes: 73 additions & 0 deletions ips-subscriptions-no-zen/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Implementation of IPS FHIR IG on Aidbox FHIR platform

This repository contains pre-configured Aidbox instance and implementation of `$summary` operation defined by IPS:

- [FHIRSchema](https://docs.aidbox.app/modules-1/profiling-and-validation/fhir-schema-validator)
- FHIR 4.3.0, ca.infoway.io.psca
- [Aidbox Topic-based subscriptions](https://docs.aidbox.app/modules/topic-based-subscriptions/wip-dynamic-subscriptiontopic-with-destinations)
- [$summary](https://build.fhir.org/ig/HL7/fhir-ips/OperationDefinition-summary.html) operation


## Prerequisites

- [Docker](https://www.docker.com/)

## STEP 1: Environment and Aidbox license

Copy `.env.tpl` file into `.env` file:

```shell
cp .env.tpl .env
```

Obtain the self-hosted license as described in the [documentation](https://docs.aidbox.app/getting-started/run-aidbox-locally-with-docker).

Add the license (`AIDBOX_LICENSE`) int the .env file.

## STEP 2: Run aidbox and node-app in Docker

```shell
docker compose up --build
```

On start, the node-app will create [App resource](https://docs.aidbox.app/app-development/aidbox-sdk/aidbox-apps), [upload](./src/index.ts#L142) a sample FHIR [Bundle](./src/patientData.ts) with patient data.

## Step 3: Open and log in into Aidbox instance

Open in browser http://localhost:8888

And log in witn username: `admin` and password: `password`

## Step 4: Request $summary using REST Console

In the Aidbox admin window, navigate to the APIs section and choose REST Console.

The [$summary](https://build.fhir.org/ig/HL7/fhir-ips/OperationDefinition-summary.html) operation requires either the logical ID (`Patient.id`) or a business identifier (`Patient.identifier`) of the patient.
To request the IPS "document" _Bundle_ for a specific patient using the REST Console, you can use the following request:

```
GET /fhir/Patient/[id]/$summary
```

e.g.
```
GET /fhir/Patient/2b90dd2b-2dab-4c75-9bb9-a355e07401e8/$summary
```

Or you can use request with `identifier` search parameter:

```
GET /fhir/Patient/$summary?identifier=<patient-identifier>
```

## Step 5: Check if Aidbox Topic-Based Subscriptions works

The SubscriptionTopic in Aidbox is set up to send QuestionnaireResponse events in the completed and amended status to https://aidbox.requestcatcher.com/. We will use Aidbox Forms to send QuestionnaireResponse.

To try it out:
1. Open https://aidbox.requestcatcher.com/ to view webhook requests.
2. Open Aidbox Forms at http://localhost:8888/ui/sdc#/.
3. Click "Share" on the form, then "Attach", copy the link.
4. Open the link and fill the form.

Read more about Aidbox Topic-Based Subscriptions: https://docs.aidbox.app/modules/topic-based-subscriptions/wip-dynamic-subscriptiontopic-with-destinations
42 changes: 42 additions & 0 deletions ips-subscriptions-no-zen/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
volumes:
ips_pgdata:
name: ips_pgdata
services:
aidbox-db:
image: healthsamurai/aidboxdb:16.1
pull_policy: always
ports:
- "${PGHOSTPORT}:5432"
volumes:
- "ips_pgdata:/data:delegated"
environment:
POSTGRES_USER: "${PGUSER}"
POSTGRES_PASSWORD: "${PGPASSWORD}"
POSTGRES_DB: "${PGDATABASE}"

aidbox:
extra_hosts:
- "host.docker.internal:host-gateway"
image: healthsamurai/aidboxone:edge
pull_policy: always
depends_on: ["aidbox-db"]
volumes:
- "./tmp:/tmp"
ports:
- "${AIDBOX_PORT}:${AIDBOX_PORT}"
env_file:
- .env

node-app:
hostname: node-app
build:
context: ./
dockerfile: Dockerfile.dev
ports:
- 4000:4000
user: node
command: sh -c "rsync -ar /usr/src/app-cache/node_modules/. /usr/src/app/node_modules && pnpm run dev"
env_file:
- .env
volumes:
- ./:/usr/src/app
6 changes: 6 additions & 0 deletions ips-subscriptions-no-zen/nodemon.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"watch": ["src/**/*.ts"],
"ext": "ts",
"legacyWatch": true,
"exec": "node --loader ts-node/esm ./src/index.ts"
}
Loading

0 comments on commit ae8e824

Please sign in to comment.