https://github.com/the-strategy-unit/nhp_model
New Hospital Programme demand model
https://github.com/the-strategy-unit/nhp_model
Last synced: about 1 month ago
JSON representation
New Hospital Programme demand model
- Host: GitHub
- URL: https://github.com/the-strategy-unit/nhp_model
- Owner: The-Strategy-Unit
- License: mit
- Created: 2022-02-04T13:52:42.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-19T16:44:55.000Z (over 1 year ago)
- Last Synced: 2025-03-19T17:38:50.651Z (over 1 year ago)
- Language: Python
- Homepage: https://connect.strategyunitwm.nhs.uk/nhp/project_information/
- Size: 2.18 MB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 24
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.txt
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# The New Hospital Programme Demand Model
[](https://www.repostatus.org/#active) [](https://codecov.io/gh/The-Strategy-Unit/nhp_model)
## Welcome
Welcome to the [New Hospital Programme demand and capacity modelling tool](https://www.strategyunitwm.nhs.uk/new-hospital-programme-demand-model).

This repository contains the model code but there are several other repositories which contain useful tools to [explore the data underpinning and set the parameters for the model](https://github.com/The-Strategy-Unit/nhp_inputs), as well as to [explore model outputs](https://github.com/The-Strategy-Unit/nhp_outputs). [An overview of how the different tools interact with each other is available](https://connect.strategyunitwm.nhs.uk/nhp/project_information/project_plan_and_summary/components-overview.html).
The methodology underpinning this model is outlined in this [simple one page explainer](https://connect.strategyunitwm.nhs.uk/nhp_model_explainer/). We have a more technical [project information site](https://connect.strategyunitwm.nhs.uk/nhp/project_information/) which includes further details about the model and the data that the model was built on.
## Running the model
### For external users
Although all the code is available openly, it is challenging to run the model if you do not have access to the data and infrastructure at the Strategy Unit.
We use national [Hospital Episode Statistics](https://digital.nhs.uk/services/data-access-request-service-dars/dars-products-and-services/data-set-catalogue/hospital-episode-statistics) data which goes through extensive processing, as detailed in the [nhp_data repository](https://github.com/The-Strategy-Unit/nhp_data).
Some of the types of potentially mitigable activity rely on having access to the full national dataset, not just a local dataset.
Without this data and infrastructure, your data will not be correctly formatted to run in the model.
[We are working on providing synthetic data](https://github.com/The-Strategy-Unit/nhp_model/issues/347) so that interested parties can run the model locally to see how it works.
Prospective users of the model should [contact the Strategy Unit](mailto:strategy.unit@nhs.net) to enquire about using the model on our existing infrastructure.
Please note that it is important that the parameters of the model are set with great care and with proper support. It is important also that healthcare system partners are appropriately involved in parameter setting. For a description of the full process and support provision that is necessary to ensure the model functions well please see the [NHS Futures workspace](https://future.nhs.uk/NewHospitalProgrammeDigital/browseFolder?fid=53572528&done=OBJChangesSaved)
### For internal users with full access to correctly formatted data
Assuming you have your data in the correct format, store it in the `data` folder. [Further details on the correct formatting for the data to follow](https://github.com/The-Strategy-Unit/nhp_model/issues/419).
The model runs using parameters that are set in a [JSON file](#json-schema).
### Running the model using `uv`
This package is built using [`uv`](https://docs.astral.sh/uv/). If you have `uv` installed, run the model using: `uv run -m nhp.model path/to/params.json -d path/to/data`
### Running the model without `uv`
1. Install the `nhp_model` package using `pip install .`
1. Run the model using: `python -m nhp.model path/to/params.json -d path/to/data`
## Deployment
The model is deployed to Azure Container Registry and GitHub Container Registry on pull requests, tagging the container as `nhp_model:dev`, and on releases its deployed to `nhp_model:v*.*.*` and `nhp_model:latest`.
## JSON Schema
Parameters for the model are set in JSON format; an example can be seen in `src/nhp/model/params/params-sample.json`. As the model develops, requirements for this JSON file change over time. We use [JSON schema](https://json-schema.org/understanding-json-schema/about) to manage changes to the parameters file. From model v3.5 onwards, these are deployed to GitHub pages, following this pattern:
- on merge to `main`, the schema is deployed to `https://the-strategy-unit.github.io/nhp_model/dev/params-schema.json`
- on release of new model version vX.X, the schema is deployed to `https://the-strategy-unit.github.io/nhp_model/vX.X/params-schema.json`