Your First EventStorming Model
Build a small but useful model for an appointment booking process.
Scenario
A clinic wants patients to book appointments online. The clinic must prevent double-booking, allow rescheduling, and notify patients when an appointment changes.
Step 1: Add Domain Events
Place these events from left to right:
- Appointment Slot Published
- Appointment Scheduled
- Appointment Rescheduled
- Appointment Cancelled
- Patient Notified
Add a hotspot on Patient Notified if the team is unsure whether notifications are email, SMS, portal, or all three.
Step 2: Add Commands
Add commands before the events they may produce:
- Publish Appointment Slot produces Appointment Slot Published.
- Schedule Appointment produces Appointment Scheduled.
- Reschedule Appointment produces Appointment Rescheduled.
- Cancel Appointment produces Appointment Cancelled.
- Send Patient Notification produces Patient Notified.
Step 3: Add Actors And Interfaces
- Clinic Scheduler uses Scheduling Admin to publish slots.
- Patient uses Patient Booking Portal to schedule, reschedule, and cancel appointments.
- Notification Service may be an external system if Code Genie will integrate with an existing provider.
Step 4: Add Aggregates And Rules
Add an Appointment aggregate and an Appointment Slot aggregate. Then add these rules:
- A slot cannot have two active appointments.
- An appointment cannot be rescheduled after its start time.
- A cancelled appointment cannot be rescheduled.
Step 5: Add Policies
- When Appointment Scheduled, send patient notification.
- When Appointment Rescheduled, send patient notification.
- When Appointment Cancelled, release the appointment slot.
Step 6: Add Read Models And Queries
- Available Appointment Slots supports Find Available Slots.
- Patient Appointment Summary supports View My Appointments.
- Clinic Schedule supports View Daily Schedule.
Review
The model is ready for review when every command has an initiator, an aggregate, and a success event; every policy has a trigger and result; and every important user decision has a read model.