Double-booking, by design, cannot happen
Most scheduling systems prevent double-booking in the front-end — the booking screen checks
if the slot is taken before letting the user click. This fails the moment two receptionists
click "Book" within the same second. Medixar uses database-level optimistic locking with
compare-and-swap on the slot's booked_count column. Two parallel bookings race
for the same slot; the database serialises them; one wins, the other gets a clear 409
response and a hint to pick a different slot.
15-minute slot alignment
Every appointment window snaps to a 15-minute boundary, enforced by a regex on
scheduled_start at both DTO level and service level. Half-aligned slots
(08:23–08:50) are rejected — they create unschedulable gaps that no system can recover
gracefully from.
Provider, room, and equipment awareness
Booking a procedure that needs a specific room and a specific piece of equipment can't
succeed unless all three are free. Medixar enforces this via PostgreSQL Serializable
isolation — the read of "is the room free?" and the write of "book the room" sit inside
the same transaction. Concurrent attempts to grab the same triple lose with a
40001 serialization-failure that surfaces as a clean conflict.
Auto-backfilling waitlist
A patient cancels a 4 PM slot. The system finds the next waitlist entry that fits the provider + service + window, sends them a notification, and holds the slot for 10 minutes while they decide. The slot doesn't sit empty waiting for the next walk-in.
Promotion is atomic too — two parallel cron runs can't both promote the same waitlist entry. Compare-and-swap on the entry status guarantees exactly one wins.
Day-of-care workflow
- One-tap check-in. Receptionist marks the patient arrived; the doctor's queue updates.
- Telehealth start. Atomic transition from Confirmed → InProgress + encounter creation. Video room created outside the transaction so a video-provider failure doesn't lose the appointment.
- No-show marking. A clear post-scheduled-time button so the slot can be backfilled and the patient flagged for follow-up.
- Reschedule + cancel with audit trail and patient-side notification.
Online booking for patients
Patients can book themselves through a public-facing slot picker. Configurable per-provider: require approval before confirming, auto-approve, or hybrid (auto-approve known patients, approve new ones manually). WhatsApp and SMS reminders included.
Roster-aware availability
A doctor's availability comes from their roster, not a manually-maintained calendar. A staff- rostering change (sick day, swap, leave) flows automatically into appointment availability. Cancellations notify the patients on the affected slots.
Reporting
- No-show rate by provider, day, time-of-day.
- Slot utilisation — empty slots that should have been backfilled.
- Wait times — booked-to-actual-start delta.
- Revenue per provider per day — joined to billing automatically.