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.
In this app you can:
- select an existing scenario
- create a new scenario (from scratch or from an existing one)
- choose the NHP Inputs model version to open
- launch into the correct version of the Inputs app with the selected scenario parameters
This app is the entry point for managing scenario (JSON) files and provides the most recent NHP Inputs app version as a default selection.
The selection app provides a guided workflow to:
- Pick a provider (dataset) and baseline/model years.
- Choose a scenario action:
- Create new from scratch
- Create new from existing
- Edit existing
- Set advanced options (seed, model runs, model version; user scope for power users).
- Save parameters to a temporary JSON file.
- Open the NHP Inputs app URL using that parameter file.
The app also:
- filters available providers by user groups
- shows a provider/peer map and peers list
- applies upgrade logic when older scenarios are loaded
- blocks upgrades for unsupported legacy scenarios (for example older baseline years or certain NDG - non demographic growth - variants)
The guidance below is for the members of the Strategy Unit's Data Science team, who built and maintain this app.
Technically this app routes users to either the most recent version of inputs app or, if selected, a previous version of the inputs app.
All apps are built with Shiny.
Server and UI modules can be found in R/, configuration is stored in
inst/config.yml and loaded via config::get().
Supporting data and text in inst/.
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
pkgload::load_all(export_all = FALSE, helpers = FALSE, attach_testthat = FALSE)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.
From the project root in R:
run_app()Or run app.R directly.
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.
R/app_ui.R: UI layout and controlsR/app_server.R: server logic, scenario validation, routing, and side effectsR/upgrade_params.R: version-to-version parameter migrationR/versions.R: version parsing helpersR/years.R: baseline/horizon year helpersinst/config.yml: environment configinst/default_params.json: baseline params for "Create new from scratch"inst/home.md: user-facing guidance shown in the appinst/www/: static assets (map JS and provider geojson)
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