National Reusable Code Library
Discover, share, and adapt healthcare data code from across the NHS. Every entry is catalogued, scored for metadata quality, and tiered for reusability, then linked to its source repository.
Featured
Synthetic Patient Generator
A Python package that generates realistic but entirely synthetic patient demographics, spells, and pathways for testing NHS data pipelines. Output conforms to NHS Data...
NHS Analytics Project Cookiecutter
A cookiecutter template that gives NHS analysts a standard project skeleton: src layout, config files, pre-commit hooks, tests, and RAP-aligned folder structure, before they...
Waiting List Discrete Event Simulation
A configurable DES model for simulating outpatient waiting list dynamics. Takes referral demand and capacity as YAML config inputs and outputs projected wait time distributions...
NHS Number Validator
A Python package for validating NHS numbers using the Modulus 11 algorithm. Handles bulk validation of Series and DataFrames, with clear error reporting for invalid formats....
Success stories
Synthetic Patient Generator
Used by four organisations to replace ad hoc copies of live data in their development environments, closing a long-standing IG audit action at each.
NHS Example Analytics CollaborativeNHS Number Validator
Adopted by six trusts as a shared dependency, eliminating 400 lines of duplicated validation code across their pipelines.
NHS Example OrganisationRecently added
A&E Daily Attendance Extract
SQL scripts to extract daily A&E attendance and four-hour performance data from a trust's local SUS mirror. Written to answer a one-off operational question but shared so...
Reusable RAP CI Workflows
A set of reusable GitHub Actions workflows for NHS analytics repositories: linting, testing, dependency audit, and Quarto/MkDocs publishing, workflows that teams call from a...
Bed Occupancy Dashboard
An R Shiny dashboard giving site managers a live view of bed occupancy, admissions, and discharges by ward. Pulls from a standard staging table and is config-driven so other...
SUS Ingest Pipeline
A Python and SQL pipeline that lands the monthly SUS extract, applies standard data quality checks, and loads conformed admitted patient care tables into a local warehouse....
Patient Data Access Audit Scanner
Python scripts that scan database audit logs to report who accessed patient records, flagging unusual patterns such as out-of-hours access or lookups of records sharing the...
RTT Waiting Times Report
A Quarto pipeline that produces the monthly referral-to-treatment waiting times report from the national RTT extract. Generates trust and specialty level breakdowns with...
Entries by reusability tier
Every entry is assessed against the reusability framework, from Baseline (discoverable) to Gold (plug-and-play). Not sure where your code sits? The framework page has a self-assessment checklist.
Where next
- Browse the catalogue and filter by tier, category, language, or platform
- Submit your code; the Baseline tier only asks that it is findable and described
- Read about the SUL principle and how the library fits together
- See the category taxonomy to find the right home for your work