Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions R/mod_expat_repat_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ mod_expat_repat_server <- function(
params,
providers
) {
selected_time_profile <- update_time_profile <- NULL
# nolint start: object_usage_linter.
c(selected_time_profile, update_time_profile) %<-%
mod_time_profile_server(
shiny::NS(id, "time_profile"),
params
)
# nolint end

mod_reasons_server(shiny::NS(id, "reasons"), params, "expat_repat")

shiny::moduleServer(id, function(input, output, session) {
Expand Down Expand Up @@ -102,18 +93,6 @@ mod_expat_repat_server <- function(
)
})

# update the time profile
shiny::observe({
params$time_profile_mappings[
c(
"expat",
"repat_local",
"repat_nonlocal"
)
] <- selected_time_profile()
}) |>
shiny::bindEvent(selected_time_profile())

# two reactiveValues to keep track of the slider values
# shadow_params always stores a value for each item selectable by the dropdowns
# params contains the returned values, and will contain the value from shadow_params if "include" is checked
Expand All @@ -129,9 +108,6 @@ mod_expat_repat_server <- function(
params
})

# update the selected time profile (all 3 will have the same value, so just use expat)
update_time_profile(p$time_profile_mappings[["expat"]])

default_values <- list(
expat = c(0.95, 1.0),
repat_local = c(1.0, 1.05),
Expand Down
1 change: 0 additions & 1 deletion R/mod_expat_repat_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ mod_expat_repat_ui <- function(id) {
)
),
mod_reasons_ui(ns("reasons")),
mod_time_profile_ui(ns("time_profile")),
bs4Dash::box(
collapsible = FALSE,
headerBorder = FALSE,
Expand Down
29 changes: 0 additions & 29 deletions R/mod_mitigators_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ mod_mitigators_server <- function(
mitigator_codes_lkup,
peers
) {
selected_time_profile <- update_time_profile <- NULL
# nolint start: object_usage_linter
c(selected_time_profile, update_time_profile) %<-%
mod_time_profile_server(
shiny::NS(id, "time_profile"),
params
)
# nolint end

config <- get_golem_config("mitigators_config")[[id]]

activity_type <- config$activity_type
Expand All @@ -39,7 +30,6 @@ mod_mitigators_server <- function(

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

strategies <- shiny::reactive({
# make sure a provider is selected
Expand Down Expand Up @@ -115,9 +105,6 @@ mod_mitigators_server <- function(
}
})

tpm <- params$time_profile_mappings[[mitigators_type]][[activity_type]]
time_profile_mappings$mappings <- tpm

init$destroy()
},
priority = 100
Expand Down Expand Up @@ -196,10 +183,6 @@ mod_mitigators_server <- function(
"slider",
value = values
)

update_time_profile(
time_profile_mappings$mappings[[strategy]] %||% "linear"
)
}) |>
shiny::bindEvent(input$strategy)

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

shiny::observe({
strategy <- shiny::req(input$strategy)
tp <- shiny::req(selected_time_profile())

time_profile_mappings$mappings[[strategy]] <- tp

params$time_profile_mappings[[mitigators_type]][[activity_type]][[
strategy
]] <- if (input$include) tp
}) |>
shiny::bindEvent(selected_time_profile(), input$include)

shiny::observe({
shinyjs::toggleState("slider", condition = input$include)
}) |>
Expand Down
3 changes: 1 addition & 2 deletions R/mod_mitigators_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ mod_mitigators_ui <- function(id, title, show_diagnoses_table = TRUE) {
shiny::p(),
shiny::htmlOutput(ns("slider_interval_text"))
),
mod_reasons_ui(ns("reasons")),
mod_time_profile_ui(ns("time_profile")),
mod_reasons_ui(ns("reasons"))
)
),
col_8(
Expand Down
32 changes: 0 additions & 32 deletions R/mod_run_model_fix_params.R
Original file line number Diff line number Diff line change
@@ -1,35 +1,4 @@
mod_run_model_fix_params <- function(p, schema_text) {
# the time profiles may be empty, ensure that's not the case
tpm <- p[["time_profile_mappings"]]
p[["time_profile_mappings"]][["activity_avoidance"]] <- list(
ip = tpm[["activity_avoidance"]][["ip"]] %||% list(),
op = tpm[["activity_avoidance"]][["op"]] %||% list(),
aae = tpm[["activity_avoidance"]][["aae"]] %||% list()
)
p[["time_profile_mappings"]][["efficiencies"]] <- list(
ip = tpm[["efficiencies"]][["ip"]] %||% list(),
op = tpm[["efficiencies"]][["op"]] %||% list()
)

# for a while, the wrong time profile was set for some items. force these to none
p[["time_profile_mappings"]][
c(
"baseline_adjustment",
"non-demographic_adjustment"
)
] <- "none"

# check all the mitigators have a time profile
for (i in c("activity_avoidance", "efficiencies")) {
for (j in names(p[[i]])) {
for (k in names(p[[i]][[j]])) {
if (is.null(p$time_profile_mappings[[i]][[j]][[k]])) {
p$time_profile_mappings[[i]][[j]][[k]] <- "linear"
}
}
}
}

p <- mod_run_model_remove_invalid_mitigators(p, schema_text)

# nolint start: commented_code_linter
Expand Down Expand Up @@ -77,7 +46,6 @@ mod_run_model_fix_params <- function(p, schema_text) {
"non-demographic_adjustment",
"activity_avoidance",
"efficiencies",
"time_profile_mappings",
"reasons"
)

Expand Down
64 changes: 0 additions & 64 deletions R/mod_time_profile_server.R

This file was deleted.

35 changes: 0 additions & 35 deletions R/mod_time_profile_ui.R

This file was deleted.

22 changes: 0 additions & 22 deletions R/mod_waiting_list_imbalances_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,6 @@
#'
#' @noRd
mod_waiting_list_imbalances_server <- function(id, wli_data, params) {
selected_time_profile <- update_time_profile <- NULL
# nolint start: object_usage_linter.
c(selected_time_profile, update_time_profile) %<-%
mod_time_profile_server(
shiny::NS(id, "time_profile"),
params
)
# nolint end

mod_reasons_server(
shiny::NS(id, "reasons"),
params,
Expand Down Expand Up @@ -74,26 +65,13 @@ mod_waiting_list_imbalances_server <- function(id, wli_data, params) {

# observers ----

# update the time profile
shiny::observe({
params$time_profile_mappings[[
"waiting_list_adjustment"
]] <- selected_time_profile()
}) |>
shiny::bindEvent(selected_time_profile())

# when the module is initialised, load the values from the loaded params file
init <- shiny::observe(
{
p <- shiny::isolate({
params
})

# update the selected time profile
update_time_profile(p$time_profile_mappings[[
"waiting_list_adjustment"
]])

p <- p$waiting_list_adjustment

if (length(p$ip) + length(p$op) > 0) {
Expand Down
3 changes: 1 addition & 2 deletions R/mod_waiting_list_imbalances_ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ mod_waiting_list_imbalances_ui <- function(id) {
width = 12,
md_file_to_html("app", "text", "waiting_list_imbalances.md")
),
mod_reasons_ui(ns("reasons")),
mod_time_profile_ui(ns("time_profile"))
mod_reasons_ui(ns("reasons"))
),
bs4Dash::box(
collapsible = FALSE,
Expand Down