Skip to content

Commit 0cee93a

Browse files
authored
Merge pull request #149 from mcode/dev
Dev
2 parents dbeed9b + ecb959c commit 0cee93a

11 files changed

Lines changed: 520 additions & 387 deletions

README.md

Lines changed: 71 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,95 +1,99 @@
1-
# rems-admin
1+
# Description
22

3-
## Running only the REMS server project locally
3+
The [REMS](https://www.fda.gov/drugs/drug-safety-and-availability/risk-evaluation-and-mitigation-strategies-rems) Admin application is an app that acts as a REMS Administrator in the REMS workflow. It receives [CDS Hooks](https://cds-hooks.org/) calls of the type order-sign, order-select, patient-view and encounter-start and returns CARDS containing links to relevant information and SMART Links to launch SMART on FHIR Apps. These links launch applications for completing forms needed to register the Patient, Provider, and Pharmacy in the REMS program as well as other necessary forms. The application also contains a built-in FHIR Server. This FHIR Server contains the Questionnaires, Libraries, CQL, and all other FHIR Resources needed to launch the [REMS SMART on FHIR App](https://github.com/mcode/rems-smart-on-fhir) Questionnaires. There is also a FHIR operation used for querying the REMS ETASU status.
44

5-
1. Clone the REMS repositories from GitHub:
6-
```bash
7-
git clone https://github.com/mcode/rems-admin.git rems-admin
8-
```
9-
2. Run dockerRunner.sh script
10-
```bash
11-
npm run start
12-
```
5+
# Getting Started with REMS Administrator
136

14-
### How To Override Defaults
7+
To get started, first clone the repository using a method that is most convenient for you. If using git, run the following command:
158

16-
The .env file contains the default URI paths, which can be overwritten from the start command as follows:
17-
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`.
9+
`git clone https://github.com/mcode/rems-admin.git`
1810

19-
> **Bug**: Do note that the `SMART_ENDPOINT` environment variable cannot be overwritten in a `.env.local`, it must be done in the `.env`.
11+
The following technologies must be installed on your computer to continue:
12+
* [NPM](https://www.npmjs.com/)
13+
* [Node](https://nodejs.org/en)
2014

21-
Following are a list of modifiable paths:
15+
## Initialization
2216

23-
| URI Name | Default | Description |
24-
| --------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------|
25-
| AUTH_SERVER_URI | `http://localhost:8090` | The base url of the auth server, currently set to the base url of this app. |
26-
| HTTPS_CERT_PATH | `server.cert` | Path to a certificate for encryption, allowing HTTPS. Unnecessary if using HTTP. |
27-
| HTTPS_KEY_PATH | `server.key` | Path to a key for encryption, allowing HTTPS. Unnecessary if using HTTP. |
28-
| LOGGING_LEVEL | `debug` | Amount to output in the log, can be changed to verbose, info, warn, or error. |
29-
| MONGO_DB_NAME | `remsadmin` | Name of the database table being used. Should be changed if not using the Mongo instructions below. |
30-
| MONGO_URL | `mongodb://rems-user:pass@127.0.0.1:27017` | URL for the connection to the database, should be changed if not using the Mongo instructions below. |
31-
| PORT | `8090` | Port that this server should run on, change if there are conflicts with port usage. |
32-
| RESOURCE_SERVER | `http://localhost:8090` | Base URL of this server, should match with port. |
33-
| SMART_ENDPOINT | `http://localhost:4040/launch` | Launch URL of associated SMART app, should be changed if not using the REMS Smart App. |
34-
| USE_HTTPS | `false` | Change to true to enable HTTPS. Ensure that HTTPS_CERT_PATH and HTTPS_KEY_PATH are valid. |
35-
| VSAC_API_KEY | `changeMe` | Replace with VSAC API key for pulling down ValueSets. Request an API Key from the [VSAC website](https://vsac.nlm.nih.gov/) |
36-
| WHITELIST | `http://localhost, http://localhost:3005` | List of valid URLs for CORS. Should include any URLs the server accesses for resources. |
17+
After cloning the repository, the submodules must be initialized. Run the following command:
18+
19+
### `git submodule update --init`
20+
21+
Next, install the required dependencies by running the following:
22+
23+
### `npm install`
3724

3825
## Running the Mongo DB instance
3926

40-
1. On the first run use the following command to create a Docker MongoDB instance:
27+
The REMS Administrator relies on MongoDB for it's backing database.
28+
Follow the mongodb setup instructions in the [REMS End to End Setup Guide](https://github.com/mcode/rems-setup/blob/main/EndToEndSetupGuide.md#mongodb).
4129

42-
```bash
43-
docker run --name rems_local_pims_remsadmin_mongo --expose 27017 -p 27017:27017 -e MONGO_INITDB_ROOT_USERNAME='rems-admin-pims-root' -e MONGO_INITDB_ROOT_PASSWORD='rems-admin-pims-password' -v rems_local_pims_remsadmin_mongo:/data/db -v "$(pwd)"/mongo-init.js:/docker-entrypoint-initdb.d/mongo-init.js mongo
44-
```
30+
If you would rather run with docker, follow the setup found in the [REMS Simple Setup Guide](https://github.com/mcode/rems-setup/blob/main/SimpleSetupGuide.md) (this will also setup the other REMS applications in docker as well).
4531

46-
To stop the running container, simply use Ctrl + C.
32+
## Available Scripts
4733

48-
2. On subsequent runs use the following command to start the existing mongo container:
49-
```bash
50-
docker start rems_local_pims_remsadmin_mongo
51-
```
52-
To stop the running container, simply run the below command
53-
```bash
54-
docker stop rems_local_pims_remsadmin_mongo
55-
```
34+
In the project directory, you can run:
5635

57-
# REMS Administrator
36+
### `npm start`
5837

59-
NOTE: The REMS Administrator is a work in progress.
38+
Runs the app in the development mode.\
39+
Open [http://localhost:8090/cds-services](http://localhost:8090/cds-services) to view the CDS Services discovery information in the browser.
6040

61-
## Running the REMS Administrator
41+
You will also see any lint errors in the console.
6242

63-
#### Initialization
43+
### `npm test`
6444

65-
After cloning the repository, the submodules must be initialized. To do this you can run:
45+
Launches the test runner in the interactive watch mode.\
46+
See the section about [running tests](https://create-react-app.dev/docs/running-tests/) for more information.
6647

67-
```
68-
git submodule update --init
69-
```
48+
## Usage
7049

71-
#### Setup
50+
The REMS Admin interacts with the [Request Generator](https://github.com/mcode/request-generator), [REMS SMART on FHIR app](https://github.com/mcode/rems-smart-on-fhir), and an [EHR](https://github.com/mcode/test-ehr). These apps are provided as part of the REMS ecosystem, but any individual part may be swapped out for something custom. The REMS Admin responds to CDS Hooks requests as well as FHIR operations for the questionnaire package ($questionnaire-package) and REMS ETASU check ($rems-etasu).
7251

73-
```
74-
npm install
75-
```
52+
Typically, a CDS Hook will be sent from the EHR to the REMS Admin, which will respond with cards that contain information about next steps. These cards may contain a link to a SMART app. Clicking on these links in the Request Generator or REMS SMART on FHIR App acting as the EHR will launch the SMART app automatically. These links will contain information on the requirements that must be met for the REMS program. This includes forms for registration and acknowledgement of the risks involved.
7653

77-
#### Run Tests
54+
The FHIR server built into the REMS Admin can be queried for the questionnaire package at the Questionnaire/$questionnaire-package endpoint. This will return a FHIR Bundle with the FHIR Questionnaire and all other FHIR Resources including CQL Libraries embedded within FHIR Libraries. The FHIR Server also contains a REMS ETASU check at the GuidanceResponse/$rems-etasu endpoint. This will return a FHIR Parameter containing a GuidanceResponse with the status of the ETATSU and nested GuidanceResponse for each requirement.
7855

79-
```
80-
npm test
81-
```
56+
## Routes
8257

83-
#### Run Application
58+
* `/cds-services` - The base CDS Hooks Discovery endpoint that serves a list of supported hooks/services in JSON.
59+
* `/cds-services/rems-order-sign` - The CDS Hooks endpoint for order-sign
60+
* `/cds-services/rems-order-select` - The CDS Hooks endpoint for order-select
61+
* `/cds-services/rems-patient-view` - The CDS Hooks endpoint for patient-view
62+
* `/cds-services/rems-encounter-start` - The CDS Hooks endpoint for encounter-start
63+
* `/4_0_0 - The base of the FHIR Server
64+
* `/4_0_0/GuidanceResponse/$rems-etasu` - The endpoint for FHIR Operation used for checking the ETASU status
65+
* Input requires a parameter containing the following:
66+
* `patient` - Patient FHIR Resource, must include `medication` with `patient`
67+
* `medication` - Medication or MedicationRequest FHIR Resource, must include `patient` with `medication`
68+
* `authNumber` - String containing the REMS Authorization Number, may be sent without `patient` or `medication`
69+
* Returns a GuidanceResponse within a Parameter with the status
70+
* Contains Nested GuidanceResponse resources for each ETASU requirement with their status
71+
* `/4_0_0/Questionnaire/\<form-name\>/$questionnaire-package` - The endpoint for the FHIR Operation used for retrieving the Questionnaire package for a given form
72+
* Example: /4_0_0/Questionnaire/TIRFRemsPatientEnrollment/$questionnaire-package
73+
* This includes the Questionnaire and any other necessary FHIR resources needed for loading the quesetionnaire form with the REMS SMART on FHIR app
8474

85-
```
86-
npm start
87-
```
75+
## Environment Variables
8876

89-
Application will be running on port 8090.
77+
### How To Override Defaults
78+
79+
The .env file contains the default URI paths, which can be overwritten from the start command as follows:
80+
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`.
81+
82+
> **Bug**: Do note that the `SMART_ENDPOINT` environment variable cannot be overwritten in a `.env.local`, it must be done in the `.env`.
9083
91-
To reach the CDS Services discovery information:
84+
Following are a list of modifiable paths:
9285

93-
```
94-
http://localhost:8090/cds-services
95-
```
86+
| URI Name | Default | Description |
87+
| --------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------|
88+
| AUTH_SERVER_URI | `http://localhost:8090` | The base url of the auth server, currently set to the base url of this app. |
89+
| HTTPS_CERT_PATH | `server.cert` | Path to a certificate for encryption, allowing HTTPS. Unnecessary if using HTTP. |
90+
| HTTPS_KEY_PATH | `server.key` | Path to a key for encryption, allowing HTTPS. Unnecessary if using HTTP. |
91+
| LOGGING_LEVEL | `debug` | Amount to output in the log, can be changed to verbose, info, warn, or error. |
92+
| MONGO_DB_NAME | `remsadmin` | Name of the database table being used. Should be changed if not using the Mongo instructions above. |
93+
| MONGO_URL | `mongodb://rems-user:pass@127.0.0.1:27017` | URL for the connection to the database, should be changed if not using the Mongo instructions above. |
94+
| PORT | `8090` | Port that this server should run on, change if there are conflicts with port usage. |
95+
| RESOURCE_SERVER | `http://localhost:8090` | Base URL of this server, should match with port. |
96+
| SMART_ENDPOINT | `http://localhost:4040/launch` | Launch URL of associated SMART app, should be changed if not using the REMS Smart App. |
97+
| USE_HTTPS | `false` | Change to true to enable HTTPS. Ensure that HTTPS_CERT_PATH and HTTPS_KEY_PATH are valid. |
98+
| VSAC_API_KEY | `changeMe` | Replace with VSAC API key for pulling down ValueSets. Request an API Key from the [VSAC website](https://vsac.nlm.nih.gov/) |
99+
| WHITELIST | `http://localhost, http://localhost:3005` | List of valid URLs for CORS. Should include any URLs the server accesses for resources. |

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"@types/chai": "^4.3.4",
5454
"@types/cors": "^2.8.12",
5555
"@types/express": "^4.17.14",
56+
"@types/flat": "^5.0.5",
5657
"@types/lodash": "^4.14.188",
5758
"@types/mocha": "^10.0.1",
5859
"@types/mongodb-memory-server": "2.3.0",

0 commit comments

Comments
 (0)