Skip to main content

NHP Data

A comprehensive data processing pipeline for the New Hospital Programme (NHP) model. This project orchestrates the extraction, transformation, and preparation of data required for the model.

Built to work in pyspark on Databricks, with Hospital Episode Statistics (HES) data.

  • Admitted Patient Care (APC)
  • Outpatient Appointments (OPA)
  • Emergency Care Dataset (ECDS), and for historical trends, Accident and Emergency (AAE)
  • ONS Population Projections
  • NHS Reference Data

Architecture

The project uses Databricks Asset Bundles to manage deployment. All processing is orchestrated through Databricks workflows that can run independently, or as part of the main pipeline.

graph TD
    ref[Reference Data]
    inputs[Inputs Data]
    ecds[ECDS Data]
    ip[Inpatient Data] 
    op[Outpatient Data]
    model[Model Data Extraction]

    ref --> ecds
    ref --> ip
    ref --> op
    
    ecds --> inputs
    ip --> inputs
    op --> inputs
    
    inputs --> model

The workflows are built into a python package, with all of the code in the src/ folder. Each task in the workflows is defined as an entry point in pyproject.toml, and by convention is a main() function which takes no arguments (parameters passed in via sys.argv).

Getting Started

Prerequisites

  • Access to Databricks workspace
  • Appropriate permissions for access to the data
  • Python 3.11+
  • uv

Installation

The project is packaged as a Python wheel and deployed via Databricks bundles:

# Build the package
uv build

# Deploy to development
databricks bundle deploy --target dev

Deployment to the prod target is via GitHub actions, and should not be done manually.

Running Workflows

Run the complete data pipeline:

databricks jobs run --job-name "Generate NHP Data"

Run individual components:

# Process reference data only
databricks jobs run --job-name "Generate NHP Data (Reference Data)"

# Process emergency care data
databricks jobs run --job-name "Generate NHP Data (AAE/ECDS)"

# Extract data for modeling containers
databricks jobs run --job-name "Extract NHP for containers"

Metadata

Release files for nhp-data 5.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nhp-data 5.2.0
File Size Uploaded
nhp_data-5.2.0.tar.gz 281.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nhp-data 5.2.0
File Interpreter ABI Platform
nhp_data-5.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 494.6 kB

Release files / nhp_data-5.2.0.tar.gz

Download URL nhp_data-5.2.0.tar.gz
Size 281.7 kB
Tags Source
SHA-256 checksum
How to use checksums
2c1dfd50f58462ba836e75658d95ddd08bbe85909f28ba8a7a8501889c84fc73
BLAKE2b-256 checksum
How to use checksums
8977b88f22517b12212a895fca97798d29bb174b1e9f8a4ea4904539e7382002
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / nhp_data-5.2.0-py3-none-any.whl

Download URL nhp_data-5.2.0-py3-none-any.whl
Size 212.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
36ed537e45f25e9348e489f5f9e9f752d59f5b79096afc21420a63bf7f69f733
BLAKE2b-256 checksum
How to use checksums
e9638f3345a5233a1d7d8961340b860870eecf3d0e43d7291a24a54618b0cb27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

6.0.0

2 release files

This release

5.2.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page