Treatment Plans
Personalized rehabilitation programs — a structured sequence of exercises prescribed to a patient, with tracking, video guidance, and flexible self-service options.
What this enables
- Specialists design rehabilitation programs as a sequence of sessions, each containing specific exercises with sets, reps, duration, and rest periods
- Patients follow their program with video guidance directly in the app — no in-person visit required for telerehab
- The platform tracks every session: which exercises were completed, for how long, and at what intensity
- Patients can optionally provide post-session feedback (pain level, difficulty, notes) through a form
- A library of platform-curated and clinic-owned plans is available for self-service — patients with the right subscription can browse and start a plan themselves, no specialist needed
- Specialists clone and customize existing plans — good custom plans can be promoted to the clinic's shared library
- Plans are versioned: changes don't affect patients already enrolled in a previous version
How it works
There are two modes of operation:
Specialist-assigned: A specialist creates or clones a plan, customizes it for a specific patient, and assigns it. The patient receives it in their app and follows the sessions on their own schedule.
Self-service: Patients with a "library access" subscription browse the plan library — filtered by condition, difficulty, body region — and start a plan themselves. No specialist approval needed.
Three scopes
Global plans (platform-curated)
→ "Post-ACL Standard Protocol", "Lower Back Relief 4 Weeks"
→ Visible to all clinics and patients with library access
Org plans (clinic's own reusable library)
→ "Dr. Smith's Shoulder Program"
→ Visible to clinic staff and patients with library access
Custom plans (specialist-created for a specific patient)
→ "Jane Doe – Post-ACL Weeks 1–4" (cloned and customized)
→ Visible to clinic staff and the assigned patient onlySpecialists clone a global or org plan and adjust it. If the result works well, an admin can promote it to the clinic's shared library for other specialists to use.
What a session looks like (patient experience)
Patient opens app → sees today's session
↓
Guided flow:
Video plays → timer/rep counter → rest period → next exercise
↓
Optional: camera tracks movement via MediaPipe for form feedback
↓
Session complete → post-session questionnaire
↓
Progress dashboard: completion rate, pain trends, streakFlexible scheduling
The plan specifies frequency (e.g., 3× per week). The patient chooses which days. No rigid day-level scheduling — just "complete 3 sessions this week." The system tracks completed vs. expected and current streak.
Technical Reference
Everything below is intended for developers.
Relationship to other features
Exercise Library = what exercises exist (content) → features/exercise-library/
Treatment Plans = how exercises are prescribed (clinical) ← this feature
Service Plans = how sessions are billed (commercial) → features/services/
Telemetry = how sessions are tracked (analytics) → features/integrations/telemetryKey tables
| Table | Purpose |
|---|---|
treatment_plans | Plan definition — type, frequency, duration, scope, versioning |
treatment_plan_versions | JSONB snapshots of plan structure at each publish |
treatment_plan_sessions | Template sessions within a plan (ordered blueprints) |
treatment_plan_session_exercises | Exercises per session with parameters |
patient_treatment_plans | Patient enrollment — assignment, progress, lifecycle |
patient_session_completions | Per-session tracking — timing, completion, pain levels |
patient_exercise_logs | Per-exercise tracking — prescribed vs actual, video watch %, pose accuracy |
Plan types
| Type | How it works |
|---|---|
telerehab | Patient does exercises at home with video. No specialist appointments. |
in_clinic | Specialist schedules in-person sessions via the calendar, linked to appointments. |
Exercise parameters per session
Rep-based:
{ "mode": "reps", "sets": 3, "reps": 10, "rest_between_sets_seconds": 30 }Duration-based:
{ "mode": "duration", "sets": 3, "hold_seconds": 30, "rest_between_sets_seconds": 30 }Versioning
Same pattern as form templates:
- Plan starts as
draft(editable) - On
publish, current state is snapshotted intotreatment_plan_versionsas JSONB versioncounter increments- Patient enrollments reference a specific version
- Editing a published plan creates a new draft; publishing creates a new version
- Previous versions are immutable (clinical record preservation)
Approval workflow
Configurable per org via treatment_plans.requires_approval:
Without approval: create → publish → assign → active immediately
With approval: create → publish → assign (pending_approval) → specialist approves → activeSelf-service access check
POST /v1/treatment-plans/{id}/self-assign
1. Patient has active patient_service_plan with library_access = TRUE?
2. Treatment plan has published = TRUE AND visibility = 'library'?
3. Both pass → create patient_treatment_plan (self_assigned = TRUE, status = active)Post-session questionnaire
treatment_plans.post_session_form_template_id references a form template. When a session is completed, a form instance is created. Pain/difficulty data is queryable through the existing forms and segments systems.
Service plan integration
| Service plan flag | What it unlocks |
|---|---|
telerehab_access = TRUE | Specialist can assign telerehab plans to the patient |
library_access = TRUE | Patient can browse and self-assign from the plan library |
Integration points
- Exercise Library:
exercise_idFK — exercise content is always "live" (not snapshotted in plan versions) - Forms: Post-session questionnaires use the forms system
- Automations: 6 triggers —
treatment_plan.created,.assigned,.activated,.session_completed,.completed,.expired - Appointments (in-clinic):
patient_session_completions.appointment_idlinks in-clinic sessions to appointments - Telemetry: High-frequency data (pose, video events, bandwidth) forwarded to Telemetry/ClickHouse