Scheduling Service — User Stories
Service: scheduling-service Story prefix: SCHED-US Last updated: 2026-04-17
Stories
SCHED-US-001 — Appointment booking, rescheduling, and conflict prevention
| Field | Value |
|---|---|
| Issue type | Story |
| Summary | Book, reschedule, and cancel appointments with conflict prevention |
| Epic link | SCHED-EPIC-01 |
| Status | In Progress |
| Priority | Must |
| Story points | 8 |
| Labels | service:scheduling, type:backend, type:api, slice:S0 |
| Components | appointments, slots |
| FR references | FR-SCHED-003, FR-SCHED-004, FR-SCHED-007 |
| Legacy FR refs | FR-SCHED-003, FR-SCHED-004, FR-SCHED-007 |
| Dependencies | REG-US-001 |
User story: As a scheduler, when managing appointments, I want booking, rescheduling, and cancellation enforced with conflict rules so that schedule integrity is preserved.
Acceptance criteria (Gherkin):
- Given a free slot, when
POST /v1/appointmentsis called, then appointment is created withstatus: bookedand slot becomesbusy. - Given a busy slot, when booking is attempted, then 409
SLOT_NOT_AVAILABLEis returned. - Given an overlapping resource booking and no override permission, when booking is attempted, then 409
DOUBLE_BOOKING_DETECTED. - Given a
bookedappointment, when cancelled with reason + version, then status transitions tocancelled, slot released tofree, andappointment.cancelledevent emitted.
Technical notes:
POST /api/v1/appointments,PUT /api/v1/appointments/:id/cancel,PUT /api/v1/appointments/:id/reschedule- Atomic slot status via DB transaction + unique index
Definition of Done:
- Unit + integration tests; coverage ≥ 80%.
- Tenant isolation integration test passing.
- Contract test for
appointment.createdschema.
SCHED-US-002 — Schedule and slot governance with exceptions
| Field | Value |
|---|---|
| Issue type | Story |
| Summary | Configure resource schedules with slots and blocked-time exceptions |
| Epic link | SCHED-EPIC-02 |
| Status | In Progress |
| Priority | Must |
| Story points | 5 |
| Labels | service:scheduling, type:backend, slice:S0 |
| Components | schedules, slots, exceptions |
| FR references | FR-SCHED-001, FR-SCHED-002, FR-SCHED-009, FR-SCHED-010 |
| Legacy FR refs | FR-SCHED-001..010 |
| Dependencies | SCHED-US-001 |
User story: As an operations scheduler, when configuring resource availability, I want facility-aware schedules, slots, and exceptions so that invalid booking windows are prevented.
Acceptance criteria (Gherkin):
- Given a configured schedule exception for a public holiday, when availability is queried for that date, then no free slots are returned.
- Given a schedule with
timezone: Asia/Kabul, when slots are queried, then UTC timestamps render correctly at +04:30. - Given
providerIdandlocationIdfilters onGET /v1/slots/availability, then only matching free slots are returned.
Technical notes:
POST /api/v1/schedules,POST /api/v1/schedules/:id/exceptions,GET /api/v1/slots/availability- IANA timezone validation at schedule creation
Definition of Done:
- Unit tests for exception blocking logic; integration test for availability endpoint.
- Timezone rendering test with Asia/Kabul (+04:30).
SCHED-US-003 — Waitlist auto-fill and reminder dispatch
| Field | Value |
|---|---|
| Issue type | Story |
| Summary | Waitlist auto-fill from cancellations and reminder dispatch |
| Epic link | SCHED-EPIC-03 |
| Status | In Progress |
| Priority | Must |
| Story points | 5 |
| Labels | service:scheduling, type:backend, slice:S1 |
| Components | waitlist, reminders |
| FR references | FR-SCHED-005, FR-SCHED-006 |
| Legacy FR refs | FR-SCHED-005, FR-SCHED-006 |
| Dependencies | SCHED-US-001 |
User story: As a care access coordinator, when cancellations occur, I want waitlist candidates evaluated by priority and patients reminded so that access and communication are reliable.
Acceptance criteria (Gherkin):
- Given a waiting patient in the waitlist, when an appointment is cancelled freeing a matching slot, then
SCHEDULING.waitlist.slot-availableis emitted withwaitlistEntryId. - Given an appointment 24 hours away, when reminder cron runs, then
appointment.reminder.sentevent is emitted with correct channel. - Given patient communication consent
granted: falsefor SMS, when reminder dispatch runs, then SMS channel is skipped.
Technical notes:
POST /api/v1/waitlist, waitlist auto-fill onCancelAppointmentUseCase- Reminder dispatch async (
DispatchReminderUseCase); configurable lead time
Definition of Done:
- Integration test for waitlist auto-fill on cancellation.
- Unit test for reminder channel routing with consent check.
SCHED-US-004 — Localized and RTL-safe appointment reminders
| Field | Value |
|---|---|
| Issue type | Story |
| Summary | Generate localized and RTL-safe reminders in patient preferred language |
| Epic link | SCHED-EPIC-03 |
| Status | In Progress |
| Priority | Must |
| Story points | 3 |
| Labels | service:scheduling, type:backend, slice:S1 |
| Components | reminders, localization |
| FR references | FR-SCHED-008, FR-SCHED-011 |
| Legacy FR refs | FR-SCHED-008, FR-SCHED-011 |
| Dependencies | SCHED-US-003 |
User story: As a patient communications operator, when sending appointment reminders, I want localized and RTL-safe templates so that reminders are understandable in Dari, Pashto, and Arabic.
Acceptance criteria (Gherkin):
- Given patient
preferredLang: fa-af, when reminder is dispatched, then localefa-afis included inappointment.reminder.sentdata. - Given no patient language preference, when reminder dispatches, then facility default locale is used.
- Given RTL locale, when reminder payload includes date/time, then formatting follows locale rules (right-to-left date format).
Technical notes:
appointment.reminder.sentpayload includeslocalefield- Template rendering is downstream concern (communication-service)
Definition of Done:
- Unit tests for locale fallback chain.
- Contract test for
appointment.reminder.sentschema with locale.
SCHED-US-005 — FHIR and HL7 SIU interoperability
| Field | Value |
|---|---|
| Issue type | Story |
| Summary | FHIR Appointment/Slot read+search and HL7 SIU inbound/outbound |
| Epic link | SCHED-EPIC-04 |
| Status | To Do |
| Priority | Should |
| Story points | 8 |
| Labels | service:scheduling, type:backend, type:api, slice:S2 |
| Components | FHIR, HL7-SIU |
| FR references | FR-SCHED-012, FR-SCHED-014, FR-SCHED-015 |
| Legacy FR refs | — |
| Dependencies | SCHED-US-001, INTEROP-US-001 |
User story: As an interoperability engineer, when exchanging scheduling data with partner systems, I want complete FHIR and HL7 paths so that partner systems stay synchronized.
Acceptance criteria (Gherkin):
- Given a booked appointment, when
GET /fhir/R4/Appointment/:idis called, then FHIR R4 Appointment resource is returned with correct status. - Given an inbound SIU S12 message, when posted to
/v1/integration/hl7/siu, then appointment is created inbookedstate. - Given an appointment lifecycle event, when outbound SIU is generated by interop-service, then message includes correct ORC and AIL segments.
Technical notes:
- FHIR base path
/fhir/R4 - HL7 SIU parsed by interop-service adapter; scheduling-service receives canonical command
Definition of Done:
- FHIR Appointment read test.
- HL7 SIU inbound integration test.
- Contract test for FHIR Appointment schema.
SCHED-US-006 — Scheduling reliability and quality controls
| Field | Value |
|---|---|
| Issue type | Story |
| Summary | Meet latency, resilience, and coverage targets for production |
| Epic link | SCHED-EPIC-05 |
| Status | In Progress |
| Priority | Must |
| Story points | 5 |
| Labels | service:scheduling, type:backend, slice:S0 |
| Components | testing, observability |
| FR references | NFR-SCHED-001, NFR-SCHED-002 |
| Legacy FR refs | NFR-SCHED-001, NFR-SCHED-002 |
| Dependencies | SCHED-US-001 |
User story: As a reliability owner, when validating release readiness, I want measurable latency, resilience, and coverage evidence so that scheduling risks are controlled.
Acceptance criteria (Gherkin):
- Given availability benchmark, when measured, then p95 search latency < 1 000 ms.
- Given reminder pipeline transient failure, when retry occurs, then recovery behavior is logged and observable.
- Given CI coverage run, when executed on main, then ≥ 80% line coverage.
Technical notes:
- Outbox integration test required
- SLO alerts configured in Grafana
Definition of Done:
- All mandatory integration tests passing.
- SLO dashboards and alerts configured.
- Coverage ≥ 80%.
SCHED-ENH-US-001 — Recurring series and group session capacity
| Field | Value |
|---|---|
| Issue type | Story |
| Summary | Support recurring appointment series and group capacity limits |
| Epic link | SCHED-ENH-EPIC-01 |
| Status | To Do |
| Priority | Could |
| Story points | 13 |
| Labels | service:scheduling, type:backend, slice:S3 |
| Components | recurring, group |
| FR references | FR-SCHED-ENH-001, FR-SCHED-ENH-002 |
| Legacy FR refs | FR-SCHED-ENH-001..002 |
| Dependencies | SCHED-US-001, SCHED-US-002 |
User story: As an operations lead, when managing chronic-disease follow-up programmes, I want recurring appointment series and group capacity limits so that clinic planning is automated.
Acceptance criteria (Gherkin):
- Given a recurring series pattern, when created, then individual appointment instances are generated per schedule.
- Given a group session at capacity, when a new booking is attempted, then 409
GROUP_CAPACITY_EXCEEDEDis returned.
Definition of Done:
- Unit tests for series generation and exception handling.
- Group capacity guard integration test.