GitHunt
RE

reory/nhs-performance-dashboard

An end-to-end Clinical Intelligence suite that monitors patient wait times and predicts RTT (Referral to Treatment) breaches using a high-performance DuckDB analytical engine.

πŸš€ NHS Performance Dashboard V1

License
Repo Size
FastAPI
Jinja2
TailwindCSS
Chart.js
DuckDB
Pandas
Pydantic
Faker
NHS Number
Last Commit


An end-to-end Clinical Intelligence suite that monitors patient wait times and predicts RTT (Referral to Treatment) breaches using a high-performance DuckDB analytical engine. This project features a full modular pipeline: synthetic patient generation with Faker and nhs-number validation, high-speed data processing via Polars and Pandas, and a FastAPI-powered dashboard with real-time waitlist metrics and specialty distribution charts


πŸ“Έ Screenshots

NHS Performance Dashboard
NHS Performance Dashboard
NHS Performance Dashboard
NHS Performance Dashboard


πŸ› οΈ Setup Instructions

Clone the Repository

git clone https://github.com/reory/nhs-performance-dashboard.git
cd nhs-performance-dashboard

1. Create a Virtual Environment

python -m venv venv
source venv/Scripts/activate # On mac/linux venv/bin/activate

2. Install Dependencies

pip install -r requirements.txt

Initialize the Data Engine

python generate_faker_data.py

Launch the Dashboard

Run the Uvicorn server to host the FastAPI application.

uvicorn app.main:app --reload

Navigate to http://127.0.0.1:8000 to view the live clinical suite.


πŸ“‚ Project Structure
nhs_performance_dashboard/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ main.py
β”‚   β”œβ”€β”€ database.py
β”‚   β”œβ”€β”€ models.py
β”‚   β”œβ”€β”€ routers/
β”‚   β”‚   β”œβ”€β”€ api.py
β”‚   β”‚   └── dashboard.py
β”‚   └── templates/
|       β”œβ”€β”€ html_components/
|       |    └── charts.html
|       |    β”œβ”€β”€ metrics.html
β”‚       |    β”œβ”€β”€ navbar.html
β”‚       |    β”œβ”€β”€ search_bar.html
β”‚       |    β”œβ”€β”€ table.html
|       β”œβ”€β”€ js_components/
|       |    └── charts_logic.html
|       |    β”œβ”€β”€ js_scripts.html
β”‚       |    β”œβ”€β”€ metrics.html
β”‚       |    β”œβ”€β”€ search_logic.html
β”‚       β”œβ”€β”€ base.html
|       β”œβ”€β”€ index.html
β”œβ”€β”€ data/
β”‚   └── hospital_data.db
β”œβ”€β”€ scripts/
β”‚   └── generate_faker_data.py
|   └── view_all.py
β”œβ”€β”€ tests/
|   └── conftest.py
|   └── test_clinical_logic.py
|   └── test_connection.py
|   └── test_validation.py
β”œβ”€β”€ .venv
β”œβ”€β”€ requirements.txt
β”œβ”€β”€ README.md
β”œβ”€β”€ CONTRIBUTING.md
β”œβ”€β”€ LICENCE.md
β”œβ”€β”€ pytest.ini

πŸ’» Tech Stack

  • Framework: FastAPI (High-performance Python API)
  • Database: DuckDB (In-process analytical database)
  • Validation: Pydantic & nhs-number
  • Testing: Pytest (Unit and Logic testing)
  • Frontend: Jinja2 Templates, HTML5, CSS3 (NHS Frontend Framework styles)

πŸ§ͺ Testing

Consistent with my professional workflow in the West Yorkshire Traffic Intelligence Suite,and other projects, this project includes a full Pytest suite to ensure RTT breach calculations and search logic remain modular and predictable.

pytest

🀝 Contributing

  • Contributions are welcome! If you have ideas to improve the nhs performance dashboard UI or logic:

  • Fork the Project.

  • Create your Feature Branch (git checkout -b feature/AmazingFeature).

  • Commit your Changes (git commit -m 'Add some AmazingFeature').

  • Push to the Branch (git push origin feature/AmazingFeature).

  • Open a Pull Request.


πŸ“ Notes
  • Data Privacy: This project uses synthetic data generated by Faker. No real patient data is included or required to run the demo.

  • Hybrid Data Strategy: Much like my Word Counter Vault project , this dashboard utilizes DuckDB for high-performance (Analytical) queries while using FastAPI for low-latency web responses. This ensures that complex RTT breach calculations don't block the main application thread

  • Modular Component Architecture: To ensure scalability and maintainability, the UI is architected into standalone html_components and js_components. This allows for a "plug-and-play" development cycle where individual dashboard metrics can be updated without refactoring the entire core layout.

  • Automated Validation & Testing: The system includes a full Pytest suite and nhs-number checksum validation to ensure clinical data integrityβ€”mirroring the "modular and predictable" package standards implemented in my previous projects.


πŸ—ΊοΈ Roadmap
  • Email Alerts: Auto-notify admins when a patient is nearing the 18 week threshold.

  • Predictive Analytics (ML Forecasting)
    Implement an XGBoost or Scikit-Learn model to predict potential breach "hotspots" based on historical specialty volume and seasonal trends, similar to the logic used in my Invoicing Fraud Detector.

  • Geospatial Regional Mapping
    Integrate a Folium/Leaflet map component to visualize patient distribution across West Yorkshire, allowing trust managers to identify geographical barriers to care access.


❀️ Thanks

Faker - For helping create the fake data.
The NHS Digital Community: For maintaining the open standards and logic found in the nhs-number validation libraries.
The FastAPI & NiceGUI Teams: For creating high-performance frameworks that make complex clinical dashboards possible with Python.
The Open Source Community: For the Faker and DuckDB projects, which allow developers to build and test robust systems without compromising real-world patient privacy.


Built By Roy Peters Click here for contact details😁

reory/nhs-performance-dashboard | GitHunt