diff --git a/.env b/.env
index b7107e30..76f60c85 100644
--- a/.env
+++ b/.env
@@ -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
diff --git a/.github/auto_assign.yml b/.github/auto_assign.yml
deleted file mode 100644
index b63c47d6..00000000
--- a/.github/auto_assign.yml
+++ /dev/null
@@ -1,16 +0,0 @@
-# Set to true to add reviewers to pull requests
-addReviewers: true
-
-# Set to true to add assignees to pull requests
-addAssignees: false
-
-# A list of reviewers to be added to pull requests (GitHub user name)
-reviewers:
- - zacharyrobin
- - KeeyanGhoreshi
- - smalho01
- - plarocque4
- - kennyEung
-
-# A number of reviewers added to the pull request, Set to 0 to add all reviewers
-numberOfReviewers: 0
diff --git a/How-To-Launch-SMART-on-FHIR-Apps.md b/How-To-Launch-SMART-on-FHIR-Apps.md
new file mode 100644
index 00000000..02824ec4
--- /dev/null
+++ b/How-To-Launch-SMART-on-FHIR-Apps.md
@@ -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.
diff --git a/README.md b/README.md
index 04e21b68..b7dd2b33 100644
--- a/README.md
+++ b/README.md
@@ -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` |
\ No newline at end of file
+
+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.
+
+
+
+## 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.
diff --git a/public/.well-known/jwks.json b/public/.well-known/jwks.json
new file mode 100644
index 00000000..0465086b
--- /dev/null
+++ b/public/.well-known/jwks.json
@@ -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"
+ }
+ ]
+}
diff --git a/src/.DS_Store b/src/.DS_Store
new file mode 100644
index 00000000..4efe7f24
Binary files /dev/null and b/src/.DS_Store differ
diff --git a/src/components/App.js b/src/components/App.js
index 16aab97b..dd43cadf 100644
--- a/src/components/App.js
+++ b/src/components/App.js
@@ -1,21 +1,22 @@
+import { ThemeProvider } from '@mui/styles';
import React from 'react';
-import { BrowserRouter, HashRouter, Routes, Route } from 'react-router-dom';
-import RequestBuilder from '../containers/RequestBuilder';
+import { BrowserRouter, HashRouter, Route, Routes } from 'react-router-dom';
+import Gateway from '../containers/Gateway/Gateway';
+import Index from '../containers/Index';
+import Launch from '../containers/Launch';
import PatientPortal from '../containers/PatientPortal';
+import RegisterPage from '../containers/register/RegisterPage';
import theme from '../containers/styles/theme';
-import { ThemeProvider } from '@mui/styles';
-import Launch from '../containers/Launch';
-import Index from '../containers/Index';
-
const isGhPages = process.env.REACT_APP_GH_PAGES === 'true';
const Router = isGhPages ? HashRouter : BrowserRouter;
-const redirect = isGhPages ? '/#/index' : '/index';
+const redirect = isGhPages ? '/request-generator/#/index' : '/index';
const App = () => {
return (
Filter patient list
+Showing {getFilteredLength(input, listOfPatients)} of {props.searchablePatients.length} records
+