Skip to content

Commit c237342

Browse files
authored
Merge pull request #93 from mcode/dev
Dev
2 parents 321459f + 0ef0c1e commit c237342

28 files changed

Lines changed: 915 additions & 609 deletions

.env

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,31 @@
1-
# Development URLS
2-
3-
REACT_APP_REALM = ClientFhirServer
1+
HTTPS = false
2+
HTTPS_CERT_PATH = server.cert
3+
HTTPS_KEY_PATH = server.key
4+
REACT_APP_ALT_DRUG = true
5+
REACT_APP_AUTH = http://localhost:8180
6+
REACT_APP_CDS_SERVICE = http://localhost:8090/cds-services
47
REACT_APP_CLIENT = app-login
58
REACT_APP_CLIENT_SCOPES = launch offline_access openid profile user/Patient.read patient/Patient.read user/Practitioner.read
6-
REACT_APP_AUTH = http://localhost:8180
7-
REACT_APP_SERVER = http://localhost:8090
9+
REACT_APP_DEFAULT_USER = pra1234
10+
REACT_APP_EHR_BASE = http://localhost:8080/test-ehr/r4
11+
REACT_APP_EHR_LINK = http://localhost:8080/ehr-server/
812
REACT_APP_EHR_SERVER = http://localhost:8080/test-ehr/r4
913
REACT_APP_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH = http://localhost:8080/test-ehr/r4
10-
REACT_APP_EHR_BASE = http://localhost:8080/test-ehr/r4
11-
REACT_APP_CDS_SERVICE = http://localhost:8090/cds-services
1214
REACT_APP_GENERATE_JWT = true
13-
REACT_APP_ORDER_SIGN = rems-order-sign
15+
REACT_APP_GH_PAGES=false
16+
REACT_APP_HOMEPAGE = http://localhost:8080
17+
REACT_APP_LAUNCH_URL = http://localhost:4040/launch
1418
REACT_APP_ORDER_SELECT = rems-order-select
15-
REACT_APP_PATIENT_VIEW = rems-patient-view
16-
REACT_APP_PATIENT_FHIR_QUERY = Patient?_sort=identifier&_count=12
17-
REACT_APP_USER = alice
19+
REACT_APP_ORDER_SIGN = rems-order-sign
1820
REACT_APP_PASSWORD = alice
19-
REACT_APP_PUBLIC_KEYS = http://localhost:3001/public_keys
20-
REACT_APP_ALT_DRUG = true
21-
REACT_APP_LAUNCH_URL = http://localhost:4040/launch
22-
REACT_APP_SMART_LAUNCH_URL = http://localhost:4040/
23-
REACT_APP_DEFAULT_USER = pra1234
24-
REACT_APP_RESPONSE_EXPIRATION_DAYS = 30
21+
REACT_APP_PATIENT_FHIR_QUERY = Patient?_sort=identifier&_count=12
22+
REACT_APP_PATIENT_VIEW = rems-patient-view
2523
REACT_APP_PIMS_SERVER = http://localhost:5051/doctorOrders/api/addRx
26-
REACT_APP_HOMEPAGE = http://localhost:8080
24+
REACT_APP_PUBLIC_KEYS = http://localhost:3000/request-generator/.well-known/jwks.json
25+
REACT_APP_REALM = ClientFhirServer
26+
REACT_APP_RESPONSE_EXPIRATION_DAYS = 30
27+
REACT_APP_SERVER = http://localhost:8090
28+
REACT_APP_SMART_LAUNCH_URL = http://localhost:4040/
2729
REACT_APP_URL = http://localhost:3000
2830
REACT_APP_URL_FILTER = http://localhost:3000/*
29-
REACT_APP_EHR_LINK = http://localhost:8080/ehr-server/
30-
HTTPS = false
31-
HTTPS_KEY_PATH = server.key
32-
HTTPS_CERT_PATH = server.cert
33-
REACT_APP_GH_PAGES=false
34-
# To Override start command:
35-
# REACT_APP_AUTH=http://example.com PORT=6000 npm start
36-
# Note that .env values can only be accessed by react app starting with 'REACT_APP_'
31+
REACT_APP_USER = alice

.github/auto_assign.yml

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# How to launch external SMART on FHIR apps from mcode/request-generator
2+
3+
## Setup
4+
5+
### In mcode/rems-admin
6+
7+
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:
8+
9+
```.env
10+
SMART_ENDPOINT = https://smartlauncher.interop.community/sample-app/launch?client_id=sampleapp&platform=meld
11+
```
12+
13+
### In mcode/request-generator
14+
15+
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.
16+
17+
```.env
18+
REACT_APP_CLIENT = ed8b940e-4aaa-4209-b17d-69dfe67543b9
19+
REACT_APP_EHR_BASE = https://gw.interop.community/REMS/data
20+
REACT_APP_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH = https://gw.interop.community/REMS/data
21+
REACT_APP_EHR_SERVER = https://gw.interop.community/REMS/data
22+
REACT_APP_SMART_LAUNCH_URL = https://smartlauncher.interop.community/sample-app/launch?client_id=sampleapp&platform=meld
23+
```
24+
25+
### Where to grab the environment variable values if using a Meld Sandbox
26+
27+
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.
28+
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.
29+
3. `REACT_APP_SMART_LAUNCH_URL`, `SMART_ENDPOINT`: This is taken from Apps > Sample App > Settings > Registered App Details > App Launch URI\*.
30+
31+
## How to run
32+
33+
1. Start request-generator normally and go to `http://localhost:3000/`. Click the "Authorize" button.
34+
2. Start rems-admin normally.
35+
3. In request-generator, click the "Select a Patient" button.
36+
4. Select Jon Snow (id: 130803).
37+
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.
38+
6. Click the "Authorize" button.
39+
7. You should see the expected SMART on FHIR app launch properly.
40+
8. Go back to request-generator and issue an order-sign hook, and click on the "Patient Enrollment Form" button.
41+
9. You should see the expected SMART on FHIR app launch.
42+
43+
## Running other Registered SMART on FHIR Apps from Meld
44+
45+
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.

README.md

Lines changed: 94 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,105 @@
11
# Request Generator
2-
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/).
2+
3+
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/).
34

45
## Running the request generator standalone
5-
1. Install node.js
6+
7+
1. Install node.js v14 (using [`nvm`](https://github.com/nvm-sh/nvm) is optional, but easier)
8+
9+
- `nvm install 14`
10+
- `nvm use 14`
11+
612
2. Clone the repository
7-
* `git clone https://github.com/mcode/request-generator.git`
13+
14+
- `git clone https://github.com/mcode/request-generator.git`
15+
816
3. Install the dependencies
9-
* `cd request-generator`
10-
* `npm install`
17+
18+
- `cd request-generator`
19+
- `npm install`
20+
1121
4. Run the application
12-
* `npm start`
1322

14-
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.
23+
- `npm start`
24+
25+
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.
1526

16-
## Versions
17-
This application requires node v14.
27+
## Keys
1828

29+
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.
1930

2031
### How To Override Defaults
21-
The .env file contains the default URI paths, these can be overwritten from the start command as follows:
22-
`REACT_APP_LAUNCH_URL=http://example.com PORT=6000 npm start`
23-
24-
Following are a list of modifiable paths:
25-
26-
| URI Name | Default |
27-
| -----------------------|---------------------------------------------------------------------------|
28-
| REACT_APP_AUTH | `http://localhost:8180` |
29-
| REACT_APP_EHR_SERVER | `http://localhost:8080/test-ehr/r4` |
30-
| REACT_APP_CDS_SERVICE | `http://localhost:8090/cds-services` |
31-
| REACT_APP_PUBLIC_KEYS | `http://localhost:3001/public_keys` |
32-
| REACT_APP_LAUNCH_URL | `http://localhost:4040/launch` |
33-
| REACT_APP_PIMS_SERVER | `http://localhost:5051/doctorOrders/api/addRx` |
34-
| REACT_APP_REALM | `ClientFhirServer` |
35-
| REACT_APP_CLIENT | `app-login` |
36-
| REACT_APP_SERVER | `http://localhost:8090` |
37-
| REACT_APP_EHR_BASE | `http://localhost:8080/test-ehr/r4` |
38-
| REACT_APP_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH | `http://localhost:8080/test-ehr/r4` |
39-
| REACT_APP_ORDER_SIGN | `rems-order-sign` |
40-
| REACT_APP_ORDER_SELECT | `rems-order-select` |
41-
| REACT_APP_PATIENT_VIEW | `rems-patient-view` |
42-
| REACT_APP_USER | `alice` |
43-
| REACT_APP_PASSWORD | `alice` |
44-
| REACT_APP_ALT_DRUG | `true` |
45-
| REACT_APP_SMART_LAUNCH_URL | `http://localhost:4040/` |
46-
| REACT_APP_DEFAULT_USER | `pra1234` |
47-
| REACT_APP_RESPONSE_EXPIRATION_DAYS | `30` |
48-
| REACT_APP_HOMEPAGE | `http://localhost:8080` |
49-
| REACT_APP_URL | `http://localhost:3000` |
50-
| REACT_APP_URL_FILTER | `http://localhost:3000/*` |
51-
| REACT_APP_EHR_LINK | `http://localhost:8080/ehr-server/` |
52-
| HTTPS | `false` |
53-
| HTTPS_KEY_PATH | `server.key` |
54-
| HTTPS_CERT_PATH | `server.cert` |
55-
| REACT_APP_PATIENT_FHIR_QUERY | `Patient?_sort=identifier&_count=12` |
32+
33+
The .env file contains the default URI paths, which can be overwritten from the start command as follows:
34+
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`.
35+
36+
Following are a list of modifiable paths:
37+
38+
| URI Name | Default |
39+
| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
40+
| HTTPS | `false` |
41+
| HTTPS_CERT_PATH | `server.cert` |
42+
| HTTPS_KEY_PATH | `server.key` |
43+
| REACT_APP_ALT_DRUG | `true` |
44+
| REACT_APP_AUTH | `http://localhost:8180` |
45+
| REACT_APP_CDS_SERVICE | `http://localhost:8090/cds-services` |
46+
| REACT_APP_CLIENT | `app-login` |
47+
| REACT_APP_CLIENT_SCOPES | `launch offline_access openid profile user/Patient.read patient/Patient.read user/Practitioner.read` |
48+
| REACT_APP_DEFAULT_USER | `pra1234` |
49+
| REACT_APP_EHR_BASE | `http://localhost:8080/test-ehr/r4` |
50+
| REACT_APP_EHR_LINK | `http://localhost:8080/ehr-server/` |
51+
| REACT_APP_EHR_SERVER | `http://localhost:8080/test-ehr/r4` |
52+
| REACT_APP_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH | `http://localhost:8080/test-ehr/r4` |
53+
| REACT_APP_GENERATE_JWT | `true` |
54+
| REACT_APP_GH_PAGES | `false` |
55+
| REACT_APP_HOMEPAGE | `http://localhost:8080` |
56+
| REACT_APP_LAUNCH_URL | `http://localhost:4040/launch` |
57+
| REACT_APP_ORDER_SELECT | `rems-order-select` |
58+
| REACT_APP_ORDER_SIGN | `rems-order-sign` |
59+
| REACT_APP_PASSWORD | `alice` |
60+
| REACT_APP_PATIENT_FHIR_QUERY | `Patient?_sort=identifier&_count=12` |
61+
| REACT_APP_PATIENT_VIEW | `rems-patient-view` |
62+
| REACT_APP_PIMS_SERVER | `http://localhost:5051/doctorOrders/api/addRx` |
63+
| REACT_APP_PUBLIC_KEYS | `http://localhost:3000/request-generator/.well-known/jwks.json` |
64+
| REACT_APP_REALM | `ClientFhirServer` |
65+
| REACT_APP_RESPONSE_EXPIRATION_DAYS | `30` |
66+
| REACT_APP_SERVER | `http://localhost:8090` |
67+
| REACT_APP_SMART_LAUNCH_URL | `http://localhost:4040/` |
68+
| REACT_APP_URL | `http://localhost:3000` |
69+
| REACT_APP_URL_FILTER | `http://localhost:3000/*` |
70+
| REACT_APP_USER | `alice` |
71+
72+
## How to launch as a SMART on FHIR app
73+
74+
### Using a SMART App Launcher
75+
76+
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).
77+
2. For the App Launch URL, provide `http://localhost:3000/launch`.
78+
79+
### Using Meld or a real EHR
80+
81+
1. If you'd like to launch from Meld, [log in to Meld](https://meld.interop.community/) and follow steps 2-3.
82+
2. The log in page will bring you to the My Sandboxes page. Go to your sandbox.
83+
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:
84+
85+
- Client Type: `Public Client`
86+
- App Launch URI: `http://localhost:3000/launch`
87+
- App Redirect URIs: `http://localhost:3000/#/index, http://localhost:4040/register,http://localhost:3000/index, http://localhost:4040/index`
88+
- Scopes: `launch openid user/*.* offline_access profile`
89+
90+
4. After registering request-generator, hover over it and click Launch.
91+
92+
<!-- TODO: update step 4 once Zach does client registration ticket. This is the error when launching:
93+
94+
```
95+
Error invalid_client
96+
There was an error processing your request.
97+
98+
Client with id app-login was not found
99+
```
100+
101+
-->
102+
103+
## How to launch a SMART on FHIR app from request-generator
104+
105+
See the [following guide](./How-To-Launch-SMART-on-FHIR-Apps.md) for more information.

public/.well-known/jwks.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"keys": [
3+
{
4+
"kty": "EC",
5+
"d": "boatWqmVCQvm8wapC7XIF33oydjzXUrb6Mwz4XclkXHCSEYtdxj345LMwFJQAvrN",
6+
"use": "sig",
7+
"crv": "P-384",
8+
"kid": "zGe023HzCFfY7NPb04EGvRDP1oYsTOtLNCNjDgr66AI",
9+
"x": "GJ1EKKadP512kbQLAhu3qftADevkhCcaOFFZi376S8dvhjZU9vxNy3wplJv_GiOr",
10+
"y": "-0nhaXoadjGOAOuMp4ekU7ricjF6So2n57k0N-VrJ9hqA-A0PhnShrmGQdBIEKah",
11+
"alg": "ES384"
12+
}
13+
]
14+
}

src/.DS_Store

6 KB
Binary file not shown.

0 commit comments

Comments
 (0)