Medication Dispense Java API

A new MedicationDispenseService will be added (via the MedicationDispense module) that handles:

  • Basic CRUD operations on the Medication Dispense domain object
  • A RESTful version of the API
  • Business-layer operating needed for the implementation of the Medication Dispense UI (warning)

Java API

CRUD Operations

  • getMedicationDispenseByUuid
  • getMedicationDispenseByPatient
  • getMedicationDispenseByDrugOrder
  • saveMedicationDispense
  • voidMedicationDispense
  • unvoidMedicationDispense
  • purgeMedicationDispense

(We should also add new privileges for these various operations, based on the patterns we use for other domain objects)

(question) Should medication dispense objects be updateable (my gut answer is yes)

RESTful API

Support for all the Java API methods via OpenMRS REST or FHIR format

(question) If we support a "FHIR" format, will we have to map the an OpenMRS Drug Order to a FHIR Medication Request?  Looks like there's already support in the FHIR module to do this, should research further.  Could we use an extension to associate one or more Medication Dispense resources with a Medication Request?


Potential Business Layer Operations

(warning) These are all pending confirmation of the UI and use cases, very much a work-in-progress, Phase 2

MethodParametersReturnsNotes

getDrugOrdersWithAssociatedDispensingInformation

(warning) Hold for now, pending further requirements

Date earliestDateActivated, Date latestDateActivated, Patient patient, List<FullfillerStatus> fulfillerStatuses

Map<DrugOrder, List<MedicationDispense>> (question)


(Is there a better way to translate this, than a map)?

Used to populate the Pharmacist List page (with Patient= null, and likely FulfillerStatus != COMPLETED) and the Back to Clinician Page (with Patient = null, and with FulfillerStatus == Exception or In_Progress or Received?) and Patient-specific medication page

Should likely build a custom DAO method that joins DrugOrder to MedicationDispense on drug_order.order_id = medication_dispense.drug_order_id

My thought is that this search based on Date and FulfillerStatus (likely all but FulfillerStatus = COMPLETED), but the other filters (Drug, Prescriber) can happen on the client side?

Interesting reference: https://stackoverflow.com/questions/56177921/why-medicationdispense-doesnt-contain-attribute-of-prescription-number

Perhaps this could all be handled via FHIR: https://www.hl7.org/fhir/search.html#include ... would this work:

 GET [base]/MedicationRequest?_revinclude=MedicationDispense:target

New Notes (2022-03-01): Do we really need to use fulfiller status?
Note: do we really need at all, probably better to have separate requests?