Skip to content

27 — Condition Template Packs Module

Version: 1.13
Status: Unlock + Stripe + Care Start apply + day-one bootstrap Delivered (VPS 2026-06-04); Care Module boards Phase A partial; archetype / care-pattern UI withdrawn 2026-06-26; C1d clinical sign-off and live paid pack checkout still open
Last Updated: 2026-08-06 10:05:00

Master requirements: 02-REQUIREMENTS.md §3.10, §7.36 (REQ-TMPL, REQ-CARE-START). Canonical catalogue: 35-CARE-PROFILE-CATALOGUE.md v2.7. Tier matrix: 23-SUBSCRIPTION-TIER-ENTITLEMENTS-MATRIX.md §2b. Migrations: 11-DATABASE-SAFETY §2j. Commerce UX: 25-SUBSCRIPTION-VS-CARE-PROFILES.md §6.

Module slug: condition_templates
Tier: All tiers — 2 free starter profiles; Family may purchase additional; Complete includes all twelve profiles.


Care Profiles (condition template packs) are a tenant-level product:

  1. Unlock — tenant_pack_purchases via free starters, tier inclusion, or Stripe one-time purchase.
  2. Care Start apply — apply_care_start_pack() seeds reason types, observation types, and shift tasks per patient (REQ-TMPL-02 — Delivered on dev + VPS). PRN reason codes live in reason_types.patient_id (V014) — not shared across people in care. Day-one bootstrap (2026-06-04): four medication time slots, sample pain medicine on paid packs, profile-themed shopping lists — care_start_bootstrap.py + SHOPPING_LISTS_BY_PACK_SLUG in seed_catalog.py.
  3. Correction — wrong archetype or profile is non-destructive per patient (REQ-CARE-START-04 — Palliative §7.5).

Seven care archetypes (care situations) classify coordination patterns; twelve Care Profiles carry the seed content. They are paired, not interchangeable: selecting The Breath-by-Breath does not load board UI until breathing_difficulties (or another pack) is applied to that person via Care Start (dev QA panel or API; family UI TBD). Care Pathways (fourth product layer — Planning Ahead) extend archetypes with a staged planning journey; see 33-CARE-PATHWAYS-MODULE.md and Palliative §10. Do not duplicate pack slugs outside Palliative Care Archetypes.md §3.2. UI copy register: seed labels from §3.3–3.5 only (§4.4 R2) — not §2 narratives or §5 empathy brief.


LayerStateNotes
Migrations V077–V079DoneSchema + draft seeds (superseded by V006–V009 on dev)
Reconciliation V006–V010DoneDev + VPS 2026-06-04 (image deploy-20260604-1810)
Pack content seedDoneV008 + V010 — reason types, observations, self-care, shift tasks
API — list, archetypes, preview, purchaseDonerouters/condition_packs.py
API — Care Start applyDonePOST /api/patients/{id}/care-start; PATCH …/care-pattern; GET …/care-start/recommended — routers/care_start.py
Service / repoDonePurchase + tier grants + care_start_service.py + care_start_bootstrap.py + repositories/care_start.py
Day-one bootstrapDone (dev)Med slots + sample script (paid) + shopping lists on apply; slots on new patient — 05-DEVELOPER-GUIDE §7.1i
Stripe purchaseDoneCheckout + webhook
UI — Subscriptions marketplaceDone/subscriptions — Add a Care Profile only; condition_templates excluded from module-access grid (2026-06-26)
UI — Add PersonDone (demographics only)PatientCareStartWizard — name/DOB/gender/address/notes; no archetype or apply step (2026-06-26)
UI — archetype / care-patternWithdrawn (2026-06-26)CarePatternPanel + ArchetypeOnboarding deleted; standalone /care-archetypes redirect → /subscriptions
Checkout Palliative Care Start bundleDone (dev)REQ-CARE-START-01 — API line item + marketing modal (2026-06-04); live gated by switchover
Care-pattern correction APIDone (dev)PATCH …/care-pattern — REQ-CARE-START-04; no family UI (C5c UX withdrawn 2026-06-26)
Dev QA — Peter tenantDone (dev)seed_dev_peter_care_qa + CareProfileQaPanel (user id 1) — see 05-DEVELOPER-GUIDE §7.1j
Register R2 auditDone (automated)C7 — scripts/audit_register_r2_care_start.py
Care Module boards (/care/*)Partial (Phase A)Separate from pack unlock — 30; cancer_at_home + breathing_difficulties only; preview user 1

MethodPathPurposeStatus
GET/api/condition-packsAll packs with tenant has_access flagsDone
GET/api/condition-packs/archetypesSeven archetypesDone
GET/api/condition-packs/{id}/previewPack content previewDone (content on dev after V008)
POST/api/condition-packs/{id}/purchaseStripe Checkout for paid packDone
PATCH/api/patients/{patient_id}/care-patternNon-destructive archetype/profile correction (C5c)Done
POST/api/patients/{patient_id}/care-startApply profile to patientDone
GET/api/patients/{patient_id}/care-start/recommendedSuggested pack for archetypeDone

Gate: require_module("condition_templates") via _ctpacks in main.py.


V077–V079 reconciliation (do not lose this)

Section titled “V077–V079 reconciliation (do not lose this)”

Migrations V077, V078, V079 created the right tables but seeded draft catalogue data that predates the finalized product model. Do not edit those migration files on applied databases.

Reconciliation shipped as active post-v1 files V006–V010 (2026-06-04 on dev and VPS). Content maps to Palliative §7.0.5 planned V106–V111.

LayerShippedAuthoritative specActive migration
ArchetypesV077 — 7 rowsPalliative §2V006 — copy update
Care ProfilesV078 — legacy slugsPalliative §3.2V007 — twelve canonical slugs + purchase remap
Pack contentEmpty template tablesPalliative §3.3–3.6V008 — reason types, observations, shift tasks
Patient apply columns—REQ-TMPL-02V009 — patient columns + shift task templates

Full mapping tables, legacy slug → canonical slug: Palliative Care Archetypes.md §7.0. Ops: 11-DATABASE-SAFETY §2j.

REQ traceability: REQ-CARE-START-02 (V007, V008), REQ-CARE-START-03 (V006), REQ-TMPL-02 (V009 + service). Delivery sequence: 04-ROADMAP.md §Master Phase 1.


PathRole
backend/routers/condition_packs.pyPack catalogue HTTP
backend/routers/care_start.pyCare Start apply + recommended preview
backend/services/condition_packs_service.pyAccess flags, preview, purchase, tier grants
backend/services/care_start_service.pyapply_care_start_pack()
backend/repositories/condition_packs.pyPack catalogue SQL
backend/repositories/care_start.pyApply + patient Care Start SQL
backend/care_start/seed_catalog.pyV008 seed source data
backend/scripts/generate_care_start_seed_sql.pyRegenerate V008 SQL
frontend/src/components/condition-packs/PatientCareStartWizard.tsxAdd Person form — demographics only (C5b UI simplified 2026-06-26)
frontend/src/pages/admin/Patients.tsxAdd Person entry
frontend/src/pages/admin/Subscriptions.tsxCare Profiles purchase grid; module access (excludes condition_templates)
frontend/src/components/condition-packs/CareProfileQaPanel.tsxDev one-tap pack apply (user id 1)
backend/scripts/seed_dev_peter_care_qa.pyDev: peter tenant modules + pack grants + QA patients
scripts/seed-dev-peter-care-qa.ps1PowerShell wrapper for Peter QA seed
frontend/src/components/condition-packs/ConditionPackCard.tsxBuyable pack card — description + up to two feature_bullets (Cancer: V012)
frontend/src/components/condition-packs/ConditionPackPreviewDialog.tsxPreview modal — marketing layout for cancer_at_home; seed lists collapsible