Skip to content

Hotfixes

About Hotfixes

This page documents critical production updates and patches that require immediate attention. For planned feature releases, see the Changelog.

Hotfix 1.1.1

Production 2026-03-06

Improved Prescription Structure

To enhance data precision within the EMR, we have updated the medication schema. This change allows for a clearer distinction between usage instructions and dispensed quantities.

Breaking Change

This update introduces a new optional field that affects how medication quantities are calculated. Review your integration to ensure proper handling of the dispense object.

New Field Definitions

FieldTypeRequiredDescription
daysIntegerYesNumber of days for the course of usage
dispenseObjectNoNew Specifies the total quantity of the drug provided to the patient.

Dispense Object Structure

When provided, the dispense object should contain:

PropertyTypeRequiredDescription
quantityNumberYesTotal amount dispensed to the patient
unitStringYesUnit of measurement (e.g., "Boxes", "Bottles", "Tablets")

Calculation Logic

Automatic Quantity Calculation

If the dispense field is not provided, the system calculates the quantity using this fallback logic:

  1. Quantity Formula: (morning + afternoon + evening + night) × days
  2. Zero Fallback: If days is 0 or missing, the quantity defaults to 0
  3. Unit: Defaults to the unit specified in the usage instructions

Example Calculation:

  • Morning: 1, Afternoon: 0, Evening: 1, Night: 0
  • Days: 7
  • Calculated Quantity: (1 + 0 + 1 + 0) × 7 = 14 tablets

Implementation Examples

Example 1: Standard Dosing with Dispense

This example shows a medication with time-of-day dosing and explicit dispense quantity:

json
{
  "medicine_code": "MED001",
  "medicine_name": "Artemether-Lumefantrine",
  "strength": "20/120mg",
  "method": "Oral",
  "unit": "Tablet",
  "morning": 4,
  "afternoon": 0,
  "evening": 4,
  "night": 0,
  "days": 3,
  "interval": null,
  "note": "Take with food. Complete the full course.",
  "dispense": {
    "quantity": 1,
    "unit": "Boxes"
  }
}

Why dispense is needed here: The patient takes 4 tablets twice daily for 3 days (24 tablets total), but the pharmacy dispenses 1 box containing 24 tablets.

Example 2: PRN Medication with Interval

This example demonstrates why dispense is necessary for interval-based medications:

json
{
  "medicine_code": "MED002",
  "medicine_name": "Paracetamol",
  "strength": "500mg",
  "method": "Oral",
  "unit": "Tablet",
  "morning": 0,
  "afternoon": 0,
  "evening": 0,
  "night": 0,
  "days": 5,
  "interval": "8 hours",
  "note": "Take only when you have fever or pain.",
  "dispense": {
    "quantity": 1,
    "unit": "Boxes"
  }
}

Why dispense is required: The instruction uses interval instead of time-of-day quantities, making automatic calculation impossible. The dispense field explicitly states what was given to the patient.

Complete Prescription Example

Full JSON Structure
json
{
  "prescriptions": [
    {
      "patient_code": "P25003877",
      "visit_code": "V420650",
      "encounter_code": "E417001",
      "code": "RX20250317001",
      "prescribed_at": "2025-03-17T10:10:00.000+07:00",
      "prescribed_by": "Dr. Chhun Sovannarith",
      "title": "Doctor",
      "medications": [
        {
          "medicine_code": "MED001",
          "medicine_name": "Artemether-Lumefantrine",
          "strength": "20/120mg",
          "method": "Oral",
          "unit": "Tablet",
          "morning": 4,
          "afternoon": 0,
          "evening": 4,
          "night": 0,
          "days": 3,
          "interval": null,
          "note": "Take with food. Complete the full course.",
          "dispense": {
            "quantity": 1,
            "unit": "Boxes"
          }
        },
        {
          "medicine_code": "MED002",
          "medicine_name": "Paracetamol",
          "strength": "500mg",
          "method": "Oral",
          "unit": "Tablet",
          "morning": 0,
          "afternoon": 0,
          "evening": 0,
          "night": 0,
          "days": 5,
          "interval": "8 hours",
          "note": "Take only when you have fever or pain.",
          "dispense": {
            "quantity": 1,
            "unit": "Boxes"
          }
        }
      ]
    }
  ]
}

Migration Checklist

Action Items

  • [ ] Update your EMR to always provide days property
  • [ ] Update your EMR to provide the optional dispense object

Support

Need Help?

If you encounter issues implementing this hotfix: