NHS Wait Times
A data dashboard visualizing NHS hospital wait times across 500+ providers and 24 specialties—built with Next.js 16, Recharts, and a Python data pipeline processing official RTT statistics.
507
Providers
24
Specialties
62%
Within 18wk
Overview
The Problem
NHS publishes wait time data as massive CSV files with millions of rows. The raw data is inaccessible to patients, journalists, and researchers who want to understand how long they might wait at their local hospital.
The Solution
A searchable dashboard that processes 12 months of RTT data into interactive charts. Users can search by hospital, compare providers side-by-side, and drill into specialty-level wait times.
My Role
Sole developer — built the Python data pipeline, designed the JSON schema, implemented 4 Next.js pages with interactive Recharts visualizations, and deployed to Vercel.
Key Deliverables
A Python pipeline processing raw CSVs into optimized JSON, 4 interactive pages (home, hospital detail, specialty view, comparison), fuzzy search across 500+ providers, and responsive chart components.
Architecture & Design Decisions
Every architectural choice was driven by one question: how do we make millions of rows of NHS data instantly accessible and understandable?
Key Technical Decisions
Static JSON Over Database
NHS data updates monthly, not in real-time. Pre-processing CSVs into static JSON files eliminates database costs and complexity while enabling instant page loads with zero cold starts.
Python + TypeScript Split
Python handles the heavy data parsing (pandas-like CSV processing) while TypeScript handles the frontend. Each language plays to its strengths — data munging vs. type-safe UI.
Server Components First
Data loading happens in React Server Components, keeping JSON parsing off the client bundle. Only interactive chart components use 'use client' — minimizing JavaScript shipped to the browser.
Recharts for Visualization
Recharts provides composable, React-native chart components with built-in responsiveness and tooltips. No need to learn a separate charting DSL — it's just JSX.
Parse-Time Aggregation
Statistics like 18-week compliance rates and median wait times are computed once during the Python parse step, not on every page load. The frontend simply reads pre-calculated values.
Engineering Principles
Process Once, Read Many
Heavy computation happens in the build pipeline, not at request time — pre-calculate everything the UI needs
Type the Boundaries
TypeScript interfaces define the JSON schema contract between the Python pipeline and the Next.js frontend
Progressive Disclosure
National stats → hospital list → hospital detail → specialty breakdown — each level reveals more detail
Mobile-First Charts
ResponsiveContainer ensures charts adapt to any viewport — critical when most NHS patients check on their phones
The Data Pipeline
Transforming raw NHS CSV files into optimized JSON that powers instant dashboard loads—all computed once at build time.
Download CSVs
Fetch 12 monthly RTT CSV files from NHS England's public data portal. Each file contains hundreds of thousands of rows covering every provider-specialty-commissioner combination.
Why: Using official Incomplete Pathways (Part 2) data — patients still waiting for treatment.
Parse & Filter
Read each CSV with Python, filtering to only Incomplete Pathways rows. Extract provider codes, specialty codes, and the wait time distribution columns (0-1 weeks through 52+ weeks).
Why: Filtering early reduces memory usage and keeps only the data the dashboard actually needs.
Aggregate
Sum wait time counts across all commissioners for each provider-specialty pair. This collapses the commissioner dimension, giving one row per provider per specialty per month.
Why: Patients care about their hospital's total wait, not which CCG referred them.
Compute Statistics
Calculate 18-week compliance rates, estimated median wait times, and total patients waiting from the aggregated distribution data. These become the headline numbers on each page.
Why: Pre-computing stats means the frontend never needs to process raw distributions.
Output JSON
Write structured JSON files: providers.json (hospital list with stats), trends.json (monthly time series), and metadata.json (specialty names, national averages). Ready for Next.js to import.
Why: Three focused files instead of one monolith — each page loads only what it needs.
Features in Action
Three scenarios showing how users interact with the dashboard—from search to deep comparison.
Hospital Search
Fuzzy search across 500+ NHS providers. Users can type partial names, handle typos, and instantly find their local hospital — no need to know the exact NHS provider code.
Search: "guys and st thomas"
Results:
1. Guy's and St Thomas' NHS Foundation Trust
├─ 18-week: 58.2% | Median: 14.3 wks
└─ Total waiting: 142,847 patients
2. St Thomas' Medical Group
├─ 18-week: 71.4% | Median: 11.2 wks
└─ Total waiting: 3,241 patientsHospital Detail Drill-Down
Click any hospital to see a full breakdown — headline stats, a 12-month trend chart, and wait times for each specialty. Progressive disclosure lets users go as deep as they need.
Hospital: Guy's and St Thomas' NHS Trust
18-Week Compliance: 58.2% (national: 62.4%)
Median Wait: 14.3 weeks
Total Waiting: 142,847
Trend: [chart showing 12-month compliance]
Specialties:
Ophthalmology 42.1% ▼
Trauma & Orthopaedics 51.3% ▼
General Surgery 63.7% ▲
Cardiology 71.2% ▲Side-by-Side Comparison
Compare up to 3 hospitals on the same chart. Overlaid trend lines make it easy to see which hospital is improving and which is falling behind — useful for patients choosing where to be referred.
Comparing: [1] Guy's and St Thomas' [2] King's College Hospital [3] University College London 18-Week Compliance Trends: Month Guy's King's UCL Jan 55.1% 48.3% 61.2% Mar 56.8% 50.1% 62.4% Jun 57.4% 52.7% 60.8% Sep 58.0% 55.2% 63.1% Dec 58.2% 56.8% 64.5%
Development Process
Data Pipeline
Built the Python script to parse NHS RTT CSVs, aggregate across commissioners, compute statistics, and output structured JSON. Iterated on the schema until it matched exactly what the frontend needed.
Core Pages
Implemented 4 Next.js routes: homepage with search and national stats, hospital detail with specialty breakdown, specialty ranking view, and side-by-side comparison page.
Visualization
Built responsive Recharts components for trend lines, bar charts, and comparison overlays. Added custom tooltips, color-coded compliance indicators, and mobile-friendly layouts.
Search & Polish
Implemented fuzzy search with Fuse.js, added loading states, refined the responsive layout for mobile users, and deployed to Vercel with optimized static file serving.
Key Technical Features
Five capabilities that turn raw NHS data into an accessible, interactive dashboard.
Data Pipeline
Python script processes 12 months of NHS RTT CSVs into optimized JSON — aggregating across commissioners, computing statistics, and outputting files ready for the frontend.
Interactive Charts
Recharts-powered trend lines and bar charts with custom tooltips, responsive containers, and color-coded compliance indicators that adapt to any screen size.
Fuzzy Search
Fuse.js-powered search across 500+ hospital names with typo tolerance and instant results. Users find their local hospital without knowing the exact NHS provider name.
Hospital Comparison
Compare up to 3 hospitals side-by-side with overlaid trend lines. Patients and researchers can instantly see which providers are improving or falling behind.
Server Component Architecture
Data loading happens in React Server Components, keeping JSON parsing off the client. Only chart components use 'use client' — minimizing the JavaScript bundle.
Tech Stack & Architecture
Four layers working together—from raw CSV data to interactive browser charts.
Data Layer
- •Python 3 (CSV parsing)
- •NHS RTT CSV files
- •Static JSON output
- •12 months of data
Frontend Layer
- •Next.js 16 App Router
- •React 19
- •TypeScript
- •Tailwind CSS v4
Visualization Layer
- •Recharts 3
- •Responsive containers
- •Custom tooltips
- •Fuse.js fuzzy search
Infrastructure Layer
- •Vercel (hosting)
- •Static file serving
- •GitHub (source)
- •No database needed
Learnings & Outcomes
What I Learned
- Building a data pipeline taught me to think about data shape before writing any frontend code — the JSON schema drives everything
- React Server Components are perfect for data dashboards — heavy JSON parsing stays on the server, only interactive charts need client JS
- Recharts' composable API made complex visualizations approachable — trend lines, tooltips, and responsive layouts with just JSX
- Public data is messy — NHS CSVs have inconsistent provider names, missing months, and edge cases that require defensive parsing
- Progressive disclosure (national → hospital → specialty) keeps the dashboard from being overwhelming despite having 500+ providers
- Managing comparison state across URL params taught me practical patterns for shareable, bookmarkable dashboard views
Skills Demonstrated
Explore NHS Wait Times
Search hospitals, compare providers, and explore the data yourself.