Headcode uses the HSE Fatigue Risk Index — a biomathematical model developed for the Health & Safety Executive by sleep researchers at Loughborough University. Here is what the numbers mean and how they are calculated.
The Fatigue Index is a number from 0 to 100 representing the estimated probability (%) that a worker would feel “very fatigued” during a shift. It is based on how the human sleep-wake system responds to different working patterns.
In practice, realistic scores for train drivers sit between about 15 and 65. A score of 100 would mean fatigued on every shift — it is a theoretical ceiling.
Every FI score is the sum of three components. Each contributes a value roughly between 0 and 0.20, and together they add up to the final index.
This is the dominant factor. It models the build-up of sleep debt across consecutive shifts using the RKFit biomathematical model (Kronauer & Czeisler) averaged with an empirical aircrew fatigue model.
The model tracks a “Psychomotor Vigilance Test” (PVT) score night by night — a validated proxy for cognitive performance. It degrades with sleep loss and recovers with rest. Critically, it has memory: the fatigue from Monday’s early start affects Tuesday’s score even if Tuesday is a later shift.
This captures the time-of-day effect using a cosine function applied at the midpoint of the shift. The human circadian rhythm has a performance nadir (lowest point) between approximately 02:00 and 05:00 — the same window when most serious rail incidents occur. A 04:00 start scores significantly higher on this component than a 09:00 start of identical length.
This reflects workload, attention demand, and break quality. Train driving is classified as safety-critical with continuous attention required. In estimated mode, break durations are derived from your T&Cs (30–45 minutes PNB by shift length). In enhanced mode, actual PNB times, additional breaks, and longest continuous driving blocks from your harvested job detail are used.
The cumulative model needs to know how much sleep a driver gets between shifts. Since it cannot access your actual sleep data, it estimates your likely bedtime using a formula from empirical research on shift worker sleep patterns:
The formula reflects the real-world pattern that shift workers do not go straight to bed when they get home — there is a wind-down period that scales with time of day. An afternoon finish produces a bedtime around 22:00 because people follow their normal evening routine. A late finish compresses the sleep window from both ends: bedtime is pushed later, and the next alarm is fixed.
Once bedtime is estimated, the model calculates how much sleep is possible before the next sign-on, then compares that against the population target of 8.07 hours. The shortfall becomes the sleep loss value that drives PVT degradation.
Two shifts from the same imaginary week. Monday is a straightforward afternoon turn after a rest day. Tuesday starts at 04:52 following Monday’s finish at 15:30 — giving a compliant 13h 22m rest gap, but the early start and accumulated sleep debt still push the score up sharply.
The same driver goes from FI 28 on Monday to FI 45 on Tuesday — right at the nighttime flag threshold — with a fully compliant 13h 22m rest gap between the two shifts. The rest gap is legal. The score is high anyway. This is the core insight of the FRI: compliance with minimum rest rules does not guarantee low fatigue, particularly when an afternoon finish is followed by an early morning start the next day.
The Risk Index expresses your cumulative fatigue component relative to a standard reference roster. An RI of 1.0 means your schedule carries the same cumulative fatigue risk as the reference. An RI of 2.0 means twice the reference risk.
The reference roster used in the original HSE research is a standard shift pattern common in industries like healthcare and emergency services:
| Day | Shift | Hours |
|---|---|---|
| Day 1 | Day shift | 07:00 – 19:00 (12h) |
| Day 2 | Day shift | 07:00 – 19:00 (12h) |
| Day 3 | Night shift | 19:00 – 07:00 (12h) |
| Day 4 | Night shift | 19:00 – 07:00 (12h) |
| Days 5–8 | Rest | — |
Export your work plan from TRACS and upload it directly. Headcode derives break times from your T&C agreement (PNB by shift length). Good for a quick overview.
Run the harvester script on your TRACS work plan page. It fetches actual job details for every shift and downloads both files automatically.
The harvester works in Chrome, Firefox, Edge, and Safari. It does not work on mobile. Make sure you are already logged in to TRACS before continuing.
Open the Work Plan section in TRACS. Set the date range you want to analyse — this should match the period you want to export. The harvester will only capture shifts visible on screen.
This is a built-in developer tool in every desktop browser. It sounds technical but it is just a text input where you paste a single line.
F12, then click the Console tabF12, then click ConsoleCmd + Option + K, then click ConsoleCmd + Option + CF12, then click ConsoleYou should see a flashing cursor at the bottom of the console panel. If you see a warning about pasting, type allow pasting and press Enter first, then continue.
Copy the line below, paste it into the console, and press Enter. Do not close the browser tab while it runs.
You will see log messages appearing in the console as it works through each shift. For a full year this typically takes 2–4 minutes.
When the harvester finishes it downloads headcode-harvest.json and then automatically triggers the CSV export from TRACS. Both files will appear in your downloads folder. If the CSV does not download automatically, click Export to CSV on the TRACS page manually.
Go to the Fatigue Analyser and drop both files onto the upload zone at the same time, or use the two file inputs to select them separately. The analyser will detect both files and run in enhanced mode.
The FRI algorithm is a faithful JavaScript translation of the VBA spreadsheet published by the Health & Safety Executive (Crown Copyright 2005, Version 2.3), based on research by Folkard, Lombardi & Tucker published as HSE Research Report RR446 (2006). The biomathematical constants are taken directly from the published workbook.
Headcode applies the model to train driving using fixed parameters for safety-critical, continuous-attention roles. In enhanced mode, actual job data replaces these defaults where available.
Limitations to be aware of: