modules/scheduling.mdEngineering, modules~1 min read

Module: scheduling

Part of the Travi AI Agent monolith (app/modules/scheduling/). Read 00-overview.md §3 (hard rules) before changing anything here.

Purpose Follow-up needs (appointment_requirement) vs actual appointments, matched so patients are never double-prompted; assisted booking; EHR result auto-completion.
Owns (data) appointment_requirement, appointment
Public surface /appointments, /appointments/assist
Depends on ehr_adapter (slots/results, sponsoring system only), agents (appointment agent), episode
Requirements owned APT-001/004/010
Constraining ADRs ADR-007
Key references reference/api.md

Rules that must never break

  1. Requirement ≠ appointment (APT-001). An existing or patient-reported appointment that satisfies a requirement marks it satisfied, no duplicate scheduling prompts, no false completion of the underlying clinical need.
  2. Assisted flow (APT-004). The patient never re-enters known demographics; the request is submitted with stored data and tracked as a task.
  3. Booking authority. The appointment agent may search and present options; booking/cancelling requires an explicit patient authorization event, and inventing availability is prohibited (envelope-enforced).
  4. Auto-close (APT-010). A completed result arriving from the sponsoring EHR closes the test task with evidence_class=ehr, no patient action requested.
  5. Scope. External (out-of-network) booking APIs are excluded from MVP; the assisted flow is the fallback.