Skip to main content

Prescriptions

Prescriptions (FHIR MedicationRequest) represent medication orders written by practitioners.

Create a Prescription

const { data: rx } = await clinik.prescriptions.create({
  patientId: 'pt_abc123',
  prescriberId: 'prac_def456',
  encounterId: 'enc_xyz789',
  medication: {
    system: 'http://www.nlm.nih.gov/research/umls/rxnorm',
    code: '197361',
    display: 'Lisinopril 10 MG Oral Tablet',
  },
  intent: 'order',
  status: 'active',
  priority: 'routine',
  category: 'outpatient',
  authoredOn: '2026-04-29T10:00:00Z',
  dosageText: 'Take 1 tablet by mouth once daily',
  dosage: {
    dose: { value: 10, unit: 'mg' },
    frequency: 1,
    period: 1,
    periodUnit: 'd',
    route: 'oral',
  },
  refills: 3,
  quantity: { value: 30, unit: 'tablets' },
  supplyDays: 30,
  substitutionAllowed: true,
  reason: 'Essential hypertension',
  note: 'Monitor blood pressure weekly',
  courseOfTherapy: 'continuous',
});

New Fields

Status Reason

Explain why a prescription is on-hold, cancelled, or stopped:
await clinik.prescriptions.update('rx_abc123', {
  status: 'on-hold',
  statusReason: 'Patient reported dizziness — holding pending follow-up',
});

Category

Classify the medication usage context:
const { data } = await clinik.prescriptions.create({
  patientId: 'pt_abc123',
  prescriberId: 'prac_def456',
  medication: 'Metformin 500mg',
  category: 'discharge', // inpatient, outpatient, community, discharge
  // ...
});

Do Not Perform

Create a “do not administer” order:
const { data } = await clinik.prescriptions.create({
  patientId: 'pt_abc123',
  prescriberId: 'prac_def456',
  medication: 'Aspirin',
  doNotPerform: true,
  reason: 'Patient has aspirin allergy',
  // ...
});

Performer

Specify who should administer the medication:
const { data } = await clinik.prescriptions.create({
  patientId: 'pt_abc123',
  prescriberId: 'prac_def456',
  medication: 'Insulin Glargine 100 units/mL',
  performerId: 'prac_nurse789',
  // ...
});

Course of Therapy

Indicate the overall pattern of medication administration:
const { data } = await clinik.prescriptions.create({
  patientId: 'pt_abc123',
  prescriberId: 'prac_def456',
  medication: 'Prednisone 10mg',
  courseOfTherapy: 'acute', // continuous, acute, seasonal
  // ...
});

Prior Prescription

Link to a prescription being replaced:
const { data } = await clinik.prescriptions.create({
  patientId: 'pt_abc123',
  prescriberId: 'prac_def456',
  medication: 'Lisinopril 20 MG Oral Tablet',
  priorPrescriptionId: 'rx_old456',
  reason: 'Dose increase — blood pressure not controlled at 10mg',
  // ...
});

Dosage Options

You can provide dosage as free text, structured data, or both:
// Free text only
{ dosageText: 'Take 1 tablet twice daily with food' }

// Structured only
{
  dosage: {
    dose: { value: 500, unit: 'mg' },
    frequency: 2,
    period: 1,
    periodUnit: 'd',
    route: 'oral',
  }
}

// Both (recommended — structured for computation, text for display)
{
  dosageText: 'Take 500mg twice daily with food',
  dosage: {
    dose: { value: 500, unit: 'mg' },
    frequency: 2,
    period: 1,
    periodUnit: 'd',
    route: 'oral',
  }
}

Period Units

UnitMeaning
hHours
dDays
wkWeeks
moMonths

Update a Prescription

// Put a prescription on hold
const { data: updated } = await clinik.prescriptions.update('rx_abc123', {
  status: 'on-hold',
  statusReason: 'Patient reported dizziness — holding pending follow-up',
});

// Change priority
await clinik.prescriptions.update('rx_abc123', {
  priority: 'urgent',
  performerId: 'prac_nurse789',
});

// Cancel a prescription
await clinik.prescriptions.update('rx_abc123', {
  status: 'cancelled',
  statusReason: 'Replaced with alternative medication',
});

Search Prescriptions

const { data: results } = await clinik.prescriptions.search({
  patientId: 'pt_abc123',
  status: 'active',
  prescriberId: 'prac_def456',
});

for (const rx of results.data) {
  console.log(`${rx.medication}${rx.dosageText}`);
  console.log(`  Category: ${rx.category}, Course: ${rx.courseOfTherapy}`);
}

Status Lifecycle

draftactiveon-holdcompleted / cancelled / stopped Use statusReason to document why a prescription changed status.

Complete Field Reference

FieldTypeDescription
patientIdstringPatient reference (required)
prescriberIdstringPrescribing practitioner (required)
medicationstring | CodeableConceptMedication code or name (required)
intentstringproposal, plan, order, original-order
statusstringactive, on-hold, cancelled, completed, draft
statusReasonstringReason for current status
prioritystringroutine, urgent, asap, stat
categorystringinpatient, outpatient, community, discharge
doNotPerformbooleanTrue if prohibiting the medication
authoredOnstringWhen authored (ISO 8601, defaults to now)
performerIdstringIntended performer of administration
courseOfTherapystringcontinuous, acute, seasonal
priorPrescriptionIdstringReference to replaced prescription
dosageTextstringHuman-readable dosage instructions
dosageobjectStructured dosage (dose, frequency, period, route)
refillsnumberNumber of refills (0-99)
quantity{ value, unit }Quantity to dispense
supplyDaysnumberExpected supply duration in days
substitutionAllowedbooleanAllow generic substitution
reasonstringClinical reason for the prescription
notestringAdditional notes for the pharmacist