Skip to content
Merged

Dev #93

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
bc351ce
Added in progress button
zacharyrobin Dec 5, 2023
4dd6fb5
addressed comments, bug fixes
zacharyrobin Dec 8, 2023
ed31046
improved component name
zacharyrobin Dec 8, 2023
627f431
updated background color
zacharyrobin Dec 8, 2023
75b0226
shortened main box
zacharyrobin Dec 8, 2023
f5aae61
Merge pull request #84 from mcode/507-action-buttons
zacharyrobin Dec 11, 2023
f72be30
Create guide on launching SMART on FHIR apps from Meld sandbox
jtquach1 Dec 12, 2023
348c7b7
Update steps and note about the Meld-specific long appContext error
jtquach1 Dec 12, 2023
43a14f5
Make guide more general
jtquach1 Dec 14, 2023
27afeb5
Merge pull request #85 from mcode/rems-570-launch-smart-apps
jtquach1 Dec 15, 2023
49533e9
adding pre-generated public private keys for signing and verifying js…
rdingwell Dec 18, 2023
2540f6f
Prttier fixes
rdingwell Dec 19, 2023
63acae2
fixing issue introduced in rebase
rdingwell Dec 19, 2023
9c0a704
fixing undefined var issue
rdingwell Dec 19, 2023
d71d5ec
Migrate to accordian, update styling/functionality
Dec 21, 2023
b68d25e
Clear out state before new query
Dec 21, 2023
2e7a24b
Update README.md
rdingwell Dec 22, 2023
b1920b9
Update workflow of select a patient and update call of patients
Dec 26, 2023
f508468
Delete console box, update spacing of select btn
Dec 27, 2023
da1baef
Merge pull request #86 from mcode/jwt_keys
zacharyrobin Jan 2, 2024
c080375
Prettier and fix typo in README
jtquach1 Dec 14, 2023
a980cd9
Alphabetize environment variables
jtquach1 Jan 2, 2024
f913790
Document new environment variables
jtquach1 Dec 14, 2023
b5fae55
Add new section to README.md
jtquach1 Dec 20, 2023
a155cc5
Remove auto assign since we don't use it anymore
jtquach1 Dec 27, 2023
e1a7216
Remove comment since its text is duplicated in the README
jtquach1 Dec 27, 2023
8529289
Fix 'Each child in a list should have a unique key prop' warning
jtquach1 Dec 27, 2023
94d48fa
Fix grammar
jtquach1 Dec 29, 2023
0c223e3
add standalone launch gateway (#87)
KeeyanGhoreshi Jan 3, 2024
e4e2235
Move settings box above accordian
Jan 4, 2024
80e88c9
Merge branch 'dev' into 513-in-page-select
avirgulto Jan 4, 2024
64090f2
Merge pull request #89 from mcode/rems-556-connectathon-docs
jtquach1 Jan 4, 2024
5e1f12a
Updated Console Log and comments For RxStatus
zacharyrobin Jan 8, 2024
fdac1ff
snackbar notification added
zacharyrobin Jan 8, 2024
2846e2b
Initial Page Layout
zacharyrobin Jan 8, 2024
46e178c
Merge branch 'dev' into 513-in-page-select
avirgulto Jan 8, 2024
57d9871
fixed styling
zacharyrobin Jan 9, 2024
1f05ef2
Merge pull request #90 from mcode/325-RxStatus
zacharyrobin Jan 9, 2024
8d0562d
Merge branch 'dev' into 513-in-page-select
avirgulto Jan 10, 2024
a8f3213
added launch and moved register page in direcotory
zacharyrobin Jan 10, 2024
d6a878a
corrected props and app route
zacharyrobin Jan 10, 2024
2395127
updated launch
zacharyrobin Jan 10, 2024
c4c24c2
formatting
zacharyrobin Jan 10, 2024
7afbfed
Merge branch 'dev' into 567-client-id-registration
avirgulto Jan 10, 2024
fcdeecb
Merge pull request #91 from mcode/567-client-id-registration
avirgulto Jan 10, 2024
7da78db
Merge pull request #88 from mcode/513-in-page-select
avirgulto Jan 10, 2024
14d6ada
Fix deployment to github pages and launch from meld. Fix crash when s…
plarocque4 Jan 11, 2024
ddaabc6
Merge pull request #92 from mcode/deploy-fixes
avirgulto Jan 11, 2024
58d5c71
Merge branch 'main' into dev
smalho01 Jan 12, 2024
0ef0c1e
Merge branch 'main' into dev
smalho01 Jan 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 21 additions & 26 deletions .env
Original file line number Diff line number Diff line change
@@ -1,36 +1,31 @@
# Development URLS

REACT_APP_REALM = ClientFhirServer
HTTPS = false
HTTPS_CERT_PATH = server.cert
HTTPS_KEY_PATH = server.key
REACT_APP_ALT_DRUG = true
REACT_APP_AUTH = http://localhost:8180
REACT_APP_CDS_SERVICE = http://localhost:8090/cds-services
REACT_APP_CLIENT = app-login
REACT_APP_CLIENT_SCOPES = launch offline_access openid profile user/Patient.read patient/Patient.read user/Practitioner.read
REACT_APP_AUTH = http://localhost:8180
REACT_APP_SERVER = http://localhost:8090
REACT_APP_DEFAULT_USER = pra1234
REACT_APP_EHR_BASE = http://localhost:8080/test-ehr/r4
REACT_APP_EHR_LINK = http://localhost:8080/ehr-server/
REACT_APP_EHR_SERVER = http://localhost:8080/test-ehr/r4
REACT_APP_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH = http://localhost:8080/test-ehr/r4
REACT_APP_EHR_BASE = http://localhost:8080/test-ehr/r4
REACT_APP_CDS_SERVICE = http://localhost:8090/cds-services
REACT_APP_GENERATE_JWT = true
REACT_APP_ORDER_SIGN = rems-order-sign
REACT_APP_GH_PAGES=false
REACT_APP_HOMEPAGE = http://localhost:8080
REACT_APP_LAUNCH_URL = http://localhost:4040/launch
REACT_APP_ORDER_SELECT = rems-order-select
REACT_APP_PATIENT_VIEW = rems-patient-view
REACT_APP_PATIENT_FHIR_QUERY = Patient?_sort=identifier&_count=12
REACT_APP_USER = alice
REACT_APP_ORDER_SIGN = rems-order-sign
REACT_APP_PASSWORD = alice
REACT_APP_PUBLIC_KEYS = http://localhost:3001/public_keys
REACT_APP_ALT_DRUG = true
REACT_APP_LAUNCH_URL = http://localhost:4040/launch
REACT_APP_SMART_LAUNCH_URL = http://localhost:4040/
REACT_APP_DEFAULT_USER = pra1234
REACT_APP_RESPONSE_EXPIRATION_DAYS = 30
REACT_APP_PATIENT_FHIR_QUERY = Patient?_sort=identifier&_count=12
REACT_APP_PATIENT_VIEW = rems-patient-view
REACT_APP_PIMS_SERVER = http://localhost:5051/doctorOrders/api/addRx
REACT_APP_HOMEPAGE = http://localhost:8080
REACT_APP_PUBLIC_KEYS = http://localhost:3000/request-generator/.well-known/jwks.json
REACT_APP_REALM = ClientFhirServer
REACT_APP_RESPONSE_EXPIRATION_DAYS = 30
REACT_APP_SERVER = http://localhost:8090
REACT_APP_SMART_LAUNCH_URL = http://localhost:4040/
REACT_APP_URL = http://localhost:3000
REACT_APP_URL_FILTER = http://localhost:3000/*
REACT_APP_EHR_LINK = http://localhost:8080/ehr-server/
HTTPS = false
HTTPS_KEY_PATH = server.key
HTTPS_CERT_PATH = server.cert
REACT_APP_GH_PAGES=false
# To Override start command:
# REACT_APP_AUTH=http://example.com PORT=6000 npm start
# Note that .env values can only be accessed by react app starting with 'REACT_APP_'
REACT_APP_USER = alice
16 changes: 0 additions & 16 deletions .github/auto_assign.yml

This file was deleted.

45 changes: 45 additions & 0 deletions How-To-Launch-SMART-on-FHIR-Apps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# How to launch external SMART on FHIR apps from mcode/request-generator

## Setup

### In mcode/rems-admin

Overwrite `SMART_ENDPOINT` in the `.env`. Overwriting environment variables in a `.env.local` does not work (this is a bug). For example, if you are using a registered app in a Meld Sandbox, your `SMART_ENDPOINT` may look like this:

```.env
SMART_ENDPOINT = https://smartlauncher.interop.community/sample-app/launch?client_id=sampleapp&platform=meld
```

### In mcode/request-generator

Set these environment variables in your `.env.local` to overwrite the default values in the `.env`. You must be added to the REMS sandbox on Meld to log in and authenticate when running request-generator locally.

```.env
REACT_APP_CLIENT = ed8b940e-4aaa-4209-b17d-69dfe67543b9
REACT_APP_EHR_BASE = https://gw.interop.community/REMS/data
REACT_APP_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH = https://gw.interop.community/REMS/data
REACT_APP_EHR_SERVER = https://gw.interop.community/REMS/data
REACT_APP_SMART_LAUNCH_URL = https://smartlauncher.interop.community/sample-app/launch?client_id=sampleapp&platform=meld
```

### Where to grab the environment variable values if using a Meld Sandbox

1. `REACT_APP_CLIENT`: This is taken from Apps > Request Generator > Settings > Registered App Details > Client Id. Request Generator refers to the registered mcode/request-generator app in your Meld sandbox.
2. `REACT_APP_EHR_BASE`, `REACT_APP_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH`, `REACT_APP_EHR_SERVER`: These are taken from your Meld sandbox's sidebar, under Settings > Sandbox > Secured FHIR Server URL.
3. `REACT_APP_SMART_LAUNCH_URL`, `SMART_ENDPOINT`: This is taken from Apps > Sample App > Settings > Registered App Details > App Launch URI\*.

## How to run

1. Start request-generator normally and go to `http://localhost:3000/`. Click the "Authorize" button.
2. Start rems-admin normally.
3. In request-generator, click the "Select a Patient" button.
4. Select Jon Snow (id: 130803).
5. Click the "Launch SMART on FHIR app" button. This opens the SMART on FHIR app launch page provided as values to the `REACT_APP_SMART_LAUNCH_URL` and `SMART_ENDPOINT` environment variables.
6. Click the "Authorize" button.
7. You should see the expected SMART on FHIR app launch properly.
8. Go back to request-generator and issue an order-sign hook, and click on the "Patient Enrollment Form" button.
9. You should see the expected SMART on FHIR app launch.

## Running other Registered SMART on FHIR Apps from Meld

Log in to Meld at https://meld.interop.community/. Go to My Sandboxes > REMS > Apps to try out the other Registered Apps. The example above manually tests (1). You can try the remaining options after (2) just by changing the `REACT_APP_SMART_LAUNCH_URL` and `SMART_ENDPOINT` environment variables.
138 changes: 94 additions & 44 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,105 @@
# Request Generator
This subproject provides a small web application that is capable of generating requests and displaying the CDS Hooks cards that are provided as a response. This project is written in JavaScript and runs in [node.js](https://nodejs.org/en/).

This project provides a small web application that is capable of generating requests and displaying the CDS Hooks cards that are provided as a response. This project is written in JavaScript and runs in [node.js](https://nodejs.org/en/).

## Running the request generator standalone
1. Install node.js

1. Install node.js v14 (using [`nvm`](https://github.com/nvm-sh/nvm) is optional, but easier)

- `nvm install 14`
- `nvm use 14`

2. Clone the repository
* `git clone https://github.com/mcode/request-generator.git`

- `git clone https://github.com/mcode/request-generator.git`

3. Install the dependencies
* `cd request-generator`
* `npm install`

- `cd request-generator`
- `npm install`

4. Run the application
* `npm start`

This should open a browser window directed to the value set in `REACT_APP_URL`. The request-generator assumes the CRD server is running on the default value set for `REACT_APP_SERVER`. This can be changed in the properties file [.env](./.env). [The following section](./README.md#how-to-override-defaults) lists the default values for these environment variables.
- `npm start`

This should open a browser window directed to the value set in `REACT_APP_URL` followed by the string `/request-generator`. The request-generator assumes the REMS Admin is running on the default value set for `REACT_APP_SERVER`. This can be changed in the properties file [.env](./.env). [The following section](./README.md#how-to-override-defaults) lists the default values for these environment variables.

## Versions
This application requires node v14.
## Keys

Embedded in the application are the public and private keys used to generate and verify JSON Web Tokens (JWT) that are used to authenticate/authorize calls to a CDS-Hooks service. The public key is contained in the public/.well-known/jwks.json document. The private key is contained in src/keys/crdPrivateKey.js file. The keys were generated from https://mkjwk.org/. To update these keys you can generate a new key pair from this site, ensure that you request the Show X.509 option is set to yes. Once generated you can replace the public and private keys. You will also need to update the src/utils/auth.js file with the corresponding key information.

### How To Override Defaults
The .env file contains the default URI paths, these can be overwritten from the start command as follows:
`REACT_APP_LAUNCH_URL=http://example.com PORT=6000 npm start`

Following are a list of modifiable paths:

| URI Name | Default |
| -----------------------|---------------------------------------------------------------------------|
| REACT_APP_AUTH | `http://localhost:8180` |
| REACT_APP_EHR_SERVER | `http://localhost:8080/test-ehr/r4` |
| REACT_APP_CDS_SERVICE | `http://localhost:8090/cds-services` |
| REACT_APP_PUBLIC_KEYS | `http://localhost:3001/public_keys` |
| REACT_APP_LAUNCH_URL | `http://localhost:4040/launch` |
| REACT_APP_PIMS_SERVER | `http://localhost:5051/doctorOrders/api/addRx` |
| REACT_APP_REALM | `ClientFhirServer` |
| REACT_APP_CLIENT | `app-login` |
| REACT_APP_SERVER | `http://localhost:8090` |
| REACT_APP_EHR_BASE | `http://localhost:8080/test-ehr/r4` |
| REACT_APP_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH | `http://localhost:8080/test-ehr/r4` |
| REACT_APP_ORDER_SIGN | `rems-order-sign` |
| REACT_APP_ORDER_SELECT | `rems-order-select` |
| REACT_APP_PATIENT_VIEW | `rems-patient-view` |
| REACT_APP_USER | `alice` |
| REACT_APP_PASSWORD | `alice` |
| REACT_APP_ALT_DRUG | `true` |
| REACT_APP_SMART_LAUNCH_URL | `http://localhost:4040/` |
| REACT_APP_DEFAULT_USER | `pra1234` |
| REACT_APP_RESPONSE_EXPIRATION_DAYS | `30` |
| REACT_APP_HOMEPAGE | `http://localhost:8080` |
| REACT_APP_URL | `http://localhost:3000` |
| REACT_APP_URL_FILTER | `http://localhost:3000/*` |
| REACT_APP_EHR_LINK | `http://localhost:8080/ehr-server/` |
| HTTPS | `false` |
| HTTPS_KEY_PATH | `server.key` |
| HTTPS_CERT_PATH | `server.cert` |
| REACT_APP_PATIENT_FHIR_QUERY | `Patient?_sort=identifier&_count=12` |

The .env file contains the default URI paths, which can be overwritten from the start command as follows:
a) `REACT_APP_LAUNCH_URL=http://example.com PORT=6000 npm start` or b) by specifying the environment variables and desired values in a `.env.local`.

Following are a list of modifiable paths:

| URI Name | Default |
| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
| HTTPS | `false` |
| HTTPS_CERT_PATH | `server.cert` |
| HTTPS_KEY_PATH | `server.key` |
| REACT_APP_ALT_DRUG | `true` |
| REACT_APP_AUTH | `http://localhost:8180` |
| REACT_APP_CDS_SERVICE | `http://localhost:8090/cds-services` |
| REACT_APP_CLIENT | `app-login` |
| REACT_APP_CLIENT_SCOPES | `launch offline_access openid profile user/Patient.read patient/Patient.read user/Practitioner.read` |
| REACT_APP_DEFAULT_USER | `pra1234` |
| REACT_APP_EHR_BASE | `http://localhost:8080/test-ehr/r4` |
| REACT_APP_EHR_LINK | `http://localhost:8080/ehr-server/` |
| REACT_APP_EHR_SERVER | `http://localhost:8080/test-ehr/r4` |
| REACT_APP_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH | `http://localhost:8080/test-ehr/r4` |
| REACT_APP_GENERATE_JWT | `true` |
| REACT_APP_GH_PAGES | `false` |
| REACT_APP_HOMEPAGE | `http://localhost:8080` |
| REACT_APP_LAUNCH_URL | `http://localhost:4040/launch` |
| REACT_APP_ORDER_SELECT | `rems-order-select` |
| REACT_APP_ORDER_SIGN | `rems-order-sign` |
| REACT_APP_PASSWORD | `alice` |
| REACT_APP_PATIENT_FHIR_QUERY | `Patient?_sort=identifier&_count=12` |
| REACT_APP_PATIENT_VIEW | `rems-patient-view` |
| REACT_APP_PIMS_SERVER | `http://localhost:5051/doctorOrders/api/addRx` |
| REACT_APP_PUBLIC_KEYS | `http://localhost:3000/request-generator/.well-known/jwks.json` |
| REACT_APP_REALM | `ClientFhirServer` |
| REACT_APP_RESPONSE_EXPIRATION_DAYS | `30` |
| REACT_APP_SERVER | `http://localhost:8090` |
| REACT_APP_SMART_LAUNCH_URL | `http://localhost:4040/` |
| REACT_APP_URL | `http://localhost:3000` |
| REACT_APP_URL_FILTER | `http://localhost:3000/*` |
| REACT_APP_USER | `alice` |

## How to launch as a SMART on FHIR app

### Using a SMART App Launcher

1. Go to a SMART app launcher, such as `http://moonshot-dev.mitre.org:4001/index.html` (MITRE) or `https://launch.smarthealthit.org/` (open to public).
2. For the App Launch URL, provide `http://localhost:3000/launch`.

### Using Meld or a real EHR

1. If you'd like to launch from Meld, [log in to Meld](https://meld.interop.community/) and follow steps 2-3.
2. The log in page will bring you to the My Sandboxes page. Go to your sandbox.
3. You will land on the Registered Apps page. Click on the circular plus button in the top-right corner and register the request-generator app manually with these settings:

- Client Type: `Public Client`
- App Launch URI: `http://localhost:3000/launch`
- App Redirect URIs: `http://localhost:3000/#/index, http://localhost:4040/register,http://localhost:3000/index, http://localhost:4040/index`
- Scopes: `launch openid user/*.* offline_access profile`

4. After registering request-generator, hover over it and click Launch.

<!-- TODO: update step 4 once Zach does client registration ticket. This is the error when launching:

```
Error invalid_client
There was an error processing your request.

Client with id app-login was not found
```

-->

## How to launch a SMART on FHIR app from request-generator

See the [following guide](./How-To-Launch-SMART-on-FHIR-Apps.md) for more information.
14 changes: 14 additions & 0 deletions public/.well-known/jwks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"keys": [
{
"kty": "EC",
"d": "boatWqmVCQvm8wapC7XIF33oydjzXUrb6Mwz4XclkXHCSEYtdxj345LMwFJQAvrN",
"use": "sig",
"crv": "P-384",
"kid": "zGe023HzCFfY7NPb04EGvRDP1oYsTOtLNCNjDgr66AI",
"x": "GJ1EKKadP512kbQLAhu3qftADevkhCcaOFFZi376S8dvhjZU9vxNy3wplJv_GiOr",
"y": "-0nhaXoadjGOAOuMp4ekU7ricjF6So2n57k0N-VrJ9hqA-A0PhnShrmGQdBIEKah",
"alg": "ES384"
}
]
}
Binary file added src/.DS_Store
Binary file not shown.
Loading