Quick Reference
Integration Points
Event Contracts
All PM-03 events are registered infw_workflow_events (seeded by migration 20260219124331_...). Publish via publishEvent() from @/platform/events.
Published Events
Canonical Payload: appointment_scheduled
DOC-1 fix: All field names matchEVENT_CONTRACTS.mdcanonical schema — useappointment_idandstart_datetime/end_datetime, notentity_idorstart_at/end_at.
Canonical Payload: encounter_completed
API / Data Contracts
PM-05: Provider Availability (READ)
Pattern: Direct Supabase query (PM-03 readspm_provider_schedules owned by PM-05)
pm_provider_schedules table must exist (PM-05 Phase 1 migration). If not present, double-booking check MUST be stubbed with a TODO: PM-05 comment — do not silently skip.
PF-10: Reminder Delivery (INVOKE)
Pattern: Platform Integration Layer —@/platform/notifications
delivery_status = 'failed' in pm_appointment_reminders.
Decision Trees
Appointment Type Decision
Telehealth URL Decision (Phase 1 vs Phase 2)
Recurrence Rule Decision
Double-Booking Prevention
Pre-Flight Checklist
Use this checklist before beginning each PM-03 implementation phase.Before Phase 1 (Database)
- PM-05 Phase 1 migration confirmed deployed (
pm_provider_schedulesexists in DB) -
pf_has_org_accessfunction confirmed in DB (SELECT proname FROM pg_proc WHERE proname = 'pf_has_org_access') -
pm_has_org_accessfunction confirmed in DB -
pm_set_updated_attrigger function confirmed in DB (from PM-01 — do NOT recreate, just reference) -
fw_workflow_eventsrows confirmed for all six PM-03 events (migration20260219124331applied) -
pf_module_permissionsrows confirmed forpm.scheduling.view,pm.scheduling.override_double_booking -
appointment_scheduledandencounter_completedpresent inKnownEventNametype (src/platform/events/types.ts) -
PM_PERMISSIONS.SCHEDULING_VIEWandPM_PERMISSIONS.SCHEDULING_OVERRIDE_DOUBLE_BOOKINGpresent inconstants.ts
Before Phase 2 (Hooks & API)
- All Phase 1 tables confirmed in live DB (
pm_appointments,pm_appointment_reminders,pm_waitlist,pm_encounters) - FORCE ROW LEVEL SECURITY confirmed on all four tables
- RLS cross-tenant test passes (org1 cannot read org2 appointments)
-
@/platform/notificationsintegration pattern confirmed (or PF-10 contract stub documented)
Before Phase 3 (UI)
- All hooks from Phase 2 returning correct data shapes
- PF-15 picklist
pm_appointment_typesseeded with defaults - Calendar library selected and installed (recommend
@fullcalendar/reactorreact-big-calendar) - Dialog size standards confirmed: Create/Edit =
sm:max-w-lg, Waitlist =sm:max-w-md, Reminder/No-show =sm:max-w-sm
Before Phase 4 (Testing & Docs)
- All RLS tests authored for pm_appointments, pm_appointment_reminders, pm_waitlist, pm_encounters
- E2E test covers: schedule → confirm → check-in → complete flow
- Performance tested: schedule view p95 < 1s, creation p95 < 1s, availability search p95 < 2s
-
pm.adminplaceholder in/pm/settingsroute cleaned up (replaced with real permission key)
Common Mistakes
Related Integration Docs
- CL-PM-ENCOUNTER-TO-BILLING – Appointment → encounter → charge capture
- CL-PM-TELEHEALTH – Telehealth flag and session linkage
- CROSS_CORE_INTEGRATIONS.md – Integration matrix (PM ↔ CL, PF-10)
- PM-05-provider-schedule-availability-INTEGRATION.md – Provider schedule (hard prerequisite)
- EVENT_CONTRACTS.md – Canonical event payload schemas