Skip to main content

Overview

This guide covers permission configuration, default role assignments, and administrative workflows for the PM-05 Provider Schedule & Availability feature.

1. Permission Keys (9 Granular)


2. Default Role Assignments

Custom roles can be configured via Settings → Permissions to grant any combination of these 9 keys.

3. Database Tables

pm_provider_schedules

Stores recurring weekly availability blocks.

pm_provider_time_off

Stores time-off requests with approval workflow.

pm_provider_caseloads

One row per provider tracking patient capacity.

4. RLS Policies

All three tables enforce:
  • FORCE ROW LEVEL SECURITY — Even table owners cannot bypass RLS
  • SELECT/INSERT/UPDATE/DELETE policies using pm_has_org_access(organization_id, auth.uid())
  • UPDATE WITH CHECK — Prevents reassigning organization_id across tenants

5. Domain Events

These events can be consumed by the Forms & Workflow (FW) engine for automated notifications and task creation.

6. Integration with Scheduling (PM-03/PM-04)

The availability resolution utility (src/cores/pm/utils/availability.ts) is consumed by:
  • PM-03 Appointment Scheduling: Warns when booking outside provider availability
  • PM-04 Group Session Scheduling: Validates facilitator availability
The useDoubleBookingCheck hook includes an outsideAvailability flag when the proposed time does not fall within any appointments or telehealth schedule block.

7. Troubleshooting


See Also: