· 2026
Nurse on-call scheduler
Single-file web tool that generates monthly on-call schedules for the nursing staff, accounting for skill levels, working pairs, and fixed weekly patterns.
The problem
The nurse on-call schedule is structurally more complex than the doctor one. Two reasons: the headcount is larger (~10 junior doctors versus ~20 nurses), and the “who works with whom” dimension matters in a way it doesn’t for doctor scheduling. Pairing an inexperienced nurse with another inexperienced nurse, or putting an experienced nurse on a shift with no support, is problematic both for patient safety and for working morale. On top of that, some nurses work well together and some don’t — pair by pair, this is information the charge nurse putting together the schedule has to hold in her head.
Beyond that, some nurses have fixed weekly patterns (always present on certain days, never on others); holiday shift load has to be distributed fairly; the no-consecutive-nights rule still applies; leave days and personal requests work the same as in the junior doctor scheduler. Holding all of this in mind in an Excel sheet is hard, but it had been done that way for years.
What I built
Again a single-file HTML tool, same underlying architecture as the junior doctor scheduler: opens in a browser, no install, state persists in localStorage. But the constraint model inside is much wider.
Nurses are added through the UI; each nurse is assigned a skill level from 0 to 100. Three kinds of pair rules can be defined: “unbreakable pair” (always work together), “preferred pair” (together if possible), “avoided pair” (apart if possible). Fixed weekly patterns can be defined in two forms — strictly fixed (“every Tuesday 8 hours, every Wednesday 24 hours”) or flexible (“once per week, Monday or Tuesday, 16 hours”). Leave-day and request entry works the same as in the doctor tool.
When a schedule is generated, each nurse’s total hours, weekend shifts, and holiday shifts are shown; for each shift, the team’s average and minimum skill level is computed. Excel export and monthly archive work the same as the doctor tool.
What was technically interesting
In the doctor tool the scoring function had five components; here it has thirteen. Average and minimum skill thresholds, pair violation penalties (unbreakable, preferred, and avoided each handled separately), a weekend skill anchor — the requirement that each weekend shift be built around a high-skill nurse who can carry the rest of the team — fairness of teammate-skill distribution, and the standard variance/weekend/holiday/request components. Each component’s weight can be edited by the user, which was useful in the tool’s first weeks of deployment: the charge nurse could see where the schedule was coming out wrong, adjust the weights, and regenerate.
Integrating the fixed weekly patterns into the algorithm was one of the harder parts. Nurses with fixed patterns are placed first; then the greedy assignment runs for the remaining slots. When that ordering broke down, flexible patterns started colliding with fixed ones. The fix was to design pre-placement as a distinct pass: fixed patterns are locked in, and flexible patterns take the remaining days as a pool to draw from in the next step.
The rest of the optimization structure is similar to the doctor tool: eight restarts with random seeds, then a hill-climbing pass. The iteration count is slightly higher to account for the more complex scoring function.
Outcome
The department’s nurse schedule has been built with this tool for months. The charge nurse’s job is visibly easier; what used to take two days of work is now down to about half an hour. Because skill distribution and pair rules are automatically respected, the kind of problem we used to hit much more often — “there was no experienced nurse on this shift” — has dropped sharply.
The version on this site starts as a blank template — no nurse list, no pair rules, no fixed patterns. Anyone adapting the tool for their own department has to enter all that from scratch, but the architecture is the same: once you’ve defined your staff and your rules, you can generate a schedule for any month.