Skip to main content

Medication Dispenses

Medication Dispenses (FHIR MedicationDispense) track the supply of medications to patients — typically by a pharmacy. For medication orders, see Prescriptions. For drug definitions, see Medications.

Dispense a Medication

const { data: dispense } = await clinik.medicationDispenses.create({
  status: 'completed',
  medication: {
    system: 'http://www.nlm.nih.gov/research/umls/rxnorm',
    code: '197361',
    display: 'Lisinopril 10 MG Oral Tablet',
  },
  patientId: 'pt_abc123',
  authorizingPrescriptionIds: ['rx_order456'],
  quantity: { value: 30, unit: 'tablets' },
  daysSupply: 30,
  whenPrepared: '2024-03-15T10:00:00Z',
  whenHandedOver: '2024-03-15T14:30:00Z',
  dosageText: 'Take 1 tablet daily in the morning',
  performer: [
    { function: 'dispenser', actorId: 'Practitioner/pharm_rph789' },
  ],
});

Partial Fill

const { data: partial } = await clinik.medicationDispenses.create({
  status: 'completed',
  medication: 'Amoxicillin 500mg Capsule',
  patientId: 'pt_abc123',
  authorizingPrescriptionIds: ['rx_order789'],
  type: 'partial fill',
  quantity: { value: 14, unit: 'capsules' },
  daysSupply: 7,
  whenHandedOver: '2024-03-15T16:00:00Z',
  dosageText: 'Take 1 capsule twice daily for 7 days',
  note: 'Partial fill — remaining 14 capsules available for pickup in 7 days',
});

Substitution

Track when a generic is substituted for a brand-name drug:
const { data } = await clinik.medicationDispenses.create({
  status: 'completed',
  medication: 'Atorvastatin 20mg Tablet',
  patientId: 'pt_abc123',
  authorizingPrescriptionIds: ['rx_order101'],
  quantity: { value: 90, unit: 'tablets' },
  daysSupply: 90,
  whenHandedOver: '2024-03-15',
  substitution: {
    wasSubstituted: true,
    type: 'generic',
    reason: 'Formulary policy — generic equivalent available',
  },
});

Search Dispenses

// All dispenses for a patient
const { data } = await clinik.medicationDispenses.search({
  patientId: 'pt_abc123',
});

// Filter by status
const { data: completed } = await clinik.medicationDispenses.search({
  patientId: 'pt_abc123',
  status: 'completed',
});

// Filter by medication
const { data: lisinopril } = await clinik.medicationDispenses.search({
  medication: 'lisinopril',
});

Dispense Statuses

StatusDescription
preparationBeing prepared by the pharmacy
in-progressDispense is in progress
on-holdDispense is paused
completedMedication has been handed over
cancelledDispense was cancelled
stoppedDispense was stopped
declinedDispense was declined

Medications vs Prescriptions vs Dispenses

ResourceFHIR TypePurpose
MedicationMedicationDrug definition (what the drug is)
PrescriptionMedicationRequestMedication order (prescribe it)
Medication DispenseMedicationDispensePharmacy supply (dispense it)