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.

Module: Practice Management (PM)
Feature: PM-05 Provider Schedule & Availability
Last Updated: 2026-02-20

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)

Permission KeyCategoryDescription
pm.schedule.viewviewView provider schedule blocks
pm.schedule.createcreateCreate new schedule blocks
pm.schedule.editeditEdit existing schedule blocks
pm.schedule.deletedeleteDelete schedule blocks
pm.time_off.viewviewView time-off requests
pm.time_off.createcreateSubmit time-off requests
pm.time_off.editeditEdit pending time-off requests
pm.time_off.approveapproveApprove or deny time-off requests
pm.caseload.viewviewView provider caseload and panel status

2. Default Role Assignments

RolePermissions Granted
org_adminAll 9 permissions (auto-granted by pf_auto_grant_org_admin trigger)
managerpm.schedule.view, pm.schedule.create, pm.schedule.edit, pm.time_off.view, pm.time_off.create, pm.time_off.edit, pm.time_off.approve, pm.caseload.view (8 of 9; no delete)
staffpm.schedule.view, pm.time_off.view, pm.caseload.view (3 view-only permissions)
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.
ColumnTypeDescription
idUUIDPrimary key
organization_idUUIDTenant isolation
provider_idUUIDReferences pf_profiles
location_idUUIDOptional, references pf_sites
day_of_weekINTEGER0=Sunday through 6=Saturday
start_timeTIMEBlock start time
end_timeTIMEBlock end time
block_typeTEXTappointments, telehealth, documentation, supervision, group, administrative, on_call
effective_dateDATEWhen this block becomes active
end_dateDATEWhen this block expires (NULL = indefinite)

pm_provider_time_off

Stores time-off requests with approval workflow.
ColumnTypeDescription
idUUIDPrimary key
organization_idUUIDTenant isolation
provider_idUUIDRequesting provider
start_dateDATETime-off start
end_dateDATETime-off end
time_off_typeTEXTvacation, sick, personal, conference, other
statusTEXTpending, approved, denied
coverage_provider_idUUIDWho covers patients during absence
approved_byUUIDUser who approved/denied
notesTEXTRequest notes

pm_provider_caseloads

One row per provider tracking patient capacity.
ColumnTypeDescription
idUUIDPrimary key
organization_idUUIDTenant isolation
provider_idUUIDUnique per org+provider
active_patient_countINTEGERCurrent active patients
max_caseloadINTEGERMaximum capacity
panel_statusTEXTopen, limited, closed

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

EventTriggerPayload
pm_time_off_requestedProvider submits time-off{ organization_id, provider_id, time_off_id, start_date, end_date, time_off_type }
pm_time_off_approvedManager approves request{ organization_id, provider_id, time_off_id, approved_by, coverage_provider_id }
pm_time_off_deniedManager denies request{ organization_id, provider_id, time_off_id, denied_by }
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

IssueResolution
Provider not showing in schedule pageVerify the provider has a pf_profiles record and pf_organization_members membership
Time-off not blocking appointmentsEnsure the time-off status is approved (pending requests do not block availability)
Caseload shows 0 patientsCaseload records are created/updated as patients are assigned; verify patient-provider assignments exist
Permission denied errorsCheck that the user’s role has the required pm.schedule.* or pm.time_off.* permissions

See Also: