diff --git a/.env b/.env index 2b9c27f..ed37ff6 100644 --- a/.env +++ b/.env @@ -8,12 +8,10 @@ VITE_CLIENT = app-login VITE_CLIENT_SCOPES = launch offline_access openid profile user/Patient.read patient/Patient.read user/Practitioner.read VITE_DEFAULT_USER = pra1234 VITE_EHR_BASE = http://localhost:8080/test-ehr/r4 -VITE_EHR_LINK = http://localhost:8080/ehr-server/ VITE_EHR_SERVER = http://localhost:8080/test-ehr/r4 VITE_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH = http://localhost:8080/test-ehr/r4 VITE_GENERATE_JWT = true VITE_GH_PAGES=false -VITE_HOMEPAGE = http://localhost:8080 VITE_LAUNCH_URL = http://localhost:4040/launch VITE_PASSWORD = alice VITE_PATIENT_FHIR_QUERY = Patient?_sort=identifier&_count=12 diff --git a/README.md b/README.md index 2943f76..f33cb0f 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,10 @@ # Request Generator -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/). +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. -## Running the request generator standalone +This project is written in JavaScript with React and runs in [node.js](https://nodejs.org/en/). + +## Initialization 1. Install node.js v14 (using [`nvm`](https://github.com/nvm-sh/nvm) is optional, but easier) @@ -35,52 +37,13 @@ Run the following commands 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, which can be overwritten from the start command as follows: -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`. - -Following are a list of modifiable paths: +## Usage -| URI Name | Default | -| ---------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | -| HTTPS | `false` | -| HTTPS_CERT_PATH | `server.cert` | -| HTTPS_KEY_PATH | `server.key` | -| VITE_ALT_DRUG | `true` | -| VITE_AUTH | `http://localhost:8180` | -| VITE_CDS_SERVICE | `http://localhost:8090/cds-services` | -| VITE_CLIENT | `app-login` | -| VITE_CLIENT_SCOPES | `launch offline_access openid profile user/Patient.read patient/Patient.read user/Practitioner.read` | -| VITE_DEFAULT_USER | `pra1234` | -| VITE_EHR_BASE | `http://localhost:8080/test-ehr/r4` | -| VITE_EHR_LINK | `http://localhost:8080/ehr-server/` | -| VITE_EHR_SERVER | `http://localhost:8080/test-ehr/r4` | -| VITE_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH | `http://localhost:8080/test-ehr/r4` | -| VITE_GENERATE_JWT | `true` | -| VITE_GH_PAGES | `false` | -| VITE_HOMEPAGE | `http://localhost:8080` | -| VITE_LAUNCH_URL | `http://localhost:4040/launch` | -| VITE_ORDER_SELECT | `rems-order-select` | -| VITE_ORDER_SIGN | `rems-order-sign` | -| VITE_PASSWORD | `alice` | -| VITE_PATIENT_FHIR_QUERY | `Patient?_sort=identifier&_count=12` | -| VITE_PATIENT_VIEW | `rems-patient-view` | -| VITE_PIMS_SERVER | `http://localhost:5051/doctorOrders/api/addRx` | -| VITE_PUBLIC_KEYS | `http://localhost:3000/request-generator/.well-known/jwks.json` | -| VITE_REALM | `ClientFhirServer` | -| VITE_RESPONSE_EXPIRATION_DAYS | `30` | -| VITE_SERVER | `http://localhost:8090` | -| VITE_SMART_LAUNCH_URL | `http://localhost:4040/` | -| VITE_URL | `http://localhost:3000` | -| VITE_URL_FILTER | `http://localhost:3000/*` | -| VITE_USER | `alice` | - -## How to launch as a SMART on FHIR app +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. ### 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). +1. Go to a SMART app launcher, such as `https://launch.smarthealthit.org/`. 2. For the App Launch URL, provide `http://localhost:3000/launch`. ### Using Meld or a real EHR @@ -96,6 +59,32 @@ Following are a list of modifiable paths: 4. After registering request-generator, hover over it and click Launch. +### Workflow + +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. + +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. + +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. + +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. + +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. + + +## Routes + +The request generator has three distinct routes. + +* `/` - 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. + +* `/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. + +* `/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. + +## How to launch as a SMART on FHIR app + +