-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from mcode/rems-admin-lookup-table
Send hook depending on medication & handle multiple REMS admins with patient-view hook
- Loading branch information
Showing
8 changed files
with
209 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule cds-hooks
updated
3 files
+1 −1 | prefetch/PrefetchHydrator.ts | |
+31 −0 | resources/EncounterStart.ts | |
+18 −1 | resources/HookTypes.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { SupportedHooks } from '../cds-hooks/resources/HookTypes'; | ||
|
||
export const medicationRequestToRemsAdmins = Object.freeze([ | ||
{ | ||
rxnorm: 2183126, | ||
display: 'Turalio 200 MG Oral Capsule', | ||
hookEndpoints: [ | ||
{ | ||
hook: SupportedHooks.ORDER_SIGN, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-order-sign' | ||
}, | ||
{ | ||
hook: SupportedHooks.ORDER_SELECT, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-order-select' | ||
}, | ||
{ | ||
hook: SupportedHooks.PATIENT_VIEW, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' | ||
}, | ||
{ | ||
hook: SupportedHooks.ENCOUNTER_START, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-encounter-start' | ||
} | ||
] | ||
}, | ||
{ | ||
rxnorm: 6064, | ||
display: 'Isotretinoin 20 MG Oral Capsule', | ||
hookEndpoints: [ | ||
{ | ||
hook: SupportedHooks.ORDER_SIGN, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-order-sign' | ||
}, | ||
{ | ||
hook: SupportedHooks.ORDER_SELECT, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-order-select' | ||
}, | ||
{ | ||
hook: SupportedHooks.PATIENT_VIEW, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' | ||
}, | ||
{ | ||
hook: SupportedHooks.ENCOUNTER_START, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-encounter-start' | ||
} | ||
] | ||
}, | ||
{ | ||
rxnorm: 1237051, | ||
display: 'TIRF 200 UG Oral Transmucosal Lozenge', | ||
hookEndpoints: [ | ||
{ | ||
hook: SupportedHooks.ORDER_SIGN, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-order-sign' | ||
}, | ||
{ | ||
hook: SupportedHooks.ORDER_SELECT, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-order-select' | ||
}, | ||
{ | ||
hook: SupportedHooks.PATIENT_VIEW, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' | ||
}, | ||
{ | ||
hook: SupportedHooks.ENCOUNTER_START, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-encounter-start' | ||
} | ||
] | ||
}, | ||
{ | ||
rxnorm: 1666386, | ||
display: 'Addyi 100 MG Oral Tablet', | ||
hookEndpoints: [ | ||
{ | ||
hook: SupportedHooks.ORDER_SIGN, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-order-sign' | ||
}, | ||
{ | ||
hook: SupportedHooks.ORDER_SELECT, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-order-select' | ||
}, | ||
{ | ||
hook: SupportedHooks.PATIENT_VIEW, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-patient-view' | ||
}, | ||
{ | ||
hook: SupportedHooks.ENCOUNTER_START, | ||
remsAdmin: 'http://localhost:8090/cds-services/rems-encounter-start' | ||
} | ||
] | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { MedicationRequest } from 'fhir/r4'; | ||
import { SupportedHooks } from '../cds-hooks/resources/HookTypes'; | ||
import { getDrugCodeableConceptFromMedicationRequest } from '../views/Questionnaire/questionnaireUtil'; | ||
import { medicationRequestToRemsAdmins } from './data'; | ||
|
||
export const getMedicationSpecificRemsAdminUrl = ( | ||
request: MedicationRequest | undefined, | ||
hook: SupportedHooks | ||
) => { | ||
// if empty request, just return | ||
if (request && Object.keys(request).length === 0) { | ||
return null; | ||
} | ||
|
||
const codeableConcept = getDrugCodeableConceptFromMedicationRequest(request); | ||
const display = codeableConcept?.coding?.[0]?.display; | ||
const rxnorm = codeableConcept?.coding?.[0]?.code; | ||
|
||
if (!rxnorm) { | ||
console.log("ERROR: unknown MedicationRequest code: '", rxnorm); | ||
return null; | ||
} | ||
|
||
// This function never gets called with the PATIENT_VIEW hook, however. | ||
if ( | ||
!( | ||
hook === SupportedHooks.PATIENT_VIEW || | ||
hook === SupportedHooks.ORDER_SIGN || | ||
hook === SupportedHooks.ORDER_SELECT || | ||
hook === SupportedHooks.ENCOUNTER_START | ||
) | ||
) { | ||
console.log(`ERROR: unknown hook type: ${hook}`); | ||
return null; | ||
} | ||
|
||
const setting = medicationRequestToRemsAdmins.find( | ||
value => Number(value.rxnorm) === Number(rxnorm) | ||
); | ||
|
||
const cdsUrl = setting?.hookEndpoints.find(endpoint => endpoint.hook === hook); | ||
|
||
if (!cdsUrl) { | ||
console.log(`Medication ${display} is not a REMS medication`); | ||
return null; | ||
} | ||
|
||
return cdsUrl.remsAdmin; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.