Skip to content

Commit 7b98510

Browse files
authored
Merge pull request #655 from The-Strategy-Unit/650-rm-time-profile-mod
Remove time-profiles modules and references in other modules
2 parents a9ff16b + d1a00c0 commit 7b98510

9 files changed

Lines changed: 2 additions & 211 deletions

R/mod_expat_repat_server.R

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,6 @@ mod_expat_repat_server <- function(
99
params,
1010
providers
1111
) {
12-
selected_time_profile <- update_time_profile <- NULL
13-
# nolint start: object_usage_linter.
14-
c(selected_time_profile, update_time_profile) %<-%
15-
mod_time_profile_server(
16-
shiny::NS(id, "time_profile"),
17-
params
18-
)
19-
# nolint end
20-
2112
mod_reasons_server(shiny::NS(id, "reasons"), params, "expat_repat")
2213

2314
shiny::moduleServer(id, function(input, output, session) {
@@ -102,18 +93,6 @@ mod_expat_repat_server <- function(
10293
)
10394
})
10495

105-
# update the time profile
106-
shiny::observe({
107-
params$time_profile_mappings[
108-
c(
109-
"expat",
110-
"repat_local",
111-
"repat_nonlocal"
112-
)
113-
] <- selected_time_profile()
114-
}) |>
115-
shiny::bindEvent(selected_time_profile())
116-
11796
# two reactiveValues to keep track of the slider values
11897
# shadow_params always stores a value for each item selectable by the dropdowns
11998
# params contains the returned values, and will contain the value from shadow_params if "include" is checked
@@ -129,9 +108,6 @@ mod_expat_repat_server <- function(
129108
params
130109
})
131110

132-
# update the selected time profile (all 3 will have the same value, so just use expat)
133-
update_time_profile(p$time_profile_mappings[["expat"]])
134-
135111
default_values <- list(
136112
expat = c(0.95, 1.0),
137113
repat_local = c(1.0, 1.05),

R/mod_expat_repat_ui.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ mod_expat_repat_ui <- function(id) {
6565
)
6666
),
6767
mod_reasons_ui(ns("reasons")),
68-
mod_time_profile_ui(ns("time_profile")),
6968
bs4Dash::box(
7069
collapsible = FALSE,
7170
headerBorder = FALSE,

R/mod_mitigators_server.R

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,6 @@ mod_mitigators_server <- function(
1414
mitigator_codes_lkup,
1515
peers
1616
) {
17-
selected_time_profile <- update_time_profile <- NULL
18-
# nolint start: object_usage_linter
19-
c(selected_time_profile, update_time_profile) %<-%
20-
mod_time_profile_server(
21-
shiny::NS(id, "time_profile"),
22-
params
23-
)
24-
# nolint end
25-
2617
config <- get_golem_config("mitigators_config")[[id]]
2718

2819
activity_type <- config$activity_type
@@ -39,7 +30,6 @@ mod_mitigators_server <- function(
3930

4031
shiny::moduleServer(id, function(input, output, session) {
4132
slider_values <- shiny::reactiveValues()
42-
time_profile_mappings <- shiny::reactiveValues()
4333

4434
strategies <- shiny::reactive({
4535
# make sure a provider is selected
@@ -115,9 +105,6 @@ mod_mitigators_server <- function(
115105
}
116106
})
117107

118-
tpm <- params$time_profile_mappings[[mitigators_type]][[activity_type]]
119-
time_profile_mappings$mappings <- tpm
120-
121108
init$destroy()
122109
},
123110
priority = 100
@@ -196,10 +183,6 @@ mod_mitigators_server <- function(
196183
"slider",
197184
value = values
198185
)
199-
200-
update_time_profile(
201-
time_profile_mappings$mappings[[strategy]] %||% "linear"
202-
)
203186
}) |>
204187
shiny::bindEvent(input$strategy)
205188

@@ -220,18 +203,6 @@ mod_mitigators_server <- function(
220203
}) |>
221204
shiny::bindEvent(input$slider, input$include)
222205

223-
shiny::observe({
224-
strategy <- shiny::req(input$strategy)
225-
tp <- shiny::req(selected_time_profile())
226-
227-
time_profile_mappings$mappings[[strategy]] <- tp
228-
229-
params$time_profile_mappings[[mitigators_type]][[activity_type]][[
230-
strategy
231-
]] <- if (input$include) tp
232-
}) |>
233-
shiny::bindEvent(selected_time_profile(), input$include)
234-
235206
shiny::observe({
236207
shinyjs::toggleState("slider", condition = input$include)
237208
}) |>

R/mod_mitigators_ui.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ mod_mitigators_ui <- function(id, title, show_diagnoses_table = TRUE) {
4545
shiny::p(),
4646
shiny::htmlOutput(ns("slider_interval_text"))
4747
),
48-
mod_reasons_ui(ns("reasons")),
49-
mod_time_profile_ui(ns("time_profile")),
48+
mod_reasons_ui(ns("reasons"))
5049
)
5150
),
5251
col_8(

R/mod_run_model_fix_params.R

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,4 @@
11
mod_run_model_fix_params <- function(p, schema_text) {
2-
# the time profiles may be empty, ensure that's not the case
3-
tpm <- p[["time_profile_mappings"]]
4-
p[["time_profile_mappings"]][["activity_avoidance"]] <- list(
5-
ip = tpm[["activity_avoidance"]][["ip"]] %||% list(),
6-
op = tpm[["activity_avoidance"]][["op"]] %||% list(),
7-
aae = tpm[["activity_avoidance"]][["aae"]] %||% list()
8-
)
9-
p[["time_profile_mappings"]][["efficiencies"]] <- list(
10-
ip = tpm[["efficiencies"]][["ip"]] %||% list(),
11-
op = tpm[["efficiencies"]][["op"]] %||% list()
12-
)
13-
14-
# for a while, the wrong time profile was set for some items. force these to none
15-
p[["time_profile_mappings"]][
16-
c(
17-
"baseline_adjustment",
18-
"non-demographic_adjustment"
19-
)
20-
] <- "none"
21-
22-
# check all the mitigators have a time profile
23-
for (i in c("activity_avoidance", "efficiencies")) {
24-
for (j in names(p[[i]])) {
25-
for (k in names(p[[i]][[j]])) {
26-
if (is.null(p$time_profile_mappings[[i]][[j]][[k]])) {
27-
p$time_profile_mappings[[i]][[j]][[k]] <- "linear"
28-
}
29-
}
30-
}
31-
}
32-
332
p <- mod_run_model_remove_invalid_mitigators(p, schema_text)
343

354
# nolint start: commented_code_linter
@@ -77,7 +46,6 @@ mod_run_model_fix_params <- function(p, schema_text) {
7746
"non-demographic_adjustment",
7847
"activity_avoidance",
7948
"efficiencies",
80-
"time_profile_mappings",
8149
"reasons"
8250
)
8351

R/mod_time_profile_server.R

Lines changed: 0 additions & 64 deletions
This file was deleted.

R/mod_time_profile_ui.R

Lines changed: 0 additions & 35 deletions
This file was deleted.

R/mod_waiting_list_imbalances_server.R

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22
#'
33
#' @noRd
44
mod_waiting_list_imbalances_server <- function(id, wli_data, params) {
5-
selected_time_profile <- update_time_profile <- NULL
6-
# nolint start: object_usage_linter.
7-
c(selected_time_profile, update_time_profile) %<-%
8-
mod_time_profile_server(
9-
shiny::NS(id, "time_profile"),
10-
params
11-
)
12-
# nolint end
13-
145
mod_reasons_server(
156
shiny::NS(id, "reasons"),
167
params,
@@ -74,26 +65,13 @@ mod_waiting_list_imbalances_server <- function(id, wli_data, params) {
7465

7566
# observers ----
7667

77-
# update the time profile
78-
shiny::observe({
79-
params$time_profile_mappings[[
80-
"waiting_list_adjustment"
81-
]] <- selected_time_profile()
82-
}) |>
83-
shiny::bindEvent(selected_time_profile())
84-
8568
# when the module is initialised, load the values from the loaded params file
8669
init <- shiny::observe(
8770
{
8871
p <- shiny::isolate({
8972
params
9073
})
9174

92-
# update the selected time profile
93-
update_time_profile(p$time_profile_mappings[[
94-
"waiting_list_adjustment"
95-
]])
96-
9775
p <- p$waiting_list_adjustment
9876

9977
if (length(p$ip) + length(p$op) > 0) {

R/mod_waiting_list_imbalances_ui.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ mod_waiting_list_imbalances_ui <- function(id) {
3232
width = 12,
3333
md_file_to_html("app", "text", "waiting_list_imbalances.md")
3434
),
35-
mod_reasons_ui(ns("reasons")),
36-
mod_time_profile_ui(ns("time_profile"))
35+
mod_reasons_ui(ns("reasons"))
3736
),
3837
bs4Dash::box(
3938
collapsible = FALSE,

0 commit comments

Comments
 (0)