In progress
Rail Pulse
A live dashboard showing punctuality, delays and disruption causes for Swedish railway stations, built on Trafikverket’s open data.
- Role
- Idea, planning and build
- When
- October 2026
- Status
- In progress
- Data
- Trafikverket Open API
The problem
In a control room the hard part is rarely getting the raw data. It’s seeing the pattern quickly: which hour went wrong, what caused it, and how many passengers were affected.
I worked as a train traffic controller at Trafikverket for almost four years. Rail Pulse is the overview I would have wanted at the start of every shift.
What it shows
The layout follows the order an operator thinks in:
- How bad is it? Punctuality, average delay, cancellations and the worst delay.
- When did it go wrong? Average delay per hour, with a line at the 5-minute limit.
- Why? The most common disruption causes, such as signal failures or track work.
- Which trains? A full departure board, filterable to show only delayed or cancelled trains.
It refreshes every minute, works on phones and has light and dark mode.
Decisions from rail experience
- On time means at most 5 minutes late, the same definition Trafikverket uses, so the numbers mean what rail people expect.
- Cancelled trains are left out of the average delay and counted separately. Counting them as 0 minutes would make a bad day look better than it was.
- Status is shown with colour, an icon and text, so it still works for colour-blind users.
- Times are always shown in Swedish time, even if the server runs somewhere else.
How it’s built
The browser never talks to Trafikverket directly. A small server route fetches the data, keeps the API key secret, caches answers for 60 seconds and cleans the raw data into one tidy format.
All the calculations live in separate functions with 15 unit tests, covering edge cases like trains exactly 5 minutes late and stations with no departures. Station input is validated so it can’t be used to change the API query.
Without an API key the app runs on realistic demo data, including a simulated signal failure, so anyone can try it straight away.
- Next.js
- TypeScript
- Tailwind CSS
- Recharts
- Vitest
Next steps
Publish the first live version. After that: an arrivals view, history to compare today with last week, and alerts when punctuality drops.