Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 0 additions & 156 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 5 additions & 14 deletions src/components/RequestBox/RequestBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useState } from 'react';
import buildNewRxRequest from '../../util/buildScript.2017071.js';
import MuiAlert from '@mui/material/Alert';
import Snackbar from '@mui/material/Snackbar';
import { shortNameMap, ORDER_SIGN, ORDER_SELECT, PATIENT_VIEW } from '../../util/data.js';
import { shortNameMap, ORDER_SIGN, PATIENT_VIEW } from '../../util/data.js';
import { getAge, createMedicationDispenseFromMedicationRequest } from '../../util/fhir.js';
import { retrieveLaunchContext, prepPrefetch } from '../../util/util.js';
import './request.css';
Expand All @@ -13,8 +13,7 @@ const RequestBox = props => {
const [state, setState] = useState({
gatherCount: 0,
response: {},
submittedRx: false,
prefetchCompleted: false
submittedRx: false
});

const {
Expand All @@ -30,21 +29,14 @@ const RequestBox = props => {
smartAppUrl,
client,
pimsUrl,
prefetchCompleted,
getRemsAdminUrl
prefetchCompleted
} = props;
const emptyField = <span className="empty-field">empty</span>;

const submitPatientView = () => {
submitInfo(prepPrefetch(prefetchedResources), null, patient, PATIENT_VIEW);
};

const _submitOrderSelect = () => {
if (!_.isEmpty(request)) {
submitInfo(prepPrefetch(prefetchedResources), request, patient, ORDER_SELECT);
}
};

const submitOrderSign = request => {
if (!_.isEmpty(request)) {
submitInfo(prepPrefetch(prefetchedResources), request, patient, ORDER_SIGN);
Expand All @@ -53,13 +45,13 @@ const RequestBox = props => {

useEffect(() => {
// if prefetch completed
if (props.prefetchCompleted) {
if (prefetchCompleted) {
// if the prefetch contains a medicationRequests bundle
if (prefetchedResources.medicationRequests) {
submitPatientView();
}
}
}, [props.prefetchCompleted]);
}, [prefetchCompleted]);

const renderPatientInfo = () => {
if (Object.keys(patient).length === 0) {
Expand Down Expand Up @@ -264,7 +256,6 @@ const RequestBox = props => {
const disableSendToCRD = isOrderNotSelected() || loading;
const disableSendRx = isOrderNotSelected() || loading;
const disableLaunchSmartOnFhir = isPatientNotSelected();
const orderSignRemsAdmin = getRemsAdminUrl(request, ORDER_SIGN);

return (
<>
Expand Down
10 changes: 3 additions & 7 deletions src/containers/RequestBuilder.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,6 @@ const RequestBuilder = props => {
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);
}
Expand Down Expand Up @@ -204,8 +202,9 @@ const RequestBuilder = props => {
if (response?.url?.includes(PATIENT_VIEW)) {
// copy the cards from the old response into the new
setState(prevState => ({
...prevState, response: { cards: [...(prevState.response.cards || []), ...fhirResponse.cards] }
}));
...prevState,
response: { cards: [...(prevState.response.cards || []), ...fhirResponse.cards] }
}));
} else {
setState(prevState => ({ ...prevState, response: fhirResponse }));
}
Expand Down Expand Up @@ -344,9 +343,6 @@ const RequestBuilder = props => {
loading={state.loading}
patientFhirQuery={globalState.patientFhirQuery}
prefetchCompleted={state.prefetchCompleted}
getRemsAdminUrl={(request, hook) =>
getMedicationSpecificRemsAdminUrl(request, globalState, hook)
}
/>
</Grid>
)}
Expand Down
1 change: 1 addition & 0 deletions src/util/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down