Rota AI
A hospital rostering engine that checks its own work.
Try the live demo · View the source
Overview
Rota AI builds a 13-week registrar roster against a real industrial award. A CP-SAT constraint solver generates it; a second, completely independent implementation then re-verifies every clause to the minute, straight from the solved roster. The generator and the auditor share no bookkeeping — which is the point.
That separation earned its keep during development. The auditor found a 15-day duty run the model considered legal, and a rest gap 30 minutes short of the limit that no day-granularity check could have seen. Neither is visible on a printed roster.
Nothing in the code encodes a specialty, a particular hospital, or a particular set of shift times. Night status, evening overlap and break gaps are all derived from shift geometry, so adapting the engine to another unit is a YAML edit.
Key Features
- Independent compliance auditing - Every award clause re-checked in absolute minutes by an implementation that imports nothing from the solver
- Explains infeasibility - When no legal roster exists, hard constraints are posted under assumption literals so the engine can name the clauses that conflict, in plain English
- Reproducible solves - Bit-identical results across processes and machines, via a sorted model build, a pinned seed and a deterministic-time budget
- Preferences with an honoured rate - Staff requests enter as weighted soft terms; the roster reports what share it honoured
- Leave-aware re-solving - Re-plan from a date forward with history frozen, so a mid-quarter change doesn’t reshuffle the past
- Excel output - Reproduces the unit’s own roster template, with a compliance sheet and per-registrar summary counts
- Multi-run demo workspace - Keep five rosters side by side, hand-edit any cell, and watch the auditor re-check the whole thing
Technologies
- Python
- Google OR-Tools (CP-SAT)
- Flask
- openpyxl
- Docker