Skip to content

Commit

Permalink
remove extra logs and update cors policy
Browse files Browse the repository at this point in the history
  • Loading branch information
smalho01 committed Jan 21, 2025
1 parent 097a95f commit 93beb4f
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ MONGO_URL = mongodb://intermediary-user:[email protected]:27017
PORT = 3003
SMART_ENDPOINT = http://localhost:4040/launch
USE_HTTPS = false
WHITELIST = http://localhost, http://localhost:3005
WHITELIST = *
VITE_REALM = ClientFhirServer
VITE_AUTH = http://localhost:8180
FRONTEND_VITE_AUTH = http://localhost:8180
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://create-react-app.dev/docs/running-tests/) for more information.

## Usage

zzzz
The REMS Intermediary 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 the FHIR operation for the REMS ETASU check ($rems-etasu).

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 a 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. The REMS Intermediary stands in between the REMS Admin and CDS Hooks client. It receives the hooks call from the EHR (client), performs the prefetch on the data if necessary, and forwards the request to the appropriate REMS Administrator with the FHIR Authorization information stripped out. The return from these calls are forwarded back to the original client. This allows the client to only know about the intermediary for the REMS interactions, simplifying registration. The SMART on FHIR apps from each REMS Administration will however still need to be registered with each EHR.
Expand Down
6 changes: 0 additions & 6 deletions src/hooks/hookResources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,24 +97,18 @@ export async function handleHook(
const drugCode = getDrugCodeFromMedicationRequest(contextRequest);

const forwardData = (hook: Hook, url: string) => {
console.log('zzzz forwardData: ');
console.log(url); //zzzz
console.log(hook); //zzzz
// remove the auth token before any forwarding occurs
delete hook.fhirAuthorization;
const options = {
method: 'POST',
data: hook,
timeout: 5000,
};

console.log(url); //zzzz
const response = axios(url, options);
response.then(e => {
res.json(e.data);
})
.catch(err => {
console.log('zzzz: error in forwardData call:');
console.log(err);
res.json({ cards: [] }); // Return fallback response
});
Expand Down

0 comments on commit 93beb4f

Please sign in to comment.