An app built with {shiny}, {golem} and {bslib} to explore and compare schemes' mitigator selections as part of the National Hospital Programme (NHP) modelling process.
This tool is designed primarily for use by model-relationship managers (MRMs) in discussion with schemes so that the mitigator selections can be refined before being finalised.
The app is deployed to Posit Connect (login/permissions required).
You can redeploy the app to Posit Connect using the dev/03_deploy.R
script.
This usually happens after a new GitHub release/Git tag.
The script checks for the 'app ID' in the rsconnect/
folder of your local project root, which is generated when you first deploy.
Otherwise you can find the ID by opening the app from the Posit Connect 'Content' page and then looking for 'Content ID' in the Settings > Info panel of the interface.
You can run the app locally, but some environmental variables are needed to fetch data, for example.
You will need to add a .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 for the values to populate this file.
Remember to restart your session after you've updated your .Renviron
file.
The mitigators for each scheme's model scenarios are stored on Azure as large json files. One small element of these files is the 'params' item, which includes the mitigator selections.
To avoid the app having to read the entire json file for each scheme's model scenario, there is a system to pre-prepare the params alone. A scheduled Quarto document on Posit Connect has code to select the appropriate json file, extract 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 note on authenticating RStudio with Posit Connect, should you need to.
Schemes run many scenarios, but the app only displays data from a single json. The correct file is read because the MRMs tell the Data Science team which particular scenario should be labelled on Azure with a 'run stage' of 'final' (the default) 'intermediate' or 'initial'. There's a handy lookup table (login/permissions required) where you can see which files have been labelled for each scheme.
Supporting data is fetched from Azure. This includes lookups for mitigators and schemes, as well as data from the National Elicitation Exercise (NEE).