Skip to content

Commit

Permalink
Merge pull request #119 from mcode/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
smalho01 authored Apr 8, 2024
2 parents 4e95146 + 0e34aef commit f3c4e5f
Show file tree
Hide file tree
Showing 65 changed files with 21,691 additions and 17,650 deletions.
53 changes: 25 additions & 28 deletions .env
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
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
VITE_ALT_DRUG = true
VITE_AUTH = http://localhost:8180
VITE_CDS_SERVICE = http://localhost:8090/etasu/reset
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
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ src/db.json

# Environment variable files
.env.local

# Mac OS files
**/.DS_Store
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM node:14-alpine
FROM node:21-alpine

WORKDIR /home/node/app/request-generator
COPY --chown=node:node . .
RUN npm install
COPY --chown=node:node . .
EXPOSE 3000
COPY --chown=node:node . .

CMD npm run start
3 changes: 1 addition & 2 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
FROM node:14-alpine
FROM node:21-alpine
WORKDIR /home/node/app/request-generator
COPY --chown=node:node . .
RUN npm install
EXPOSE 3000
EXPOSE 3001
CMD ./dockerRunnerDev.sh
20 changes: 10 additions & 10 deletions How-To-Launch-SMART-on-FHIR-Apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,31 @@ SMART_ENDPOINT = https://smartlauncher.interop.community/sample-app/launch?clien
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
VITE_CLIENT = ed8b940e-4aaa-4209-b17d-69dfe67543b9
VITE_EHR_BASE = https://gw.interop.community/REMS/data
VITE_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH = https://gw.interop.community/REMS/data
VITE_EHR_SERVER = https://gw.interop.community/REMS/data
VITE_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\*.
1. `VITE_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. `VITE_EHR_BASE`, `VITE_EHR_SERVER_TO_BE_SENT_TO_REMS_ADMIN_FOR_PREFETCH`, `VITE_EHR_SERVER`: These are taken from your Meld sandbox's sidebar, under Settings > Sandbox > Secured FHIR Server URL.
3. `VITE_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.
5. Click the "Launch SMART on FHIR app" button. This opens the SMART on FHIR app launch page provided as values to the `VITE_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.
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 `VITE_SMART_LAUNCH_URL` and `SMART_ENDPOINT` environment variables.
67 changes: 37 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ This project provides a small web application that is capable of generating requ

- `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.
This should open a browser window directed to the value set in `VITE_URL` followed by the string `/request-generator`. The request-generator assumes the REMS Admin is running on the default value set for `VITE_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.

## Running with docker

Run the following commands

- `docker build -t reqgen .`
- `docker run -p 3000:3000 reqgen`

## Keys

Expand All @@ -31,7 +38,7 @@ Embedded in the application are the public and private keys used to generate and
### How To Override Defaults

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`.
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:

Expand All @@ -40,34 +47,34 @@ Following are a list of modifiable paths:
| 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` |
| 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

Expand Down
7 changes: 4 additions & 3 deletions public/index.html → index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
manifest.json provides metadata used when your web app is added to the
homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico">
<link rel="manifest" href="manifest.json">
<link rel="shortcut icon" href="favicon.ico">
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

Expand All @@ -35,14 +35,15 @@
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
You can add web fonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
<script src="https://cdn.jsdelivr.net/npm/fhirclient/build/fhir-client.js">
</script>
<script type="module" src="/src/index.jsx"></script>
</body>


Expand Down
Loading

0 comments on commit f3c4e5f

Please sign in to comment.