Skip to content

Commit b867dc7

Browse files
committed
Merge branch '107_heatmap_nee' of https://github.com/The-Strategy-Unit/nhp_inputs_report_app into 107_heatmap_nee
2 parents b90debe + 7f4aac8 commit b867dc7

File tree

7 files changed

+53
-32
lines changed

7 files changed

+53
-32
lines changed

CODEOWNERS

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# These owners will be the default owners for everything in
2+
# the repo. Unless a later match takes precedence,
3+
# @primary-owner and @secondary-owner will be requested for
4+
# review when someone opens a pull request.
5+
* @matt-dray @craig-parylo

DESCRIPTION

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Imports:
1515
AzureStor,
1616
bsicons,
1717
bslib (>= 0.7.0),
18+
colourpicker,
1819
config (>= 0.3.1),
1920
data.table,
2021
dplyr,

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
YEAR: 2024
2-
COPYRIGHT HOLDER: Golem User
2+
COPYRIGHT HOLDER: The Strategy Unit

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) 2024 Golem User
3+
Copyright (c) 2024 The Strategy Unit
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

R/app_ui.R

+14-14
Original file line numberDiff line numberDiff line change
@@ -615,8 +615,8 @@ app_ui <- function(request) {
615615
width = 350,
616616
open = TRUE,
617617

618-
bslib::input_switch(
619-
id = "toggle_contextual_baseline_range",
618+
shiny::checkboxInput(
619+
inputId = "toggle_contextual_baseline_range",
620620
label = bslib::tooltip(
621621
trigger = list(
622622
"Show 80% range?",
@@ -626,8 +626,8 @@ app_ui <- function(request) {
626626
),
627627
value = TRUE
628628
),
629-
bslib::input_switch(
630-
id = "toggle_contextual_baseline_quadrants",
629+
shiny::checkboxInput(
630+
inputId = "toggle_contextual_baseline_quadrants",
631631
label = bslib::tooltip(
632632
trigger = list(
633633
"Show quadrant lines?",
@@ -637,8 +637,8 @@ app_ui <- function(request) {
637637
),
638638
value = TRUE
639639
),
640-
bslib::input_switch(
641-
id = "toggle_contextual_baseline_schemecode",
640+
shiny::checkboxInput(
641+
inputId = "toggle_contextual_baseline_schemecode",
642642
label = bslib::tooltip(
643643
trigger = list(
644644
"Show scheme codes?",
@@ -693,8 +693,8 @@ app_ui <- function(request) {
693693
width = 350,
694694
open = TRUE,
695695

696-
bslib::input_switch(
697-
id = "toggle_contextual_trendline_otherschemes",
696+
shiny::checkboxInput(
697+
inputId = "toggle_contextual_trendline_otherschemes",
698698
label = bslib::tooltip(
699699
trigger = list(
700700
"Show other schemes?",
@@ -704,8 +704,8 @@ app_ui <- function(request) {
704704
),
705705
value = FALSE
706706
),
707-
bslib::input_switch(
708-
id = "toggle_contextual_trendline_horizon_timeline",
707+
shiny::checkboxInput(
708+
inputId = "toggle_contextual_trendline_horizon_timeline",
709709
label = bslib::tooltip(
710710
trigger = list(
711711
"Show horizon on timeline?",
@@ -715,8 +715,8 @@ app_ui <- function(request) {
715715
),
716716
value = TRUE
717717
),
718-
bslib::input_switch(
719-
id = "toggle_contextual_trendline_horizon_overlay",
718+
shiny::checkboxInput(
719+
inputId = "toggle_contextual_trendline_horizon_overlay",
720720
label = bslib::tooltip(
721721
trigger = list(
722722
"Show horizon as overlay?",
@@ -726,8 +726,8 @@ app_ui <- function(request) {
726726
),
727727
value = FALSE
728728
),
729-
bslib::input_switch(
730-
id = "toggle_contextual_trendline_average",
729+
shiny::checkboxInput(
730+
inputId = "toggle_contextual_trendline_average",
731731
label = bslib::tooltip(
732732
trigger = list(
733733
"Show pre-baseline average?",

README.md

+30-15
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,50 @@
22

33
<!-- badges: start -->
44
[![Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.](https://www.repostatus.org/badges/latest/wip.svg)](https://www.repostatus.org/#wip)
5-
65
<!-- badges: end -->
76

87
## Purpose
98

10-
An app to compare schemes' mitigator selections as part of the National Hospital Programme (NHP) modelling process. It's [deployed to Posit Connect](https://connect.strategyunitwm.nhs.uk/nhp/mitigator-comparisons/).
9+
An app built with [{shiny}](https://shiny.posit.co/), [{golem}](https://thinkr-open.github.io/golem/) and [{bslib}](https://rstudio.github.io/bslib/) to explore and compare schemes' mitigator selections as part of the National Hospital Programme (NHP) modelling process.
10+
11+
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.
12+
13+
The app is [deployed to Posit Connect](https://connect.strategyunitwm.nhs.uk/nhp/mitigator-comparisons/) (login/permissions required).
1114

12-
This tool is designed for use by model-relationship managers (MRMs) in discussion with schemes so that the mitigator selections can be refined before being finalised. Also, some of the scheme-level code here may support a standalone national-level report that's being developed separately.
15+
## Run the app
1316

14-
This app replaces an original static report ([deployment](https://connect.strategyunitwm.nhs.uk/nhp/mitigators-comparison-report), [source](https://github.com/The-Strategy-Unit/nhp_peers_params)) that started to become tricky to manage and interpret without interactivity.
17+
### Deploy
1518

16-
## Requirements
19+
You can redeploy the app to Posit Connect using the `dev/03_deploy.R` script.
20+
This usually happens after a new GitHub release/Git tag.
1721

18-
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.
22+
The script checks for the 'app ID' in the `rsconnect/` folder of your local project root, which is generated when you first deploy.
23+
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.
1924

20-
## Techincal
25+
### Locally
2126

22-
### Major packages
27+
You can run the app locally, but some environmental variables are needed to fetch data, for example.
28+
You will need to add a `.Renviron` file to the project directory that contains the variables named in the `.Renviron.example` file.
29+
You can ask a member of the Data Science team for the values to populate this file.
30+
Remember to restart your session after you've updated your `.Renviron` file.
2331

24-
The app is built with [{shiny}](https://shiny.posit.co/), the [{golem}](https://thinkr-open.github.io/golem/) Shiny-as-a-package framework and [{bslib}](https://rstudio.github.io/bslib/) for theming.
32+
## Data
2533

26-
### Mitigator data
34+
### Mitigators
2735

28-
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.
36+
The mitigators for each scheme's model scenarios are stored on Azure as large json files.
37+
One small element of these files is the 'params' item, which includes the mitigator selections.
2938

30-
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](https://connect.strategyunitwm.nhs.uk/nhp/tagged-runs-params-report/) has code to select the appropriate json file, extract the params and [save them as an RDS file to a pin](https://connect.strategyunitwm.nhs.uk/content/32c7f642-e420-448d-b888-bf655fc8fa8b/) on Posit Connect; it also saves [a CSV file to another pin](https://connect.strategyunitwm.nhs.uk/content/811dbaf9-18fe-43aa-bf8e-06b0df66004e/) that contains metadata about the model scenarios. The app then reads data from these pins using [the {pins} package](https://pins.rstudio.com/). A [blogpost by the Data Science team](https://the-strategy-unit.github.io/data_science/blogs/posts/2024-05-22-storing-data-safely/#posit-connect-pins) contains note on authenticating RStudio with Posit Connect, should you need to.
39+
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.
40+
[A scheduled Quarto document on Posit Connect](https://connect.strategyunitwm.nhs.uk/nhp/tagged-runs-params-report/) has code to select the appropriate json file, extract the params and [save them as an RDS file to a pin](https://connect.strategyunitwm.nhs.uk/content/32c7f642-e420-448d-b888-bf655fc8fa8b/) on Posit Connect; it also saves [a CSV file to another pin](https://connect.strategyunitwm.nhs.uk/content/811dbaf9-18fe-43aa-bf8e-06b0df66004e/) that contains metadata about the model scenarios.
41+
The app then reads data from these pins using [the {pins} package](https://pins.rstudio.com/).
42+
A [blogpost by the Data Science team](https://the-strategy-unit.github.io/data_science/blogs/posts/2024-05-22-storing-data-safely/#posit-connect-pins) contains note on authenticating RStudio with Posit Connect, should you need to.
3143

32-
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 'initial', 'intermediate' or 'final'. There's [a handy lookup table](https://connect.strategyunitwm.nhs.uk/nhp/tagged_runs/nhp-tagged-runs.html) where you can see which files have been labelled for each scheme.
44+
Schemes run many scenarios, but the app only displays data from a single json.
45+
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'.
46+
There's [a handy lookup table](https://connect.strategyunitwm.nhs.uk/nhp/tagged_runs/nhp-tagged-runs.html) (login/permissions required) where you can see which files have been labelled for each scheme.
3347

34-
### Supporting data
48+
### Supporting
3549

36-
Supporting data is fetched from Azure. This includes lookups for mitigators and schemes, as well as data from the National Elicitation Exercise (NEE).
50+
Supporting data is fetched from Azure.
51+
This includes lookups for mitigators and schemes, as well as data from the National Elicitation Exercise (NEE).

dev/03_deploy.R

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ rsconnect::deployApp(
5353
"DESCRIPTION",
5454
"app.R"
5555
),
56-
appId = rsconnect::deployments(".")$appID, # 298
56+
appId = rsconnect::deployments(".")$appID,
5757
lint = FALSE,
5858
forceUpdate = TRUE
5959
)

0 commit comments

Comments
 (0)