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
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
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
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