Compare predictions of potentially-mitigatable activity by users of the New Hospital Programme (NHP) demand model. Intended primarily to help schemes refine and finalise their scenarios.
The app is deployed to Posit Connect (login/permissions required).
The app is built primarily with the R packages {shiny}, {golem} and {bslib}.
You must ensure you have installed all the packages listed in the DESCRIPTION.
These can be installed with pak::pak().
This repo doesn't use {renv}.
You must set some environmental variables before you can run the app locally on your machine.
To do this, add an .Renviron file to the project directory that contains the variables named in the .Renviron.example file.
You can ask a member of the Data Science team to help populate this file.
Note that you don't technically need to provide the CONNECT_API_KEY variable if you're using RStudio and have already configured your publishing account.
Remember to restart your session or run readRenviron(".Renviron") after you've updated your .Renviron file.
If you're having authorisation issues (e.g. a 403 is being returned), try clearing your tokens with AzureAuth::clean_token_directory() and try again.
Source the dev/run_dev.R script to run the app, assuming you've installed the packages and set up the environment variables.
You can redeploy the app to Posit Connect using the dev/deploy.R script.
There are two versions of the app you can deploy to:
- 'dev' for developers (login/permissions required), which you can deploy to after pull requests to check any changes
- 'prod' for users (login/permissions required), which you can deploy to after a new GitHub release/Git tag
There is a system to pre-prepare user-selected parameters ('params') data for quick access by the app. A Quarto document on Posit Connect runs on schedule to read the params and save them as an RDS file to a pin on Posit Connect. It also saves a CSV file to another pin that contains metadata about the model scenarios. The app then reads data from these pins using the {pins} package. A blogpost by the Data Science team contains a note on authenticating RStudio with Posit Connect, should you need to.
Schemes run many scenarios, but the app only displays data from a single scenario; by preference the one used in their validation report, otherwise their 'final' report. MRMs tell the Data Science team which particular results file should be labelled manually on Azure with the 'run stage' metadata There's a handy lookup table (login/permissions required) where you can see the scenario files that have been given run-stage metadata.
Some supporting data is hosted in inst/app/data/reference/.
This includes scheme lookups and data from the National Elicitation Exercise (NEE).
The lookup for Types of Mitigatable Activity (TPMAs) is sourced from the central TPMAs repository.