From ac1ba9719a7266f6eff9ee8f631b5322ae527601 Mon Sep 17 00:00:00 2001 From: KeeyanGhoreshi Date: Mon, 10 Jun 2024 14:25:11 -0400 Subject: [PATCH 1/2] update readme --- .env | 2 -- README.md | 103 +++++++++++++++++++++++++++++++----------------------- 2 files changed, 60 insertions(+), 45 deletions(-) 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..ab369e2 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 small web application that is capable of generating requests and displaying the CDS Hooks cards that are provided as a response. This app functionally serves as the frontend of the EHR it connects to, and is treated as part of the EHR system rather than a third party app. Typically, functionality provided by the Request Generator would be handled by the EHR in a production environment. The Request Generator makes it easy and simple to add CDS Hooks capability to SMART on FHIR compliant EHRs. -## 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,48 +37,9 @@ 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: - -| 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` | +## Usage -## 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 @@ -96,6 +59,27 @@ 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, selecting a medication for that patient, and then submitting the medication request 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. + +## 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 + +