Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt

Use this file to discover all available pages before exploring further.

Feature ID: PM-05
Status: ✅ Complete (shipped 2026-02-20)
Spec: PM-05-provider-schedule-availability.md
Last Updated: 2026-05-04

Overview

PM-05 provides provider availability templates (recurring weekly), time-off and coverage, caseload tracking, panel status, and schedule conflict detection. It is consumed by PM-03 (appointment scheduling) and PM-04 (group scheduling); boundary with HR-04 (workforce scheduling) is documented only—no shared tables.

Integration Points (from Spec)

DependencyPatternPurpose
PM-03 (Appointment scheduling)Data / APIAppointment scheduling uses provider availability from PM-05
PM-04 (Group scheduling)Data / APIGroup scheduling uses facilitator availability from PM-05
HR-04 (Workforce scheduling)BoundaryPM-05 does not implement HR employee shifts; HR-04 may consume PM availability for display later; no shared tables

API / Data Contracts

  • Provider schedules: pm_provider_schedules (organization_id, provider_id, location_id, day_of_week, start_time, end_time, block_type, effective_date, end_date). Used by PM-03/PM-04 to resolve available slots.
  • Time-off: pm_provider_time_off (organization_id, provider_id, start_date, end_date, time_off_type, coverage_provider_id, status). Availability resolution excludes time-off windows.
  • Caseloads: pm_provider_caseloads (organization_id, provider_id, active_patient_count, max_caseload, panel_status). Schedulers use for panel open/closed/limited and over-assignment prevention.

Event Contracts

  • Outbound:
    • pm_time_off_requested — Published when a provider submits a time-off request. Payload: { organization_id, provider_id, time_off_id, start_date, end_date, time_off_type }.
    • pm_time_off_approved — Published when time-off is approved. Payload: { organization_id, provider_id, time_off_id, approved_by, coverage_provider_id }.
    • pm_time_off_denied — Published when time-off is denied. Payload: { organization_id, provider_id, time_off_id, denied_by }.
  • Inbound: (To be defined if PM-03/PM-04 or HR-04 need events—e.g. availability_changed.)
  • Registration: Events defined in KnownEventName (src/platform/events/types.ts) and registered in fw_workflow_events seed.

Security and RLS

  • RLS on pm_provider_schedules, pm_provider_time_off, pm_provider_caseloads with FORCE ROW LEVEL SECURITY. Uses pm_has_org_access(organization_id, auth.uid()) SECURITY DEFINER helper. UPDATE policies include WITH CHECK (constitution §5.2.4).
  • Permission keys (9 granular): pm.schedule.view/create/edit/delete, pm.time_off.view/create/edit/approve, pm.caseload.view.