A web app to input the parameters needed to run scenarios through the New Hospital Programme (NHP) demand model.
The app is deployed to Posit Connect. You must have an account and sufficient permissions to view it.
Results can then be viewed in the outputs app, which is generated from the nhp_outputs repository.
You can find more information on the NHP model project information site, including a diagram of how the components of the modelling process fit together.
The guidance below is for the members of the Strategy Unit's Data Science team, who built and maintain this app.
Technically this app uses the inputs selection app packaged up for use here in directing users to either the latest (default) or a previous version that they select.
Both apps are built with Shiny and this uses
the {golem} package.
Server and UI modules can be found in R/, configuration in
inst/golem-config.yml and supporting data and text in inst/app/.
Run the app locally on your machine to test that your changes work as expected.
First, install the required packages listed in the DESCRIPTION with
pak::local_install_dev_deps(dependencies = TRUE)Then add an .Renviron file to the project root that contains the
required environment variables. Copy into it the required variables,
which are listed in the .Renviron.example. You can get the values you
need from a member of the Data Science team.
Once setup, we can run the app
source('dev/watch.R')Making selections in the app will cause values to be written to a local
json file, which will live in your local params/[development]/
directory. These scenarios will be selectable and editable in future
from your locally-run inputs selection app. They will not be available
from the deployed app.
During pre-release QA we test both apps on the server. This helps us spot any issues that are server-specific and might be overlooked if running the apps locally.
To test the unreleased app in our development environment:
- Merge any PRs you want to test into the
mainbranch. - If you’ve changed any dependencies, run
dev/generate_manifest.Rto updatemanifest.json. - If you’ve made any changes to the inputs selection app, run the
manual
deploy()call under the ‘development’ heading in thedeploy.Rscript in your selection-app development branch.
When using the dev inputs selection app on Connect, make sure to set the ‘Model Version’ dropdown to ‘dev’ in the expandable ‘Advanced Options’ box. That way you’ll be taken to the dev inputs app when you hit ‘Start’.
The app displays trust-specific data to users. The data is processed via Databricks scripts in the nhp_data repository and stored in Azure storage.
If the data updates and you need to invalidate the current cache, you
force a reset by appending ?reset_cache=true to the app’s canonical
URL at https://connect.strategyunitwm.nhs.uk/nhp/inputs/ (authorised
devs only).
Deployment is controlled by GitHub Actions in .github/workflows/,
where:
- pushes to the
mainbranch redeploy the app to /nhp/dev/inputs/ for purposes of quality assurance - tagged releases trigger a new deployment to /nhp/vX-Y/inputs/, where ‘vX-Y’ is the current version (note the hyphen)
- manual deployment is possible with
connect-publish-manual.yaml