DEV Community

Scott Coristine
Scott Coristine

Posted on • Originally published at signaturecare.ca

Safe Medication Management Systems for Home Care: A Technical Implementation Guide

Originally published as a complete guide at Signature Care's medication management resource


Polypharmacy — the concurrent use of five or more medications — affects 66% of older Canadian adults. For developers building health-tech tools, family caregivers coordinating complex schedules, or technical professionals architecting home care workflows, understanding medication management as a system design problem unlocks better outcomes and fewer dangerous errors.

This guide breaks down medication safety at home using technical frameworks: data models, decision trees, protocol specifications, and tooling recommendations.


Tags

#healthtech #caregiving #systemdesign #productivity


The Problem: Medication Management as a Distributed Systems Challenge

Home medication management shares structural similarities with distributed systems engineering:

  • Multiple data sources (several prescribers, pharmacies, specialists)
  • Race conditions (drug interactions, timing conflicts)
  • State management failures (missed doses, double doses)
  • No single source of truth (fragmented across providers)

When any of these fail in production, the consequences aren't a degraded user experience — they're hospitalizations. In Canada, medication non-adherence among seniors accounts for 10% of all preventable hospital admissions annually.


1. Data Architecture: Building Your Medication Record

Start by treating your loved one's medication list as a structured data schema, not a Post-it note on the fridge.

Recommended Medication Record Schema

{
  "patient": {
    "name": "Jane Doe",
    "dob": "1942-06-15",
    "health_card": "MANITOBA-XXXXXXXX",
    "allergies": ["penicillin", "sulfa drugs"],
    "primary_pharmacy": {
      "name": "Shoppers Drug Mart Winnipeg",
      "phone": "204-XXX-XXXX",
      "fax": "204-XXX-XXXX"
    }
  },
  "medications": [
    {
      "id": "med_001",
      "name": "Warfarin",
      "generic_name": "warfarin sodium",
      "brand_name": "Coumadin",
      "dosage": "5mg",
      "route": "oral",
      "frequency": "once_daily",
      "timing": "18:00",
      "food_instructions": "consistent_vitamin_k_intake",
      "prescriber": "Dr. Smith — Cardiology",
      "rx_number": "RX-XXXXXXX",
      "start_date": "2023-11-01",
      "refill_date": "2024-02-01",
      "high_risk": true,
      "interaction_flags": ["aspirin", "ibuprofen", "st_johns_wort"]
    }
  ],
  "otc_supplements": [
    {
      "name": "Vitamin D3",
      "dosage": "1000 IU",
      "frequency": "once_daily",
      "timing": "morning"
    }
  ],
  "last_reviewed": "2024-01-15",
  "reviewed_by": "Pharmacist — Jane Williams"
}
Enter fullscreen mode Exit fullscreen mode

Key design principles:

  • Include both brand and generic names — switching between them is a common source of accidental double-dosing
  • Flag high_risk: true for medications with narrow therapeutic windows (blood thinners, heart medications, seizure drugs)
  • Store interaction_flags as arrays to support automated cross-referencing

2. Schedule Architecture: Preventing Race Conditions

Medication timing conflicts — two drugs that shouldn't be taken together, or one that requires an empty stomach while another requires food — are real race conditions.

Medication Schedule State Machine

States: PENDING → DISPENSED → CONFIRMED → LOGGED
                 ↓
             MISSED → ESCALATED → PROVIDER_NOTIFIED
Enter fullscreen mode Exit fullscreen mode
from enum import Enum
from datetime import datetime

class DoseStatus(Enum):
    PENDING = "pending"
    DISPENSED = "dispensed"
    CONFIRMED = "confirmed"
    MISSED = "missed"
    ESCALATED = "escalated"

class MedicationDose:
    def __init__(self, med_id, scheduled_time, window_minutes=30):
        self.med_id = med_id
        self.scheduled_time = scheduled_time
        self.window_minutes = window_minutes  # acceptable administration window
        self.status = DoseStatus.PENDING
        self.administered_at = None
        self.caregiver_id = None
        self.notes = ""

    def administer(self, caregiver_id: str, timestamp: datetime):
        delta = abs((timestamp - self.scheduled_time).total_seconds() / 60)
        if delta > self.window_minutes:
            self.notes = f"Administered {delta:.0f} min outside window"
        self.status = DoseStatus.CONFIRMED
        self.administered_at = timestamp
        self.caregiver_id = caregiver_id

    def mark_missed(self):
        self.status = DoseStatus.MISSED
        # Trigger escalation workflow
        self._escalate()

    def _escalate(self):
        self.status = DoseStatus.ESCALATED
        # Notify caregiver → family member → healthcare provider
        print(f"[ALERT] Missed dose escalation for med_id={self.med_id}")
Enter fullscreen mode Exit fullscreen mode

This state machine structure maps directly onto commercial medication management platforms and can guide how you evaluate or build caregiver-facing tools.


3. Storage Configuration: Environmental Constraints as System Requirements

Medication storage failures are configuration errors. Most degradation events are preventable.

Storage Requirement Matrix

Medication Type Temp Range Humidity Light Special
Most oral tablets 15–25°C <60% Avoid direct Original container
Insulin (opened) Room temp <60% Avoid Use within 28–30 days
Insulin (unopened) 2–8°C (fridge) Controlled Avoid Don't freeze
Nitroglycerin <25°C Low Dark container Away from heat sources
Liquid antibiotics 2–8°C (fridge) N/A Avoid Discard after course
Eye drops (opened) Room temp Low Avoid Discard after 28 days

Common configuration anti-patterns:

❌ Bathroom medicine cabinet  → high humidity, temperature spikes
❌ Kitchen windowsill         → direct sunlight, heat
❌ Hot car glovebox           → extreme temperature variance
❌ Unlocked drawer            → accessible to children/pets
❌ Mixed container            → identification errors

✅ Cool bedroom drawer        → stable temp, low humidity
✅ Locked box (controlled Rx) → security requirement met
✅ Original containers        → label integrity preserved
✅ Separate daily vs PRN      → reduces selection errors
Enter fullscreen mode Exit fullscreen mode

4. Interaction Checking: The Dependency Graph Problem

Drug interactions are a dependency resolution problem. Each medication is a node; interactions are edges. High-risk combinations are circular dependencies that can cascade into system failure.

High-Risk Interaction Pairs (Canadian context)

HIGH_RISK_INTERACTIONS = {
    "warfarin": [
        "aspirin",
        "ibuprofen",
        "naproxen",
        "st_johns_wort",
        "vitamin_e_high_dose",
        "ciprofloxacin"
    ],
    "metformin": [
        "contrast_dye",  # pre-procedure alert
        "alcohol_heavy"
    ],
    "digoxin": [
        "amiodarone",
        "clarithromycin",
        "licorice_supplements"
    ],
    "ssri_class": [
        "tramadol",       # serotonin syndrome risk
        "linezolid",
        "st_johns_wort"
    ]
}

def check_interactions(current_meds: list, new_med: str) -> list:
    """
    Returns list of flagged interactions for review.
    NOT a substitute for pharmacist review.
    """
    flags = []
    new_med_lower = new_med.lower().replace(" ", "_")

    for med in current_meds:
        med_key = med.lower().replace(" ", "_")
        if med_key in HIGH_RISK_INTERACTIONS:
            if new_med_lower in HIGH_RISK_INTERACTIONS[med_key]:
                flags.append({
                    "existing_med": med,
                    "new_med": new_med,
                    "severity": "HIGH",
                    "action": "PHARMACIST_REVIEW_REQUIRED"
                })
    return flags
Enter fullscreen mode Exit fullscreen mode

⚠️ Critical note: Automated checking is a triage tool, not a clinical decision system. Always escalate flagged interactions to a licensed pharmacist or physician before proceeding.


5. The Five Rights Protocol: Your Production Checklist

Professional caregivers use the Five Rights framework as a pre-administration checklist. Think of it as a pre-flight check or a CI/CD gate before deployment.

PRE-ADMINISTRATION CHECKLIST
═══════════════════════════════════════════════════════
□  RIGHT PERSON     → Verified patient identity matches prescription label
□  RIGHT MEDICATION → Generic + brand name confirmed; not expired
□  RIGHT DOSE       → Dosage matches current prescription; not doubled
□  RIGHT TIME       → Within acceptable administration window
□  RIGHT ROUTE      → Oral / sublingual / topical / injection confirmed
═══════════════════════════════════════════════════════
SECONDARY CHECKS:
□  No recent vomiting (oral medications)
□  No food/drug timing conflict
□  Caregiver notes any observed reactions post-administration
□  Log entry created with timestamp and caregiver ID
═══════════════════════════════════════════════════════
Enter fullscreen mode Exit fullscreen mode

Research indicates that standardized Five Rights protocols reduce medication errors by 70% in home care settings.


6. Alert Escalation: Defining Your On-Call Runbook

Like any production system, medication management needs a defined escalation path. Here's a structured decision tree:

SYMPTOM DETECTED
       │
       ▼
Is this a known, documented side effect?
       │
    YES │                    NO
       │                     │
       ▼                     ▼
Monitor + log          Is it severe?
Notify family          (breathing, chest pain,
caregiver              unconsciousness, anaphylaxis)
       │                     │
       │               YES   │    NO
       │                │    │     │
       │                ▼    │     ▼
       │           CALL 911  │  Contact prescriber
       │                     │  or Health Links
       │                     │  204-788-8200
       │                     │
       └─────────────────────┘
                 │
                 ▼
       Document in medication log
       Flag for pharmacist review at next refill
Enter fullscreen mode Exit fullscreen mode

Clinical Alert Thresholds

ALERT_THRESHOLDS = {
    "call_911": [
        "difficulty_breathing",
        "chest_pain",
        "loss_of_consciousness",
        "severe_allergic_reaction",
        "signs_of_overdose",
        "severe_confusion_acute_onset"
    ],
    "contact_provider_urgent": [
        "irregular_heartbeat",
        "persistent_severe_nausea",
        "unexpected_significant_bleeding",
        "sudden_behaviour_change"
    ],
    "contact_provider_routine": [
        "persistent_mild_side_effects",
        "multiple_missed_doses",
        "new_otc_supplement_addition",
        "pre_surgery_or_dental_procedure",
        "international_travel_planned"
    ],
    "monitor_and_log": [
        "mild_transient_nausea",
        "minor_dizziness_first_week",
        "known_documented_side_effect"
    ]
}
Enter fullscreen mode Exit fullscreen mode

7. Tooling Evaluation Framework

When selecting medication management tools — whether apps, dispensers, or workflow platforms — evaluate them against these requirements:

Functional Requirements Checklist

CORE FEATURES
□ Multi-medication schedule management
□ Caregiver + family member access (role-based)
□ Missed dose logging and alerting
□ Interaction checking (with pharmacist escalation path)
□ Refill tracking and reminders
□ Shareable records for provider appointments

SAFETY FEATURES
□ Photo identification of pills
□ Barcode/QR scanning of prescription labels
□ Emergency contact quick-access
□ Exportable medication history (PDF or structured data)

INTEGRATION
□ Compatible with Manitoba Health resources
□ Pharmacy data import capability
□ HL7 FHIR compliance (for clinical-grade tools)
□ Audit trail / immutable logs
Enter fullscreen mode Exit fullscreen mode

Tool Categories

Tool Type Best For Limitations
Weekly pill organizer Simple schedules, stable regimens No alerting, human error risk
Smartphone reminder app Tech-comfortable users, moderate complexity Requires consistent device access
Automated pill dispenser Complex schedules, cognitive decline Cost, mechanical failure modes
Blister pack (pharmacy) Polypharmacy, compliance issues Less flexible for PRN medications
Professional home care coordination High-complexity cases, post-hospital Requires care plan setup

8. Disposal Protocol: Secure Decommissioning

Unused or expired medications are a security and environmental vulnerability — treat disposal like decommissioning sensitive infrastructure.

Manitoba Disposal Protocol

MEDICATION DISPOSAL DECISION TREE
══════════════════════════════════════
Is medication expired or no longer needed?
              │
              ▼
        YES → Return to pharmacy via
              Drug Return Program
              (available at most
               Manitoba pharmacies,
               no charge)

        DO NOT:
        ❌ Flush down toilet
        ❌ Place in household garbage
        ❌ Leave in unsecured location
        ❌ Share with others

Special cases:
• Patient deceased → prompt return, document inventory
• Transition to care facility → coordinate with facility pharmacist
• Controlled substances → may require witnessed disposal
Enter fullscreen mode Exit fullscreen mode

Putting It All Together: Implementation Priorities

If you're implementing or auditing a home medication management system, here's a prioritized rollout:

PHASE 1 — Foundation (Week 1)
├── Build complete medication record (JSON schema above)
├── Share with all prescribers and pharmacists
└── Establish secure storage configuration

PHASE 2 — Process (Week 2)
├── Implement Five Rights pre-administration checklist
├── Set up logging system (app or written log)
└── Define escalation contacts and thresholds

PHASE 3 — Tooling (Week 3–4)
├── Evaluate and select reminder/dispensing tools
├── Book pharmacist medication review
└── Configure refill tracking and alerts

PHASE 4 — Ongoing Operations
├── Monthly: Review and update medication record
├── Quarterly: Pharmacist medication review
└── Annually: Full medication reconciliation with all providers
Enter fullscreen mode Exit fullscreen mode

Key Resources (Manitoba)

  • Health Links - Info Santé: 204-788-8200 (non-emergency medication guidance)
  • Winnipeg Drug Return Program: Available at most local pharmacies at no charge
  • Manitoba pharmacists: Can conduct comprehensive medication reviews and arrange blister packaging
  • Signature Care home care services: View care coordination and medication support services

Takeaways

  1. Treat medication records as structured data — schema design prevents documentation gaps
  2. Model interactions as a dependency graph — and always resolve conflicts with a pharmacist
  3. Use state machines for dose tracking — missed doses need escalation paths, not just reminders
  4. Store configuration matters — most degradation events are preventable environment failures
  5. The Five Rights protocol is your pre-flight checklist — don't skip gates under time pressure
  6. **Define

Top comments (0)