Skip to main content
Version: 1.0
Last Updated: 2026-03-27
Spec: specs/pm/specs/PM-38-intake-appointment-automation-provider-matching.md
Status: ✅ 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.
Filter: PM-38 only acts when disposition = "proceed".

Published Events

pm_appointment_created

Consumers: PM-40 (pre-admission packet), PM-41 (analytics), CL-40 (clinical intake trigger).

pm_no_suitable_provider

Consumer: PM-39 (waitlist management).

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/appointments with { 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 on pm_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 CRUD
  • CE-28 event payload finalization (confirm modality_preference field name) — Resolved: field removed from payload; scheduling uses program_type and site preferences
  • SMS consent: Confirm CE-28 captures TCPA consent for automated messaging