Using R and Python to model future hospital activity

EARL Conference 2024

5 September 2024

The New Hospital Programme (NHP)

  • A manifesto commitment
  • Future activity must be modelled
  • Need consistency across schemes

The headline of a BBC article that says 'Raac: Top floor of Kettering General Hospital Wing vacated'. There is a picture of the hospital with a caption that starts 'crumbling Raac was discovered in the roof.

::::

Diagram showing the model flow. We start with baseline activity and capacity, which flows throiugh demand-supply imbalances, demographic and non-demographic changes and finally actitivyt mitigators. The outcome is modelled future activity.

Our challenges

  • 28 hospitals currently using the model
  • Model is being developed whilst in production
  • Model is very complex - technically, and for end users

Tools and platforms

  • Data pipelines: {targets} , SQL
  • Model: Python , Docker
  • Apps: {shiny} and {golem} , Posit Connect
  • Infrastructure and storage: Azure
  • Documentation: Quarto
  • Version control and collaboration: Git , GitHub

A diagram showing the architecture of the model and apps. Data is processed from the database by the targets package and stored in an Azure storage account. the model and inputs and outputs apps collected data from there. Selections in the inputs app feed into the model.

The NHP Model Results app. On the left is a navbar with a 'home' tab and other tabs grouped under headings of 'results' and 'information'. Users can select individual sites. In the main body is a series of dropdown boxes to select the type of data to show. There's also a beeswarm plot showing the model-run distribution.

Next

  • Forecast regionally and nationally
  • Move data and pipelines into Databricks
  • Open-source model code

Thank you