Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Prepare for open #310

Merged
merged 3 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# These owners will be the default owners for everything in
# the repo. Unless a later match takes precedence,
# @primary-owner and @secondary-owner will be requested for
# review when someone opens a pull request.
* @tomjemmett @yiwen-h
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2025 NHS England

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
46 changes: 9 additions & 37 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,51 +1,23 @@
# New Hospitals Demand Model

<!-- badges: start -->

[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)

[![codecov](https://codecov.io/gh/The-Strategy-Unit/nhp_model/branch/main/graph/badge.svg?token=uGmRhc1n9C)](https://codecov.io/gh/The-Strategy-Unit/nhp_model)

<!-- badges: end -->

## Welcome

Welcome to the New Hospital Programme demand and capacity modelling tool. The methodology underpinning this model code is given in [the documentation](https://connect.strategyunitwm.nhs.uk/nhp/project_information/), along with a host of other technical information about the model and data that the model was built on.

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 LINK FORTHCOMING.
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)

This repo contains the model code but there are several other repositories which contain useful tools to set the [parameters of and run the model](https://github.com/The-Strategy-Unit/nhp_inputs), as well as to [explore the output of the model](https://github.com/The-Strategy-Unit/nhp_outputs).

## Running the model

To run the model locally you will need to have installed miniconda, git, and VSCode. This is assuming that you are running on Windows, steps will need to be adjusted for other platforms.

### Install

1. Install [miniconda](https://conda.io/projects/conda/en/latest/user-guide/install/windows.html). When installing, choose to install for all users, and check the box on the final page to add conda to the System PATH.
2. Install [VS Code](https://code.visualstudio.com/). You can accept the default values while installing.
3. Install [Git](https://git-scm.com/downloads). When asked to choose the default editor, you should pick a "VS Code" or "notepad", unless you know "vim".

### Set up VS Code

4. Open Visual Studio Code, on the left hand panel, press the "extensions" button (or press Ctrl+Shift+X)
5. Search for "python" and press install
6. Search for "jupyter" and press install
7. Clone the git repository: the easiest way is to press `Ctrl+Shift+p` and type "clone", you should see "Git: clone". Choose that, then choose "Clone from GitHub". Follow the prompts to #, then when it asks you to type a repository name, type `The-Strategy-Unit/nhp_model`.

### Set up Python

8. Open the repository in Visual Studio Code, then open a terminal `Terminal -> New Terminal (Ctrl+Shift+')`.
9. In the terminal
``` py
conda init
conda env create -f environment.yml
```
9. Press `Ctrl+Shift+p`, then type `Select Interpreter`. Press the down key and select `Python 3.10.4 ('nhp')`.
10. Download the data (see *Downloading the data*), and extract the contents to the project's folder.

## Running the model

The simplest way to test the model is to press `F5` in VS code. There are a number of debug profiles for testing each individual type of model (A&E, Inpatients, Outpatients), or to run all of the principal models, or run all of the models in parallel.

You can use all of the VS code debugging tools like breakpoints and the debug console. Consult the [VS code documentation](https://code.visualstudio.com/docs/python/debugging) for more on how to do this.

There is a Jupyter notebook, [`run_model.ipynb`](run_model.ipynb) which runs the models for a given params file.

## Deployment

The model is deployed to Azure Container Registry on pull requests, tagging the container as `nhp_model:dev`, and on releases its deployed to `nhp_model:v0.*.*` and `nhp_model:latest`.
Loading