Skip to content

Prescription limits on all tiers — Implementation Plan

Version: 1.0 Last Updated: 2026-07-16 17:32:52 Status: Implemented (dev migrated; tests green) Owner: Billing / medications

Every plan includes both medication_dispensing and prescription_management. Differentiate tiers by active prescription count (patient_scripts with status = 'active'), not by hiding the module:

Tiermax_medicines
Essential2
Family (professional)5
Completeunlimited (null)

Hitting the cap raises LIMIT_MEDICINES (HTTP 402) with an upgrade hint → <UpgradeGate> (Essential → Family, Family → Complete).

  1. Update backend/billing/tiers.json modules + limits.
  2. Migration V020 — refresh stripe_tiers rows; grant prescription_management to tenants that already have active medication_dispensing.
  3. Extract enforce_active_medicine_limit in tier_limits.py; use from patient_scripts_service.create_script; user-facing copy says “prescriptions”.
  4. Frontend: wire LimitError from ScanFlow save → UpgradeGate; remove !prescription_management Essential proxies; History editable via module; capacity pills / upgrade feature lists; UpgradeGate label “prescription(s)”.
  5. Docs matrix + billing doc; marketing pricing bullets; tests.
  6. Run targeted pytest + frontend unit tests.