- Shipped
- August 25, 2026 at 5:43 PM UTC
- Author
- Kamo
- Commit
- b0fb58c
Availability stays as RULES. ScheduleBlock describes a provider's day and slots are computed for the window being viewed; pre-materialising five-minute slots for forty providers across a year is tens of millions of rows that go stale the moment someone changes their Tuesday. Only booked time is a row. The block's times are wall-clock LocalTime with a named IANA zone, because "clinic starts at 8am" has to survive daylight saving — a practice that stored instants finds its whole Monday an hour off twice a year. Overbooking is modelled as slotCapacity rather than left as a check to defeat, because clinics deliberately double-book against expected no-shows and an unmodelled policy just moves the workaround somewhere unauditable. Visit types are practice-configured, not an enum. Hard-coding them is the most common reason a scheduling module cannot be sold to a second specialty: dermatology books Mohs stages, OB books anatomy scans, each with its own duration, room requirement and prep instructions. patientBookable defaults FALSE — a new type appearing on the public booking page the moment it is created is how a stranger gets booked into a procedure slot. The duration is COPIED onto the appointment at booking, so editing the policy never silently moves appointments already on the book. Appointment keeps cancelledBy separate from status because a no-show, a patient cancellation and a practice cancellation carry completely different money and different obligations — a no-show may be billable and counts against the patient's standing, a practice cancellation creates a duty to rebook. Eligibility is verified per VISIT, not per patient: coverage lapses between visits, and a stale check is how a practice discovers at billing time that it saw an uninsured patient for free. The waitlist exists because a cancellation twelve hours out is almost never filled by a human calling down a list, and an empty slot is unrecoverable revenue and an unseen patient at the same time. Offers expire: one unanswered offer blocking a slot while nobody else hears about it is what makes most waitlists worse than useless. Offers respect the patient's stated constraints, because offering a Tuesday to someone who said Mondays trains them to ignore the messages and costs the practice the whole list. PatientRecall is the last piece and the one most systems skip. "Come back in six months" is the most-lost instruction in medicine — said at the end of a visit, written in a note nobody re-reads, then left to the patient to remember. It is deliberately NOT a far-future appointment: that is inventory the practice cannot use and the patient will not keep. It is an obligation with a due date, an outreach window that starts late enough not to train people to ignore it, a counted outreach history, and a closure reason that stops "no longer due" from quietly meaning "we gave up". 1781 tests green.