Version: 1.0Documentation Index
Fetch the complete documentation index at: https://docs.encoreos.io/llms.txt
Use this file to discover all available pages before exploring further.
Last Updated: 2026-03-27
Spec:
specs/pm/specs/PM-38-intake-appointment-automation-provider-matching.mdStatus: ✅ Complete
Overview
PM-38 auto-schedules intake appointments after CE-28 screening approval. This document maps cross-core integration points, event contracts, API contracts, and platform layer usage.Integration Matrix
| From | To | Pattern | Event/API | Status |
|---|---|---|---|---|
| CE-28 | PM-38 | Event (FW-16) | ce_screening_completed (disposition=proceed) | 📝 Planned |
| CE-29 | PM-38 | Data (prerequisite) | pm_patients record exists before scheduling | 📝 Planned |
| PM-38 | PM-05/PM-03 | API (internal) | PM-05: query available slots; PM-03: create appointment | ✅ Complete |
| PM-38 | PM-39 | Event (FW-16) | pm_no_suitable_provider → waitlist entry | 📝 Planned |
| PM-38 | PM-40 | Event (FW-16) | pm_appointment_created → pre-admission packet | 📝 Planned |
| PM-38 | PM-41 | Data | Match log analytics consumed by PM-41 dashboards | 📝 Planned |
| PM-38 | PM-42 | Data | Coordinator task queue pulls appointment status | 📝 Planned |
| PM-38 | PM-02 | Data (optional) | Insurance acceptance data for matching | 📝 Planned |
| PM-38 | RH-01 | Data (optional) | Multi-pathway bed/program check | 📝 Planned |
Event Contracts
Consumed Events
ce_screening_completed (from CE-28 via FW-16)
Canonical schema: See CE-28 Integration and EVENT_CONTRACTS.md for the authoritative payload definition.
disposition = "proceed".
Published Events
pm_appointment_created
pm_no_suitable_provider
API Contracts
PM-05 Availability Query (consumed by PM-38)
PM-05 provides provider schedule and availability data. PM-38 queries available slots filtered by specialty, site, insurance, and configurable availability window (intake_match_availability_days).
- Returns: array of
{ provider_id, slot_time, slot_duration, location }
PM-03 Appointment Creation (consumed by PM-38)
PM-03 provides appointment CRUD. PM-38 creates intake appointments after matching.POST /api/scheduling/appointmentswith{ patient_id, provider_id, slot_time, type: 'intake', modality, site_id }- Returns:
{ appointment_id, status, appointment_time }
Coordinator Override
PATCH /api/appointments/{id}/override— See spec API Design section.
Platform Layer Usage
| Layer | Usage |
|---|---|
| FW-16 (Event) | Subscribe to ce_screening_completed; publish pm_appointment_created and pm_no_suitable_provider |
| PF-05 (Org Context) | Organization ID for tenant scoping |
| PF-30 (Permissions) | pm.intake_match.view, pm.intake_match.override, pm.intake_match.configure, pm.appointments.create, pm.appointments.confirm |
| PF-10 (Notifications) | Coordinator notifications on appointment creation, no-match, and override alerts |
Security
- All data scoped by
organization_id; RLS enforced onpm_appointment_match_log - Edge function uses service role for INSERT; SECURITY DEFINER helper for user-facing SELECT
- No PHI in event payloads beyond patient_id (resolvable by consumer with RLS)
- SMS content follows HIPAA minimum necessary standard
Dependencies
| Dependency | Required By | Status | Notes |
|---|---|---|---|
| PM-05/PM-03 API (slot query + appointment create) | Phase 1-2 | ✅ Complete | PM-05 for availability; PM-03 for appointment CRUD |
CE-28 event contract (ce_screening_completed) | Phase 2 | 📝 Planned | Payload schema above |
| CE-29 patient creation | Phase 2 | 📝 Planned | Patient must exist in pm_patients |
| PM-39 waitlist subscription | Phase 4 | 📝 Planned | Consumes pm_no_suitable_provider |
| PM-02 insurance data (optional) | Phase 1 | Degraded-ok | Default to all-insurance if unavailable |
Open Questions
PM-10 API contract finalization— Resolved: PM-05 for availability, PM-03 for appointment CRUDCE-28 event payload finalization (confirm— Resolved: field removed from payload; scheduling usesmodality_preferencefield name)program_typeand site preferences- SMS consent: Confirm CE-28 captures TCPA consent for automated messaging