@@ -193,7 +193,7 @@ mod_mitigators_server <- function(
193193 dplyr :: pull(.data $ peer )
194194 # nolint end
195195
196- rates_data | >
196+ rates_data() | >
197197 dplyr :: filter(
198198 .data $ strategy == .env $ strategy ,
199199 .data $ fyear == params $ start_year
@@ -301,7 +301,7 @@ mod_mitigators_server <- function(
301301 # use the rates data, filtered to the provider that has been selected
302302 trend_data <- shiny :: reactive({
303303 strategy <- shiny :: req(input $ strategy )
304- rates_data | >
304+ rates_data() | >
305305 dplyr :: filter(
306306 .data $ strategy == .env $ strategy ,
307307 .data $ provider == params $ dataset
@@ -383,21 +383,19 @@ mod_mitigators_server <- function(
383383
384384 # render the diagnoses table
385385 output $ diagnoses_table <- gt :: render_gt({
386+ data <- diagnoses_data()
387+
386388 shiny :: validate(
387389 shiny :: need(
388- diagnoses_data ,
390+ data ,
389391 message = " Insufficient or suppressed data."
390392 )
391393 )
392394
393395 strategy <- shiny :: req(input $ strategy )
394396
395- data <- diagnoses_data | >
396- dplyr :: filter(
397- .data $ provider == params $ dataset ,
398- .data $ strategy == .env $ strategy ,
399- .data $ fyear == params $ start_year
400- ) | >
397+ data <- data | >
398+ dplyr :: filter(.data $ strategy == .env $ strategy ) | >
401399 dplyr :: inner_join(
402400 lookups [[" diagnoses" ]],
403401 by = c(" diagnosis" = " diagnosis_code" )
@@ -472,30 +470,26 @@ mod_mitigators_server <- function(
472470
473471 # render the procedures table
474472 output $ procedures_table <- gt :: render_gt({
473+ data <- procedures_data()
474+
475475 shiny :: validate(
476476 shiny :: need(
477- procedures_data ,
477+ data ,
478478 message = " Insufficient or suppressed data."
479479 )
480480 )
481481
482- pd <- procedures_data
483-
484482 shiny :: validate(
485483 shiny :: need(
486- ! is.null(pd ) && nrow(pd ) > 0 ,
484+ ! is.null(data ) && nrow(data ) > 0 ,
487485 " No procedures to display"
488486 )
489487 )
490488
491489 strategy <- shiny :: req(input $ strategy )
492490
493- data <- pd | >
494- dplyr :: filter(
495- .data $ provider == params $ dataset ,
496- .data $ strategy == .env $ strategy ,
497- .data $ fyear == params $ start_year
498- ) | >
491+ data <- data | >
492+ dplyr :: filter(.data $ strategy == .env $ strategy ) | >
499493 dplyr :: left_join(
500494 lookups [[" procedures" ]],
501495 by = c(" procedure_code" = " code" )
@@ -574,12 +568,8 @@ mod_mitigators_server <- function(
574568 # render the age group pyramid plot
575569 output $ age_grp_plot <- shiny :: renderPlot({
576570 strategy <- shiny :: req(input $ strategy )
577- age_data <- age_sex_data | >
578- dplyr :: filter(
579- .data $ provider == params $ dataset ,
580- .data $ strategy == .env $ strategy ,
581- .data $ fyear == params $ start_year
582- )
571+ age_data <- age_sex_data() | >
572+ dplyr :: filter(.data $ strategy == .env $ strategy )
583573
584574 shiny :: req(nrow(age_data ) > 0 )
585575 age_pyramid(age_data )
0 commit comments