From b1cf1ba7511b8125a03b5f03db0f75c5403ee971 Mon Sep 17 00:00:00 2001 From: Patrick LaRocque Date: Thu, 11 Apr 2024 00:56:56 -0400 Subject: [PATCH 01/15] Fix patient-view and allow it to work with new rems-admin lookup table. --- src/components/RequestBox/RequestBox.jsx | 33 ++++---------- src/components/SMARTBox/PatientBox.jsx | 1 + src/containers/RequestBuilder.jsx | 56 ++++++++++++++++++++++-- src/util/util.js | 23 +++++++++- 4 files changed, 85 insertions(+), 28 deletions(-) diff --git a/src/components/RequestBox/RequestBox.jsx b/src/components/RequestBox/RequestBox.jsx index 4765b33..2b59035 100644 --- a/src/components/RequestBox/RequestBox.jsx +++ b/src/components/RequestBox/RequestBox.jsx @@ -6,14 +6,15 @@ import MuiAlert from '@mui/material/Alert'; import Snackbar from '@mui/material/Snackbar'; import { shortNameMap } from '../../util/data.js'; import { getAge, createMedicationDispenseFromMedicationRequest } from '../../util/fhir.js'; -import { retrieveLaunchContext } from '../../util/util.js'; +import { retrieveLaunchContext, prepPrefetch } from '../../util/util.js'; import './request.css'; const RequestBox = props => { const [state, setState] = useState({ gatherCount: 0, response: {}, - submittedRx: false + submittedRx: false, + prefetchCompleted: false }); const { @@ -29,52 +30,36 @@ const RequestBox = props => { smartAppUrl, client, pimsUrl, + prefetchCompleted, getRemsAdminUrl } = props; const emptyField = empty; - const prepPrefetch = () => { - const preppedResources = new Map(); - Object.keys(prefetchedResources).forEach(resourceKey => { - let resourceList = []; - if (Array.isArray(prefetchedResources[resourceKey])) { - resourceList = prefetchedResources[resourceKey].map(resource => { - return resource; - }); - } else { - resourceList = prefetchedResources[resourceKey]; - } - - preppedResources.set(resourceKey, resourceList); - }); - return preppedResources; - }; - const submitPatientView = () => { - submitInfo(prepPrefetch(), null, patient, 'patient-view'); + submitInfo(prepPrefetch(prefetchedResources), null, patient, 'patient-view'); }; const _submitOrderSelect = () => { if (!_.isEmpty(request)) { - submitInfo(prepPrefetch(), request, patient, 'order-select'); + submitInfo(prepPrefetch(prefetchedResources), request, patient, 'order-select'); } }; const submitOrderSign = request => { if (!_.isEmpty(request)) { - submitInfo(prepPrefetch(), request, patient, 'order-sign'); + submitInfo(prepPrefetch(prefetchedResources), request, patient, 'order-sign'); } }; useEffect(() => { // if prefetch completed - if (state.prefetchCompleted) { + if (props.prefetchCompleted) { // if the prefetch contains a medicationRequests bundle if (prefetchedResources.medicationRequests) { submitPatientView(); } } - }, [state.prefetchCompleted]); + }, [props.prefetchCompleted]); const renderPatientInfo = () => { if (Object.keys(patient).length === 0) { diff --git a/src/components/SMARTBox/PatientBox.jsx b/src/components/SMARTBox/PatientBox.jsx index d200735..885252c 100644 --- a/src/components/SMARTBox/PatientBox.jsx +++ b/src/components/SMARTBox/PatientBox.jsx @@ -278,6 +278,7 @@ const PatientBox = props => { response: '' })); callback('response', ''); + clearCallback(); // update prefetch request for the medication const request = JSON.parse(data); if ( diff --git a/src/containers/RequestBuilder.jsx b/src/containers/RequestBuilder.jsx index 60bdb5a..ca53471 100644 --- a/src/containers/RequestBuilder.jsx +++ b/src/containers/RequestBuilder.jsx @@ -8,7 +8,7 @@ import RequestBox from '../components/RequestBox/RequestBox.jsx'; import buildRequest from '../util/buildRequest.js'; import { types } from '../util/data.js'; import { createJwt } from '../util/auth.js'; -import { getMedicationSpecificRemsAdminUrl } from '../util/util.js'; +import { getMedicationSpecificRemsAdminUrl, prepPrefetch } from '../util/util.js'; import Accordion from '@mui/material/Accordion'; import AccordionSummary from '@mui/material/AccordionSummary'; @@ -40,7 +40,9 @@ const RequestBuilder = props => { token: null, client: client, medicationDispense: null, - lastCheckedMedicationTime: null + lastCheckedMedicationTime: null, + prefetchCompleted: false, + medicationRequests: {} }); const displayRequestBox = !!globalState.patient?.id; @@ -101,9 +103,56 @@ const RequestBuilder = props => { } }; + const getMedicationRequests = patientId => { + client + .request(`MedicationRequest?subject=Patient/${patientId}`, { + resolveReferences: ['subject', 'performer', 'medicationReference'], + graph: false, + flat: true + }) + .then(result => { + setState(prevState => ({ ...prevState, medicationRequests: result })); + }); + }; + + + useEffect(() => { + const hook = 'patient-view'; + + let remsAdminUrls = []; + // get all the remsAdminUrl for each MedicationRequest + state.medicationRequests?.data?.forEach(request => { + const code = request?.medicationCodeableConcept?.coding[0]?.code; + const remsAdminUrl = getMedicationSpecificRemsAdminUrl(request, globalState, hook); + if (remsAdminUrl) { + remsAdminUrls.push(remsAdminUrl); + } + //sendHook(prefetch, request, patient, hook, remsAdminUrl); + }); + const uniqueUrls = [... new Set(remsAdminUrls.map(item => item))]; + + uniqueUrls?.forEach(url => { + sendHook(prepPrefetch(state.prefetchedResources), null, globalState.patient, hook, url); + //TODO: still need to handle multiple sends and multiple cards coming back + }); + + }, [state.medicationRequests]); + const submitInfo = (prefetch, request, patient, hook) => { console.log('Initiating form submission ', types.info); - const remsAdminUrl = getMedicationSpecificRemsAdminUrl(request, globalState, hook); + let remsAdminUrl = null; + if (request) { + remsAdminUrl = getMedicationSpecificRemsAdminUrl(request, globalState, hook); + sendHook(prefetch, request, patient, hook, remsAdminUrl); + } else { + // grab all of the REMS admins for the medications for this patient + + // get all MedicationRequests for the patient, then continue + getMedicationRequests(patient.id); + } + }; + + const sendHook = (prefetch, request, patient, hook, remsAdminUrl) => { setState(prevState => ({ ...prevState, @@ -292,6 +341,7 @@ const RequestBuilder = props => { defaultUser={globalState.defaultUser} loading={state.loading} patientFhirQuery={globalState.patientFhirQuery} + prefetchCompleted={state.prefetchCompleted} getRemsAdminUrl={(request, hook) => getMedicationSpecificRemsAdminUrl(request, globalState, hook) } diff --git a/src/util/util.js b/src/util/util.js index 44b9286..f494e61 100644 --- a/src/util/util.js +++ b/src/util/util.js @@ -92,6 +92,10 @@ function standardsBasedGetEtasu(etasuUrl, body, responseCallback) { } const getMedicationSpecificRemsAdminUrl = (request, globalState, hook) => { + // if empty request, just return + if (Object.keys(request).length === 0) { + return undefined; + } const display = request.medicationCodeableConcept?.coding?.[0]?.display; const rxnorm = request.medicationCodeableConcept?.coding?.[0]?.code; @@ -117,4 +121,21 @@ const getMedicationSpecificRemsAdminUrl = (request, globalState, hook) => { return cdsUrl; }; -export { retrieveLaunchContext, standardsBasedGetEtasu, getMedicationSpecificRemsAdminUrl }; +const prepPrefetch = (prefetchedResources) => { + const preppedResources = new Map(); + Object.keys(prefetchedResources).forEach(resourceKey => { + let resourceList = []; + if (Array.isArray(prefetchedResources[resourceKey])) { + resourceList = prefetchedResources[resourceKey].map(resource => { + return resource; + }); + } else { + resourceList = prefetchedResources[resourceKey]; + } + + preppedResources.set(resourceKey, resourceList); + }); + return preppedResources; +}; + +export { retrieveLaunchContext, standardsBasedGetEtasu, getMedicationSpecificRemsAdminUrl, prepPrefetch }; From 4e332cc68f58668ea02fbb46374c8d6d1236c335 Mon Sep 17 00:00:00 2001 From: Ariel Virgulto Date: Wed, 17 Apr 2024 11:24:16 -0400 Subject: [PATCH 02/15] Setup toggle in settings for encounter start --- .env | 3 ++- .../RequestDashboard/SettingsSection.jsx | 23 ++++++++++++++++++- src/containers/RequestBuilder.jsx | 2 +- src/util/data.js | 17 ++++++++++---- src/util/util.js | 2 +- 5 files changed, 39 insertions(+), 8 deletions(-) diff --git a/.env b/.env index 75e6c54..2b9c27f 100644 --- a/.env +++ b/.env @@ -24,5 +24,6 @@ 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 +VITE_HOOK_TO_SEND = patient-view +VITE_URL_FILTER = http://localhost:3000/* diff --git a/src/components/RequestDashboard/SettingsSection.jsx b/src/components/RequestDashboard/SettingsSection.jsx index 0c8b010..36e6b88 100644 --- a/src/components/RequestDashboard/SettingsSection.jsx +++ b/src/components/RequestDashboard/SettingsSection.jsx @@ -15,6 +15,8 @@ import { TableContainer, TableHead, TableRow, + ToggleButton, + ToggleButtonGroup, Tooltip, TextField } from '@mui/material'; @@ -28,7 +30,7 @@ import { headerDefinitions, medicationRequestToRemsAdmins } from '../../util/dat import { actionTypes, initialState } from '../../containers/ContextProvider/reducer'; import { SettingsContext } from '../../containers/ContextProvider/SettingsProvider'; -const CDS_HOOKS = ['order-sign', 'order-select', 'patient-view']; +const CDS_HOOKS = ['order-sign', 'order-select', 'patient-view', 'encounter-start']; const SettingsSection = props => { const [state, dispatch] = React.useContext(SettingsContext); @@ -251,6 +253,25 @@ const SettingsSection = props => { ); + case 'toggle': + return ( + + +

Hook to send when selecting a patient:

+ updateSetting(key, event.target.value)} + aria-label="hook" + > + patient-view + encounter-start + +
+
+ + ) default: return (
diff --git a/src/containers/RequestBuilder.jsx b/src/containers/RequestBuilder.jsx index ca53471..375bbc1 100644 --- a/src/containers/RequestBuilder.jsx +++ b/src/containers/RequestBuilder.jsx @@ -117,7 +117,7 @@ const RequestBuilder = props => { useEffect(() => { - const hook = 'patient-view'; + const hook = globalState.hookToSend; let remsAdminUrls = []; // get all the remsAdminUrl for each MedicationRequest diff --git a/src/util/data.js b/src/util/data.js index d308619..018b40a 100644 --- a/src/util/data.js +++ b/src/util/data.js @@ -75,6 +75,11 @@ const headerDefinitions = { display: 'REMS Admin Server', type: 'input', default: env.get('VITE_SERVER').asString() + }, + hookToSend: { + display: 'Send hook on patient select', + type: 'toggle', + default: env.get('VITE_HOOK_TO_SEND').asString() } }; @@ -85,7 +90,8 @@ const medicationRequestToRemsAdmins = Object.freeze([ hookEndpoints: [ { hook: 'order-sign', remsAdmin: 'http://localhost:8090/cds-services/rems-order-sign' }, { hook: 'order-select', remsAdmin: 'http://localhost:8090/cds-services/rems-order-select' }, - { hook: 'patient-view', remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' } + { hook: 'patient-view', remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' }, + { hook: 'encounter-start', remsAdmin: 'http://localhost:8090/cds-services/rems-encounter-start' } ] }, { @@ -94,7 +100,8 @@ const medicationRequestToRemsAdmins = Object.freeze([ hookEndpoints: [ { hook: 'order-sign', remsAdmin: 'http://localhost:8090/cds-services/rems-order-sign' }, { hook: 'order-select', remsAdmin: 'http://localhost:8090/cds-services/rems-order-select' }, - { hook: 'patient-view', remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' } + { hook: 'patient-view', remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' }, + { hook: 'encounter-start', remsAdmin: 'http://localhost:8090/cds-services/rems-encounter-start' } ] }, { @@ -103,7 +110,8 @@ const medicationRequestToRemsAdmins = Object.freeze([ hookEndpoints: [ { hook: 'order-sign', remsAdmin: 'http://localhost:8090/cds-services/rems-order-sign' }, { hook: 'order-select', remsAdmin: 'http://localhost:8090/cds-services/rems-order-select' }, - { hook: 'patient-view', remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' } + { hook: 'patient-view', remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' }, + { hook: 'encounter-start', remsAdmin: 'http://localhost:8090/cds-services/rems-encounter-start' } ] }, { @@ -112,7 +120,8 @@ const medicationRequestToRemsAdmins = Object.freeze([ hookEndpoints: [ { hook: 'order-sign', remsAdmin: 'http://localhost:8090/cds-services/rems-order-sign' }, { hook: 'order-select', remsAdmin: 'http://localhost:8090/cds-services/rems-order-select' }, - { hook: 'patient-view', remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' } + { hook: 'patient-view', remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' }, + { hook: 'encounter-start', remsAdmin: 'http://localhost:8090/cds-services/rems-encounter-start' } ] } ]); diff --git a/src/util/util.js b/src/util/util.js index f494e61..663c039 100644 --- a/src/util/util.js +++ b/src/util/util.js @@ -104,7 +104,7 @@ const getMedicationSpecificRemsAdminUrl = (request, globalState, hook) => { return undefined; } - if (!(hook === 'patient-view' || hook === 'order-sign' || hook === 'order-select')) { + if (!(hook === 'patient-view' || hook === 'order-sign' || hook === 'order-select' || hook === 'encounter-start')) { console.log(`ERROR: unknown hook type: ${hook}`); return undefined; } From bd9fb2e5c3c661c703d5a7764dc54c0c3c9a257c Mon Sep 17 00:00:00 2001 From: Ariel Virgulto Date: Mon, 22 Apr 2024 21:59:04 -0400 Subject: [PATCH 03/15] Update to a dropdown --- .../RequestDashboard/SettingsSection.jsx | 42 +++++++++++-------- src/util/data.js | 2 +- 2 files changed, 25 insertions(+), 19 deletions(-) diff --git a/src/components/RequestDashboard/SettingsSection.jsx b/src/components/RequestDashboard/SettingsSection.jsx index 36e6b88..8956ccb 100644 --- a/src/components/RequestDashboard/SettingsSection.jsx +++ b/src/components/RequestDashboard/SettingsSection.jsx @@ -1,11 +1,12 @@ -import React, { memo, useState, useEffect } from 'react'; +import React, { memo, useEffect } from 'react'; import { - Box, Button, Checkbox, FormControlLabel, + FormControl, Grid, IconButton, + InputLabel, Paper, Select, MenuItem, @@ -15,8 +16,6 @@ import { TableContainer, TableHead, TableRow, - ToggleButton, - ToggleButtonGroup, Tooltip, TextField } from '@mui/material'; @@ -253,22 +252,29 @@ const SettingsSection = props => { ); - case 'toggle': + case 'dropdown': return ( - -

Hook to send when selecting a patient:

- updateSetting(key, event.target.value)} - aria-label="hook" - > - patient-view - encounter-start - -
+ + + Hook to send when selecting a patient + + + +
) diff --git a/src/util/data.js b/src/util/data.js index 018b40a..708cd46 100644 --- a/src/util/data.js +++ b/src/util/data.js @@ -78,7 +78,7 @@ const headerDefinitions = { }, hookToSend: { display: 'Send hook on patient select', - type: 'toggle', + type: 'dropdown', default: env.get('VITE_HOOK_TO_SEND').asString() } }; From cf8ff6005b96d2f50b97c0ad3db7a7efd66b9a6f Mon Sep 17 00:00:00 2001 From: Ariel Virgulto Date: Tue, 23 Apr 2024 10:29:29 -0400 Subject: [PATCH 04/15] Fix label to be more visible --- src/components/RequestDashboard/SettingsSection.jsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/RequestDashboard/SettingsSection.jsx b/src/components/RequestDashboard/SettingsSection.jsx index 8956ccb..46058a4 100644 --- a/src/components/RequestDashboard/SettingsSection.jsx +++ b/src/components/RequestDashboard/SettingsSection.jsx @@ -262,6 +262,7 @@ const SettingsSection = props => { labelId="dropdown-label" id="dropdown" value={state[key]} + label="Hook to send when selecting a patient" onChange={event => updateSetting(key, event.target.value)} sx={{ width: '100%' }} > From e068a47cb52186ecf4e8a049ffa14d2627a0dfef Mon Sep 17 00:00:00 2001 From: KeeyanGhoreshi Date: Tue, 7 May 2024 16:56:20 -0400 Subject: [PATCH 05/15] add auth num --- src/components/Dashboard/Dashboard.jsx | 2 +- .../ListSelections/NotificationsSection.jsx | 131 ++++++++++-------- src/components/EtasuStatus/EtasuStatus.jsx | 25 ++-- .../EtasuStatus/EtasuStatusButton.jsx | 5 +- .../EtasuStatus/EtasuStatusComponent.jsx | 19 ++- .../EtasuStatus/EtasuStatusModal.jsx | 120 +++++++++------- src/containers/RequestBuilder.jsx | 5 +- src/util/util.js | 17 ++- 8 files changed, 177 insertions(+), 147 deletions(-) diff --git a/src/components/Dashboard/Dashboard.jsx b/src/components/Dashboard/Dashboard.jsx index 05f626a..e6b3dda 100644 --- a/src/components/Dashboard/Dashboard.jsx +++ b/src/components/Dashboard/Dashboard.jsx @@ -81,7 +81,7 @@ const Dashboard = props => { case Section.MEDICATIONS: return ; case Section.NOTIFICATIONS: - return + return ; default: return ; } diff --git a/src/components/Dashboard/ListSelections/NotificationsSection.jsx b/src/components/Dashboard/ListSelections/NotificationsSection.jsx index b36bdcc..306982d 100644 --- a/src/components/Dashboard/ListSelections/NotificationsSection.jsx +++ b/src/components/Dashboard/ListSelections/NotificationsSection.jsx @@ -7,76 +7,85 @@ import { createMedicationFromMedicationRequest } from '../../../util/fhir'; import { standardsBasedGetEtasu } from '../../../util/util'; const NotificationsSection = () => { - const [globalState, _] = useContext(SettingsContext); - const classes = useStyles(); - const [etasu, setEtasu] = useState([]); - const [medications, setMedications] = useState([]); - useEffect(() => { - setEtasu([]); - getMedicationRequest(); - }, []); + const [globalState, _] = useContext(SettingsContext); + const classes = useStyles(); + const [etasu, setEtasu] = useState([]); + const [medications, setMedications] = useState([]); + useEffect(() => { + setEtasu([]); + getMedicationRequest(); + }, []); - useEffect(() => { - getAllEtasu(); - }, [medications]); + useEffect(() => { + getAllEtasu(); + }, [medications]); - const getMedicationRequest = () => { - const patientsMedications = []; - axios({ - method: 'get', - url: `${globalState.baseUrl}/MedicationRequest?subject=Patient/${globalState.patient.id}` - }).then((result) => { - result?.data.entry.forEach((m) => { - const medication = createMedicationFromMedicationRequest(m.resource); - patientsMedications.push(medication); - }) - setMedications(patientsMedications); - }, (error) =>{ - console.error(error); + const getMedicationRequest = () => { + const patientsMedications = []; + axios({ + method: 'get', + url: `${globalState.baseUrl}/MedicationRequest?subject=Patient/${globalState.patient.id}` + }).then( + result => { + result?.data.entry.forEach(m => { + const medication = createMedicationFromMedicationRequest(m.resource); + patientsMedications.push(medication); }); - }; + setMedications(patientsMedications); + }, + error => { + console.error(error); + } + ); + }; - const compileResponses = (newRequest, body) => { - if (newRequest.contained) { - newRequest.body = body; - setEtasu(prevState => [ ...prevState, newRequest]); - } + const compileResponses = (newRequest, body) => { + if (newRequest.contained) { + newRequest.body = body; + setEtasu(prevState => [...prevState, newRequest]); } + }; - const getAllEtasu = () => { - medications.forEach((medication) => { - const body = makeBody(medication); - const standardEtasuUrl = `${globalState.remsAdminServer}/4_0_0/GuidanceResponse/$rems-etasu`; - standardsBasedGetEtasu(standardEtasuUrl, body, compileResponses); - }); - - } + const getAllEtasu = () => { + medications.forEach(medication => { + const body = makeBody(medication); + const standardEtasuUrl = `${globalState.remsAdminServer}/4_0_0/GuidanceResponse/$rems-etasu`; + standardsBasedGetEtasu(standardEtasuUrl, body, compileResponses); + }); + }; - const makeBody = (medication) => { - return { - resourceType: "Parameters", - parameter: [ - { - name: 'patient', - resource: globalState.patient - }, - { - name: 'medication', - resource: medication - } - ] + const makeBody = medication => { + return { + resourceType: 'Parameters', + parameter: [ + { + name: 'patient', + resource: globalState.patient + }, + { + name: 'medication', + resource: medication } - } + ] + }; + }; - return ( -
-

Notifications

- {etasu.map((remsCase) => { - const display = remsCase.body.parameter[1]?.resource.code.coding[0].display; - return - })} -
- ); + return ( +
+

Notifications

+ {etasu.map(remsCase => { + const display = remsCase.body.parameter[1]?.resource.code.coding[0].display; + return ( + + ); + })} +
+ ); }; export default memo(NotificationsSection); diff --git a/src/components/EtasuStatus/EtasuStatus.jsx b/src/components/EtasuStatus/EtasuStatus.jsx index 97417ab..a7837dd 100644 --- a/src/components/EtasuStatus/EtasuStatus.jsx +++ b/src/components/EtasuStatus/EtasuStatus.jsx @@ -14,26 +14,24 @@ export const EtasuStatus = props => { const [etasuData, setEtasuData] = useState({}); const [display, setDisplay] = useState(''); - useEffect(() => { + useEffect(() => { const medication = createMedicationFromMedicationRequest(request); getEtasuStatus(medication); }, [code]); - const getEtasuStatus = (medication) => { + const getEtasuStatus = medication => { const body = makeBody(medication); setEtasuData(body); const display = body.parameter[1]?.resource.code.coding[0].display; setDisplay(display); const standardEtasuUrl = `${globalState.remsAdminServer}/4_0_0/GuidanceResponse/$rems-etasu`; standardsBasedGetEtasu(standardEtasuUrl, body, setRemsAdminResponse); - }; - - const makeBody = (medication) => { + const makeBody = medication => { console.log('patient -- > ', globalState.patient); return { - resourceType: "Parameters", + resourceType: 'Parameters', parameter: [ { name: 'patient', @@ -44,13 +42,20 @@ export const EtasuStatus = props => { resource: medication } ] - } - } + }; + }; return ( <> - {remsAdminResponse.contained ? : ""} + {remsAdminResponse.contained ? ( + + ) : ( + '' + )} ); }; - diff --git a/src/components/EtasuStatus/EtasuStatusButton.jsx b/src/components/EtasuStatus/EtasuStatusButton.jsx index ed87d7c..cff24ef 100644 --- a/src/components/EtasuStatus/EtasuStatusButton.jsx +++ b/src/components/EtasuStatus/EtasuStatusButton.jsx @@ -3,8 +3,7 @@ import ListIcon from '@mui/icons-material/List'; import './EtasuStatusButton.css'; export const EtasuStatusButton = props => { - const { baseColor, remsAdminResponse, handleOpenEtasuStatus, lastCheckedEtasuTime } = - props; + const { baseColor, remsAdminResponse, handleOpenEtasuStatus, lastCheckedEtasuTime } = props; return ( + + + ); }); } // -- Links -- - let linksSection; + let linksSection = []; if (card.links) { card.links = modifySmartLaunchUrls(card) || card.links; - linksSection = card.links.map((link, ind) => { + card.links.map((link, ind) => { if (link.type === 'smart') { - return ( - + linksSection.push( + + + + ); + } + }); + } + + let documentationSection = []; + const pdfIcon = ; + if (card.links) { + card.links = modifySmartLaunchUrls(card) || card.links; + card.links.map((link, ind) => { + if (link.type === 'absolute') { + documentationSection.push( + + + + + ); } - const pdfIcon = ; - return ( - - ); }); } const cardSectionHeaderStyle = { marginBottom: '2px', color: 'black' }; const builtCard = ( - - - - - Summary - - - {summarySection} - -
- - Details - - {detailSection} -
- - {sourceSection} - -
- {linksSection} - {suggestionsSection} -
+ + + + + + {summarySection} + + + {/* Forms */} + {linksSection.length !== 0 ? ( +
+ Required Forms + {detailSection} + {linksSection} +
+ ) : ( + <> + )} + + {/* Suggestions */} + {suggestionsSection.length !== 0 ? ( +
+ + Suggestions + + {suggestionsSection} +
+ ) : ( + <> + )} + + {/* Documentation and Guides */} + {documentationSection.length !== 0 ? ( + + }> + + View documentation and guides + + + + {documentationSection} + + + ) : ( + <> + )} + + + {sourceSection} + +
+
+
); From 7a0b26694fc027d9b8897b5a410b4c458dc41583 Mon Sep 17 00:00:00 2001 From: Joyce Quach Date: Mon, 20 May 2024 12:16:11 -0400 Subject: [PATCH 15/15] Add comment about patient-view hook --- src/util/util.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/util.js b/src/util/util.js index d6c182d..1373afa 100644 --- a/src/util/util.js +++ b/src/util/util.js @@ -110,6 +110,7 @@ const getMedicationSpecificRemsAdminUrl = (request, globalState, hook) => { return undefined; } + // This function never gets called with the PATIENT_VIEW hook, however. if (!(hook === PATIENT_VIEW || hook === ORDER_SIGN || hook === ORDER_SELECT || hook === ENCOUNTER_START)) { console.log(`ERROR: unknown hook type: ${hook}`); return undefined;