An app to explore the results of scenarios run through the New Hospital Programme (NHP) demand model. Provides interactive charts and tables, as well as downloads.
The app is deployed to Posit Connect. You must have an account and sufficient permissions to view it.
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 app is built and maintained by members of the Strategy Unit’s Data Science team.
The app is built primarily with Shiny and
the {golem} package. Server and
UI modules can be found in R/
. Configuration files, report templates
and supporting data and text are in inst/
. The {renv}
package is used for
dependency management.
Add an .Renviron
file to the project root that contains the required
environment variables. You can get these from a member of the Data
Science team.
The outputs app is on the main
branch, but the selection app (where
users choose a scenario) is in the results_selection_app
branch. Use
Git’s worktree
function to add that branch to its own folder in your
development branch:
git fetch origin results_selection_app
git worktree add results_selection_app results_selection_app
To run the app from RStudio, start up the selection app by opening the
dev/watch.R
script, go to the ‘Background Jobs’ tab of the console
pane and click the ‘Start Background Job’ button. Hit ‘Start’ in the
‘Run Script as Background Job’ dialog box. When ready, the app will tell
you to visit http://127.0.0.1:9080/
in your browser. Note that your
selections in the app remain local to you.
If you need to remove the selection-app folder at any point, you can do that with:
git worktree remove results_selection_app
The app displays scenario-specific results to users. The user creates scenarios in the app generated by the the nhp_inputs repo, the inputs are then processed by the model found in the nhp_model repo and the subsequent results files are stored in Azure storage and read into the outputs app.
Deployment is controlled by GitHub Actions, where:
- pushes to the
main
branch redeploy the app to /nhp/dev/outputs/ for purposes of quality assurance - tagged releases trigger a new deployment to /nhp/vX-Y/outputs/, where ‘vX-Y’ is the current version (note the hyphen)