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:
| Tier | max_medicines |
|---|---|
| Essential | 2 |
Family (professional) | 5 |
| Complete | unlimited (null) |
Hitting the cap raises LIMIT_MEDICINES (HTTP 402) with an upgrade hint →
<UpgradeGate> (Essential → Family, Family → Complete).
- Update
backend/billing/tiers.jsonmodules + limits. - Migration
V020— refreshstripe_tiersrows; grantprescription_managementto tenants that already have activemedication_dispensing. - Extract
enforce_active_medicine_limitintier_limits.py; use frompatient_scripts_service.create_script; user-facing copy says “prescriptions”. - Frontend: wire
LimitErrorfrom ScanFlow save → UpgradeGate; remove!prescription_managementEssential proxies; History editable via module; capacity pills / upgrade feature lists; UpgradeGate label “prescription(s)”. - Docs matrix + billing doc; marketing pricing bullets; tests.
- Run targeted pytest + frontend unit tests.