Skip to content

Commit f341795

Browse files
authored
Merge pull request #131 from mcode/dev
Dev
2 parents b086b5b + 1b268ba commit f341795

File tree

3 files changed

+68
-48
lines changed

3 files changed

+68
-48
lines changed

.env

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,10 @@ VITE_CLIENT = app-login
88
VITE_CLIENT_SCOPES = launch offline_access openid profile user/Patient.read patient/Patient.read user/Practitioner.read
99
VITE_DEFAULT_USER = pra1234
1010
VITE_EHR_BASE = http://localhost:8080/test-ehr/r4
11-
VITE_EHR_LINK = http://localhost:8080/ehr-server/
1211
VITE_EHR_SERVER = http://localhost:8080/test-ehr/r4
1312
VITE_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH = http://localhost:8080/test-ehr/r4
1413
VITE_GENERATE_JWT = true
1514
VITE_GH_PAGES=false
16-
VITE_HOMEPAGE = http://localhost:8080
1715
VITE_LAUNCH_URL = http://localhost:4040/launch
1816
VITE_PASSWORD = alice
1917
VITE_PATIENT_FHIR_QUERY = Patient?_sort=identifier&_count=12

README.md

Lines changed: 67 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Request Generator
22

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/).
3+
This project provides a testing tool for the REMS workflow that is capable of generating CDS Hooks requests and displaying the CDS Hooks cards that are provided as a response. The Request Generator also handles various other tasks like patient selection, sending medication requests to the pharmacy system, managing in-progress Questionnaire forms, and launching SMART apps. Typically, capabilities provided by the Request Generator would be handled by an EHR in a production environment.
44

5-
## Running the request generator standalone
5+
This project is written in JavaScript with React and runs in [node.js](https://nodejs.org/en/).
6+
7+
## Initialization
68

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

@@ -35,52 +37,13 @@ Run the following commands
3537

3638
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.
3739

38-
### How To Override Defaults
39-
40-
The .env file contains the default URI paths, which can be overwritten from the start command as follows:
41-
a) `VITE_LAUNCH_URL=http://example.com PORT=6000 npm start` or b) by specifying the environment variables and desired values in a `.env.local`.
42-
43-
Following are a list of modifiable paths:
40+
## Usage
4441

45-
| URI Name | Default |
46-
| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |
47-
| HTTPS | `false` |
48-
| HTTPS_CERT_PATH | `server.cert` |
49-
| HTTPS_KEY_PATH | `server.key` |
50-
| VITE_ALT_DRUG | `true` |
51-
| VITE_AUTH | `http://localhost:8180` |
52-
| VITE_CDS_SERVICE | `http://localhost:8090/cds-services` |
53-
| VITE_CLIENT | `app-login` |
54-
| VITE_CLIENT_SCOPES | `launch offline_access openid profile user/Patient.read patient/Patient.read user/Practitioner.read` |
55-
| VITE_DEFAULT_USER | `pra1234` |
56-
| VITE_EHR_BASE | `http://localhost:8080/test-ehr/r4` |
57-
| VITE_EHR_LINK | `http://localhost:8080/ehr-server/` |
58-
| VITE_EHR_SERVER | `http://localhost:8080/test-ehr/r4` |
59-
| VITE_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH | `http://localhost:8080/test-ehr/r4` |
60-
| VITE_GENERATE_JWT | `true` |
61-
| VITE_GH_PAGES | `false` |
62-
| VITE_HOMEPAGE | `http://localhost:8080` |
63-
| VITE_LAUNCH_URL | `http://localhost:4040/launch` |
64-
| VITE_ORDER_SELECT | `rems-order-select` |
65-
| VITE_ORDER_SIGN | `rems-order-sign` |
66-
| VITE_PASSWORD | `alice` |
67-
| VITE_PATIENT_FHIR_QUERY | `Patient?_sort=identifier&_count=12` |
68-
| VITE_PATIENT_VIEW | `rems-patient-view` |
69-
| VITE_PIMS_SERVER | `http://localhost:5051/doctorOrders/api/addRx` |
70-
| VITE_PUBLIC_KEYS | `http://localhost:3000/request-generator/.well-known/jwks.json` |
71-
| VITE_REALM | `ClientFhirServer` |
72-
| VITE_RESPONSE_EXPIRATION_DAYS | `30` |
73-
| VITE_SERVER | `http://localhost:8090` |
74-
| VITE_SMART_LAUNCH_URL | `http://localhost:4040/` |
75-
| VITE_URL | `http://localhost:3000` |
76-
| VITE_URL_FILTER | `http://localhost:3000/*` |
77-
| VITE_USER | `alice` |
78-
79-
## How to launch as a SMART on FHIR app
42+
To use the app, first you must launch it. The Request Generator is a SMART on FHIR App, so it can either be launched standalone, by visiting the base url (http://localhost:3000), or EHR launched, which requires the app to be launched from an actual EHR system or a SMART App Launcher that mimics an EHR system.
8043

8144
### Using a SMART App Launcher
8245

83-
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).
46+
1. Go to a SMART app launcher, such as `https://launch.smarthealthit.org/`.
8447
2. For the App Launch URL, provide `http://localhost:3000/launch`.
8548

8649
### Using Meld or a real EHR
@@ -96,6 +59,32 @@ Following are a list of modifiable paths:
9659

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

62+
### Workflow
63+
64+
The Request Generator's main purpose is to provide the capability to send CDS hooks to and receive/display cards from a CDS service like the [REMS Admin](https://github.com/mcode/rems-admin). After launching the app, the main workflow consists of selecting a patient and then selecting a medication for that patient. The selected medication can be sent to the [pharmacy system](https://github.com/mcode/pims) to kick off the REMS workflow, though it is not necessary if you just want to explore.
65+
66+
The next step is to submit the patient and medication information to the REMS Admin. The REMS admin will respond with a set of cards indicating whether the selected medication has a REMS program, with links to fill out necessary forms if it does have one. The workflow then continues from the request generator to the [REMS SMART on FHIR app](https://github.com/mcode/rems-smart-on-fhir), which handles filling out forms and fulfilling requirements.
67+
68+
The Request Generator also manages tasks, which can be used to defer forms to be completed later, or to assign forms to specific parties. Tasks can be handled in the `tasks` tab and can be created from cards that are returned from the REMS Admin. Some cards will have a suggestion to create a task for completing a form, and clicking on the suggestion button will automatically create a task resource.
69+
70+
For patients, the Reqest Generator has a patient portal which allows users to view their in progress medications, tasks that are assigned to them, and information about their prescriptions. The patient portal is mainly used to allow patients to fill out required forms by launching them from a task or in-progress form into the REMS SMART on FHIR app.
71+
72+
Information about the status of the prescription and the status of the REMS approval can be viewed directly in the Request Generator. Panels with the status information can be viewed in both the main app and the patient portal.
73+
74+
75+
## Routes
76+
77+
The request generator has three distinct routes.
78+
79+
* `/` - The base route opens the main app page. This is where a user can select a patient and send a CDS Hook, or launch a SMART app.
80+
81+
* `/patient-portal` - The patient portal allows patients to log into the EHR and see information about their pending medications or launch a SMART app from a task to complete a pending form.
82+
83+
* `/register` - The registration page allows users to add client ids and their associated FHIR server url to allow for connecting to different EHRs automatically. This is useful for launching the request generator directly from an EHR or from a SMART sandbox, as opposed to visiting the base route directly.
84+
85+
## How to launch as a SMART on FHIR app
86+
87+
9988
<!-- TODO: update step 4 once Zach does client registration ticket. This is the error when launching:
10089
10190
```
@@ -110,3 +99,37 @@ Client with id app-login was not found
11099
## How to launch a SMART on FHIR app from request-generator
111100

112101
See the [following guide](./How-To-Launch-SMART-on-FHIR-Apps.md) for more information.
102+
103+
104+
### Environment Variables
105+
106+
The .env file contains the default URI paths, which can be overwritten from the start command in one of the following ways:
107+
* By starting the app with the following comamand: `VITE_LAUNCH_URL=http://example.com PORT=6000 npm start`
108+
* By specifying the environment variables and desired values in a `.env.local` file.
109+
110+
Following are a list of modifiable paths:
111+
112+
| URI Name | Default | Description |
113+
| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- |-----------------------
114+
| VITE_ALT_DRUG | `true` | When set to true, allows the app to recieve alternate drug therapy cards from the REMS Admin. |
115+
| VITE_AUTH | `http://localhost:8180` | The base URL of the EHR auth server. |
116+
| VITE_CDS_SERVICE | `http://localhost:8090/cds-services` | The base URL of the CDS Service. This will typically be the REMS Admin. |
117+
| VITE_CLIENT | `app-login` | The default client to use for the SMART launch. Can be modified directly when launching the app. |
118+
| VITE_CLIENT_SCOPES | `launch offline_access openid profile user/Patient.read patient/Patient.read user/Practitioner.read` | The default scopes to use for the SMART launch. Can be modified directly when launching the app. |
119+
| VITE_DEFAULT_USER | `pra1234` | The default user to log in as when SMART launching. It should be the FHIR id of a practitioner resource. |
120+
| VITE_EHR_BASE | `http://localhost:8080/test-ehr/r4` | The default base url for the EHR. Can be modified directly when launching the app. |
121+
| VITE_EHR_SERVER | `http://localhost:8080/test-ehr/r4` | The default base url for the EHR FHIR Server. Generally, this should be the same as the EHR_BASE. |
122+
| VITE_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH | `http://localhost:8080/test-ehr/r4` | The default base URL for the EHR FHIR server to be sent in the CDS Hook. This environment generally should match EHR_SERVER, except in edge cases when dealing with deployment. |
123+
| VITE_GENERATE_JWT | `true` | When true, the app will generate a JWT for authentication when sending the CDS Hook. Can be set to false if using a REMS Admin CDS Service that is not secured. |
124+
| VITE_GH_PAGES | `false` | Should be set to `true` if the app is being hosted on github pages, and `false` otherwise. |
125+
| VITE_LAUNCH_URL | `http://localhost:4040/launch` | The launch URL of the SMART app the request generator should use for standalone launches. Note that this URL is only used outside of the context of the CDS Hooks workflow. Normally, the SMART app launch URL will come from a link inside a card that is returned by the REMS Admin. |
126+
| VITE_PASSWORD | `alice` | The default password for logging in as the default user, defined by VITE_USER. This should be changed if using a different default user. |
127+
| VITE_PATIENT_FHIR_QUERY | `Patient?_sort=identifier&_count=12` | The FHIR query the app makes when searching for patients in the EHR. This should be modified if a different behavior is desired by the apps patient selection popup. This can also be modified directly in the app's settings. |
128+
| VITE_PIMS_SERVER | `http://localhost:5051/doctorOrders/api/addRx` | The Pharmacy System endpoint for submitting medications. This should be changed depending on which pharmacy system you want to connect with. |
129+
| VITE_PUBLIC_KEYS | `http://localhost:3000/request-generator/.well-known/jwks.json` | The endpoint which contains the public keys for authentication with the REMS admin. Should be changed if the keys are moved elsewhere. |
130+
| VITE_REALM | `ClientFhirServer` | The Keycloak realm to use. Only relevant is using Keycloak as an authentication server. This only affects direct logins like through the Patient Portal, not SMART launches like opening the app normally. |
131+
| VITE_RESPONSE_EXPIRATION_DAYS | `30` | The number of days old a Questionnaire Response can be before it is ignored and filtered out. This ensures the patient search excludes outdated or obsolete prior sessions from creating clutter. |
132+
| VITE_SERVER | `http://localhost:8090` | The default base URL of the CDS service. Typically this will be the base url of the REMS Admin. |
133+
| VITE_SMART_LAUNCH_URL | `http://localhost:4040/` | The base url of the SMART app. This is used for opening the app directly, rather than doing an EHR SMART launch. |
134+
| VITE_URL | `http://localhost:3000` | The base url of this app. Should be modified if the port or domain change. |
135+
| VITE_USER | `alice` | The default user to login as when opening the app. |

src/components/DisplayBox/DisplayBox.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ const DisplayBox = props => {
6262
const element = document.getElementById(buttonId);
6363
element.setAttribute('disabled', 'true');
6464
element.setAttribute('style', 'background-color:#4BB543;');
65-
element.setAttribute('style');
6665
}
6766

6867
if (suggestion.label) {
@@ -300,7 +299,7 @@ const DisplayBox = props => {
300299
width: '100%',
301300
marginBottom: '5px'
302301
}}
303-
ÍclassName="myButton"
302+
className="myButton"
304303
onClick={e => launchLink(e, link)}
305304
endIcon={<ArrowForwardRoundedIcon />}
306305
>

0 commit comments

Comments
 (0)