Medication Dispense Data Model

We will need to add a new "medication_dispense" table (and companion domain object MedicationDispense) modeled after the  MedicationDispense FHIR resource:

https://www.hl7.org/fhir/medicationdispense.html#resource

The domain object should extend BaseOpenmrsData and provide the standard audit visits of that class.  

Beyond that, the table/domain object should contain the fields below.  (Note the "Phase 1" column, which denotes if this field should be added in the initial implementation.  Fields with a "no" here are fields that will be delegated to a later phase. I have grouped those fields to the bottom of the table)

"Related Order/Drug Order Property" is a reference to the related fields on a DrugOrder domain object.  (ie, theoretically, if you created a MedicationDispense from DrugOrder without any modifications, the values in these fields could be copied from the Drug Order to the MedicationDispense)

When we create the new domain object, we should make sure that for each property we add a comment noting which FHIR field it maps to (perhaps even with a link) so that we remember the reasoning behind each field.

Column NameColumn DatatypeRequiredForeign KeyJava Variable NameJava Variable Class

Mapped

FHIR Field

Related Order/Drug Order PropertyPhase One?Notes
concept_id

int

Yesconcept.concept_idconceptConceptmedication.medicationCodeableConceptOrder.ConceptYes
drug_idintNo drug.drug_iddrugDrugmedication.reference(Medication)DrugOrder.drugYesMay need to clarify how this actually gets transformed in FHIR
patient_idintYes patient.patient_idpatientPatientsubjectPatientYes
location_idintNo location.location_idlocationLocationlocationN/AYeswhere the dispensed event occurred
encounter_idintNoencounter.encounter_idencounterEncountercontextN/AYesencounter when the dispensing event occurred
provider_idintNoprovider.provider_idproviderProviderperformer.actorN/A​_YesNote that FHIR provides support for 0..x "performers" and each performer may have a "performer.function" where "function" is a codeable concept and reflects a role like "packager"or "checker";  we will start with support for just a single 0..1 "provider"
drug_order_idintNodrug_order.drug_order_iddrugOrderDrugOrderauthorizingPrescriptionOrder.orderIdYesthe drug order that led to this dispensing event; note that authorizing prescription maps to a "MedicationRequest" FHIR resource
statusintYes
statusConceptstatusN/AYes

preparation | in-progress | cancelled | on-hold | completed | entered-in-error | stopped | declined | unknown  

(see: https://www.hl7.org/fhir/valueset-medicationdispense-status.html) 

statusReasonintNoconcept.concept_idstatusReasonConceptstatusReason.statusReasonCodeableConceptN/AYes 

For  allowed coded answers, see: https://www.hl7.org/fhir/valueset-medicationdispense-status-reason.html  

Note that these include things like "Stock Out"  which we will likely be building some business logic around them.  

typeintNo concept.concept_idtypeConcepttype.codeableConceptN/AYes 

For potential example concepts, see: https://www.hl7.org/fhir/v3/ActPharmacySupplyType/vs.html

Note that these include things like "Refill" and "Partial Fill" which we will likely be building some business logic around them.

quantitydoubleNo
quantityDoublequantity.valueDrugOrder.quantityYes

Not required by FHIR

quantity_unitsintNoconcept.concept_idquantityUnitsConceptquantity.unit and/or quanity.codeDrugOrder.quantityUnitsYes

See:

Error rendering macro 'jira' : Unable to locate Jira server for this macro. It may be due to Application Link configuration.

dosedoubleNo
doseDoubledosageInstructions.doseAndRate.dose.doseQuantity DrugOrder.doseYes
dose_unitsintNoconcept.concept_iddoseUnitsintDosageInstructions.doseAndRate.dose.Quantity.unit and/or codeDrugOrder.doseUnitsYes

See: Unable to locate Jira server for this macro. It may be due to Application Link configuration.

routeintNoconcept.concept_idrouteintDosageInstructions.route DrugOrder.routeYes
frequencyintNoorder_frequency.order_frequency_idfrequencyint

DosageInstructions.timing.repeat.frequency

DosageInstructions.timing.repeat.period

DosageInstructions.timing.repeat.periodUnit

DrugOrder.frequencyYes

https://build.fhir.org/datatypes.html#Timing

(warning) Note that we will continue to map this as a single "frequency" concept, although it doesn't map well to FHIR, to make consistent with DrugOrder in OpenMRS

as_neededtinyint(1)No
asNeededBooleanDosageInstructions.AsNeeded.asNeededBoolean DrugOrder.asNeededYes
dosing_instructionstextNo
dosingInstructionsStringDosageInstructions.patientInstructions  DrugOrder.dosingInstructions​_Yes
date_prepareddatetimeNo 
datePreparedDatetimewhenPreparedN/AYes

From FHIR: "When product was packaged and reviewed"

I used "datePrepared" instead of "whenPrepared" because it seemed more in-line with OpenMRS conventions.  Happy to debate.

date_handed_overdatetimeNo  
dateHandedOverDatetimewhenHandedOverN/AYes

From FHIR: "When product was given out"

 I used "dateHandedOver" instead of "whenHandedOver" because it seemed more in-line with OpenMRS conventions.  Happy to debate.

notevarchar(1024) (question)No
noteStringnote.textN/AYes

FHIR supports 0..n but we will only support 0..1 for starters? It also supports the author and the time via the "annotation" type. 

(question) Should this be a clob, see comment from Ian below

was_substituted

tinyint(1)

No
wasSubstitutedBooleansubstitution.wasSubstitutedN/AYesTrue/false whether a substitution was made during this dispense event
substitution_type_idintNoconcept.concept_idsubstitutionTypeConceptsubstitution.typeN/AYes 

For valid FHIR concepts, see: https://www.hl7.org/fhir/v3/ActSubstanceAdminSubstitutionCode/vs.html

We also could punt on building this in Phase 1, and make the distinction between enum and concept when we have an actual use case.

Let Andrew Kanter  know if we need these as concepts.

substitution_reason_idintNoconcept.concept_idsubstitutionReasonConceptsubstitution.reasonN/AYes 

For valid FHIR concepts, see: https://www.hl7.org/fhir/v3/SubstanceAdminSubstitutionReason/vs.html


We also could punt on building this in Phase 1, and make the distinction between enum and concept when we have an actual use case.

Let Andrew Kanter  know if we need these as concepts.







substitution.responsiblePartyN/ANo
days_supplyintNo
daysSupplyintdaysSupply.valueN/ANo

From FHIR: The amount of medication expressed as a timing amount.

It might be best to drop support for this an only support quantity, at least at a first pass (technically quantity can have a units of days)

category_idintNoconcept.concept_idcategoryConceptcategoryN/ANo 

ie, Inpatient, Outpatient, Discharge, Community

For valid FHIR concepts, see: https://www.hl7.org/fhir/valueset-medicationdispense-category.html


Let Andrew Kanter  know if we need these as concepts.

destination_id intNolocation.location_iddestinationLocationdestinationN/ANo 

From FHIR: "Where the medication was sent".

Do we want this for "phase 1"?

receiver_id intNoperson.person_idreceiverPersonreceiverN/ANo 

From FHIR: "Who collected the medication"

Do we want this for "phase 1"?

FHIR supports  a receiver of a "Practioner" or "Patient", so "Person" is the only current way in OpenMRS to support this 

(0...n in FHIR, but we currently only support 0..1) 







identifier
NoExternal identifier






partOf
NoEvent that dispense is a part of (maps to a FHIR Procedure)






supportingInformation
No






detectedIssue
No






eventHistory
No