From 09396c8523181a284ec2785f0d0001ba3ec20598 Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Mon, 7 Oct 2024 10:14:35 +0200 Subject: [PATCH 1/6] 301 allow treatment group to be passed as `delayed_data` (#314) Possible extension of https://github.com/insightsengineering/teal.goshawk/pull/313 for #301 --------- Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- R/tm_g_gh_boxplot.R | 13 ++++--------- R/tm_g_gh_correlationplot.R | 13 ++++--------- R/tm_g_gh_density_distribution_plot.R | 14 +++++--------- R/tm_g_gh_lineplot.R | 13 ++++--------- R/tm_g_gh_scatterplot.R | 13 ++++--------- R/tm_g_gh_spaghettiplot.R | 13 ++++--------- R/utils-templ_ui.r | 12 ++++++++++++ 7 files changed, 37 insertions(+), 54 deletions(-) diff --git a/R/tm_g_gh_boxplot.R b/R/tm_g_gh_boxplot.R index da34f7a7..b28b8c7a 100644 --- a/R/tm_g_gh_boxplot.R +++ b/R/tm_g_gh_boxplot.R @@ -206,7 +206,6 @@ tm_g_gh_boxplot <- function(label, server_args = list( dataname = dataname, param_var = param_var, - trt_group = trt_group, color_manual = color_manual, shape_manual = shape_manual, plot_height = plot_height, @@ -247,13 +246,6 @@ ui_g_boxplot <- function(id, ...) { teal.reporter::simple_reporter_ui(ns("simple_reporter")), ### templ_ui_dataname(a$dataname), - teal.widgets::optionalSelectInput( - ns("trt_group"), - label = "Select Treatment Variable", - choices = get_choices(a$trt_group$choices), - selected = a$trt_group$selected, - multiple = FALSE - ), uiOutput(ns("axis_selections")), templ_ui_constraint(ns, label = "Data Constraint"), # required by constr_anl_q if (length(a$hline_vars) > 0) { @@ -323,6 +315,7 @@ srv_g_boxplot <- function(id, resolved_y <- teal.transform::resolve_delayed(module_args$yaxis_var, env) resolved_param <- teal.transform::resolve_delayed(module_args$param, env) resolved_facet_var <- teal.transform::resolve_delayed(module_args$facet_var, env) + resolved_trt <- teal.transform::resolve_delayed(module_args$trt_group, env) templ_ui_params_vars( session$ns, @@ -334,7 +327,9 @@ srv_g_boxplot <- function(id, ychoices = resolved_y$choices, yselected = resolved_y$selected, facet_choices = resolved_facet_var$choices, - facet_selected = resolved_facet_var$selected + facet_selected = resolved_facet_var$selected, + trt_choices = resolved_trt$choices, + trt_selected = resolved_trt$selected ) }) # reused in all modules diff --git a/R/tm_g_gh_correlationplot.R b/R/tm_g_gh_correlationplot.R index d0d71c6d..773102d1 100644 --- a/R/tm_g_gh_correlationplot.R +++ b/R/tm_g_gh_correlationplot.R @@ -255,7 +255,6 @@ tm_g_gh_correlationplot <- function(label, server_args = list( dataname = dataname, param_var = param_var, - trt_group = trt_group, trt_facet = trt_facet, color_manual = color_manual, shape_manual = shape_manual, @@ -283,13 +282,6 @@ ui_g_correlationplot <- function(id, ...) { teal.reporter::simple_reporter_ui(ns("simple_reporter")), ### templ_ui_dataname(a$dataname), - teal.widgets::optionalSelectInput( - ns("trt_group"), - label = "Select Treatment Variable", - choices = get_choices(a$trt_group$choices), - selected = a$trt_group$selected, - multiple = FALSE - ), uiOutput(ns("axis_selections")), templ_ui_constraint(ns, "X-Axis Data Constraint"), # required by constr_anl_q if (length(a$hline_vars) > 0) { @@ -388,6 +380,7 @@ srv_g_correlationplot <- function(id, resolved_x_var <- teal.transform::resolve_delayed(module_args$xaxis_var, env) resolved_y_param <- teal.transform::resolve_delayed(module_args$yaxis_param, env) resolved_y_var <- teal.transform::resolve_delayed(module_args$yaxis_var, env) + resolved_trt <- teal.transform::resolve_delayed(module_args$trt_group, env) templ_ui_params_vars( session$ns, xparam_choices = resolved_x_param$choices, @@ -397,7 +390,9 @@ srv_g_correlationplot <- function(id, yparam_choices = resolved_y_param$choices, yparam_selected = resolved_y_param$selected, ychoices = resolved_y_var$choices, - yselected = resolved_y_var$selected + yselected = resolved_y_var$selected, + trt_choices = resolved_trt$choices, + trt_selected = resolved_trt$selected ) }) diff --git a/R/tm_g_gh_density_distribution_plot.R b/R/tm_g_gh_density_distribution_plot.R index 45a3531f..3ff36499 100644 --- a/R/tm_g_gh_density_distribution_plot.R +++ b/R/tm_g_gh_density_distribution_plot.R @@ -163,7 +163,6 @@ tm_g_gh_density_distribution_plot <- function(label, # nolint dataname = dataname, param_var = param_var, param = param, - trt_group = trt_group, color_manual = color_manual, color_comb = color_comb, plot_height = plot_height, @@ -196,13 +195,6 @@ ui_g_density_distribution_plot <- function(id, ...) { teal.reporter::simple_reporter_ui(ns("simple_reporter")), ### templ_ui_dataname(a$dataname), - teal.widgets::optionalSelectInput( - ns("trt_group"), - label = "Select Treatment Variable", - choices = get_choices(a$trt_group$choices), - selected = a$trt_group$selected, - multiple = FALSE - ), uiOutput(ns("axis_selections")), templ_ui_constraint(ns, label = "Data Constraint"), ui_arbitrary_lines(id = ns("hline_arb"), a$hline_arb, a$hline_arb_label, a$hline_arb_color), @@ -272,13 +264,17 @@ srv_g_density_distribution_plot <- function(id, # nolint env <- shiny::isolate(as.list(data()@env)) resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env) resolved_param <- teal.transform::resolve_delayed(module_args$param, env) + resolved_trt <- teal.transform::resolve_delayed(module_args$trt_group, env) + templ_ui_params_vars( session$ns, xparam_choices = resolved_param$choices, xparam_selected = resolved_param$selected, xparam_label = "Select a Biomarker", xchoices = resolved_x$choices, - xselected = resolved_x$selected + xselected = resolved_x$selected, + trt_choices = resolved_trt$choices, + trt_selected = resolved_trt$selected ) }) diff --git a/R/tm_g_gh_lineplot.R b/R/tm_g_gh_lineplot.R index b98c02fe..de0c0e46 100644 --- a/R/tm_g_gh_lineplot.R +++ b/R/tm_g_gh_lineplot.R @@ -209,7 +209,6 @@ tm_g_gh_lineplot <- function(label, server_args = list( dataname = dataname, param_var = param_var, - trt_group = trt_group, color_manual = color_manual, xvar_level = xvar_level, trt_group_level = trt_group_level, @@ -240,13 +239,6 @@ ui_lineplot <- function(id, ...) { teal.reporter::simple_reporter_ui(ns("simple_reporter")), ### templ_ui_dataname(a$dataname), - teal.widgets::optionalSelectInput( - ns("trt_group"), - label = "Select Treatment Variable", - choices = get_choices(a$trt_group$choices), - selected = a$trt_group$selected, - multiple = FALSE - ), uiOutput(ns("axis_selections")), uiOutput(ns("shape_ui")), radioButtons(ns("stat"), "Select a Statistic:", c("mean", "median"), a$stat), @@ -363,6 +355,7 @@ srv_lineplot <- function(id, resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env) resolved_y <- teal.transform::resolve_delayed(module_args$yaxis_var, env) resolved_param <- teal.transform::resolve_delayed(module_args$param, env) + resolved_trt <- teal.transform::resolve_delayed(module_args$trt_group, env) templ_ui_params_vars( ns, # xparam and yparam are identical, so we only show the user one @@ -372,7 +365,9 @@ srv_lineplot <- function(id, xchoices = resolved_x$choices, xselected = resolved_x$selected, ychoices = resolved_y$choices, - yselected = resolved_y$selected + yselected = resolved_y$selected, + trt_choices = resolved_trt$choices, + trt_selected = resolved_trt$selected ) }) diff --git a/R/tm_g_gh_scatterplot.R b/R/tm_g_gh_scatterplot.R index 4ef518fb..69ee14ac 100644 --- a/R/tm_g_gh_scatterplot.R +++ b/R/tm_g_gh_scatterplot.R @@ -172,7 +172,6 @@ tm_g_gh_scatterplot <- function(label, server_args = list( dataname = dataname, param_var = param_var, - trt_group = trt_group, trt_facet = trt_facet, color_manual = color_manual, shape_manual = shape_manual, @@ -196,13 +195,6 @@ ui_g_scatterplot <- function(id, ...) { teal.reporter::simple_reporter_ui(ns("simple_reporter")), ### templ_ui_dataname(a$dataname), - teal.widgets::optionalSelectInput( - ns("trt_group"), - label = "Select Treatment Variable", - choices = get_choices(a$trt_group$choices), - selected = a$trt_group$selected, - multiple = FALSE - ), uiOutput(ns("axis_selections")), templ_ui_constraint(ns), # required by constr_anl_q teal.widgets::panel_group( @@ -272,6 +264,7 @@ srv_g_scatterplot <- function(id, resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env) resolved_y <- teal.transform::resolve_delayed(module_args$yaxis_var, env) resolved_param <- teal.transform::resolve_delayed(module_args$param, env) + resolved_trt <- teal.transform::resolve_delayed(module_args$trt_group, env) templ_ui_params_vars( session$ns, # xparam and yparam are identical, so we only show the user one @@ -281,7 +274,9 @@ srv_g_scatterplot <- function(id, xchoices = resolved_x$choices, xselected = resolved_x$selected, ychoices = resolved_y$choices, - yselected = resolved_y$selected + yselected = resolved_y$selected, + trt_choices = resolved_trt$choices, + trt_selected = resolved_trt$selected ) }) diff --git a/R/tm_g_gh_spaghettiplot.R b/R/tm_g_gh_spaghettiplot.R index 5672e656..46d5344d 100644 --- a/R/tm_g_gh_spaghettiplot.R +++ b/R/tm_g_gh_spaghettiplot.R @@ -245,7 +245,6 @@ tm_g_gh_spaghettiplot <- function(label, dataname = dataname, idvar = idvar, param_var = param_var, - trt_group = trt_group, xaxis_var_level = xaxis_var_level, trt_group_level = trt_group_level, man_color = man_color, @@ -278,13 +277,6 @@ g_ui_spaghettiplot <- function(id, ...) { teal.reporter::simple_reporter_ui(ns("simple_reporter")), ### templ_ui_dataname(a$dataname), - teal.widgets::optionalSelectInput( - ns("trt_group"), - label = "Select Treatment Variable", - choices = get_choices(a$trt_group$choices), - selected = a$trt_group$selected, - multiple = FALSE - ), uiOutput(ns("axis_selections")), radioButtons( ns("group_stats"), @@ -381,6 +373,7 @@ srv_g_spaghettiplot <- function(id, resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env) resolved_y <- teal.transform::resolve_delayed(module_args$yaxis_var, env) resolved_param <- teal.transform::resolve_delayed(module_args$param, env) + resolved_trt <- teal.transform::resolve_delayed(module_args$trt_group, env) templ_ui_params_vars( session$ns, # xparam and yparam are identical, so we only show the user one @@ -390,7 +383,9 @@ srv_g_spaghettiplot <- function(id, xchoices = resolved_x$choices, xselected = resolved_x$selected, ychoices = resolved_y$choices, - yselected = resolved_y$selected + yselected = resolved_y$selected, + trt_choices = resolved_trt$choices, + trt_selected = resolved_trt$selected ) }) diff --git a/R/utils-templ_ui.r b/R/utils-templ_ui.r index a0897e99..33a385dd 100644 --- a/R/utils-templ_ui.r +++ b/R/utils-templ_ui.r @@ -30,6 +30,9 @@ templ_ui_params_vars <- function(ns, # facet_var facet_choices = NULL, facet_selected = NULL, + # trt_group + trt_choices = NULL, + trt_selected = NULL, multiple = FALSE) { if (is.null(xparam_choices) && !is.null(xchoices) && !is.null(yparam_choices)) { @@ -40,6 +43,15 @@ templ_ui_params_vars <- function(ns, ) } tagList( + if (!is.null(trt_choices)) { + teal.widgets::optionalSelectInput( + ns("trt_group"), + label = "Select Treatment Variable", + choices = trt_choices, + selected = trt_selected, + multiple = FALSE + ) + }, if (!is.null(xparam_choices)) { teal.widgets::optionalSelectInput( ns("xaxis_param"), From 60caaa6cfd3abaf1b87cec89454275750b0f0f4e Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 7 Oct 2024 08:15:21 +0000 Subject: [PATCH 2/6] [skip actions] Bump version to 0.2.0.9011 --- DESCRIPTION | 2 +- NEWS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d3382732..3fcc79e2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: teal.goshawk Title: Longitudinal Visualization `teal` Modules -Version: 0.2.0.9010 +Version: 0.2.0.9011 Date: 2024-10-07 Authors@R: c( person("Nick", "Paszty", , "nick.paszty@gene.com", role = c("aut", "cre")), diff --git a/NEWS.md b/NEWS.md index 316b6ec8..0166cbef 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.goshawk 0.2.0.9010 +# teal.goshawk 0.2.0.9011 # teal.goshawk 0.2.0 From 5a49a9c6389ed12461610dd0c09364d61134604b Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Tue, 8 Oct 2024 15:48:16 +0200 Subject: [PATCH 3/6] 302 Fix failed pipelines (#306) Fix #302 Still needed this conversation to be resolved for the revdepcheck https://github.com/insightsengineering/r-revdepcheck-action/pull/2 --------- Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> Co-authored-by: Franciszek Walkowiak Co-authored-by: 27856297+dependabot-preview[bot]@users.noreply.github.com <27856297+dependabot-preview[bot]@users.noreply.github.com> --- .github/workflows/scheduled.yaml | 1 + R/tm_g_gh_boxplot.R | 2 +- R/tm_g_gh_lineplot.R | 2 +- man/tm_g_gh_boxplot.Rd | 3 ++- man/tm_g_gh_lineplot.Rd | 3 ++- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/scheduled.yaml b/.github/workflows/scheduled.yaml index 334a8166..6bb0895c 100644 --- a/.github/workflows/scheduled.yaml +++ b/.github/workflows/scheduled.yaml @@ -81,6 +81,7 @@ jobs: insightsengineering/teal insightsengineering/teal.transform insightsengineering/teal.code + insightsengineering/teal.slice insightsengineering/teal.logger insightsengineering/teal.reporter insightsengineering/teal.widgets diff --git a/R/tm_g_gh_boxplot.R b/R/tm_g_gh_boxplot.R index b28b8c7a..c44180ef 100644 --- a/R/tm_g_gh_boxplot.R +++ b/R/tm_g_gh_boxplot.R @@ -45,7 +45,7 @@ #' #' @export #' -#' @examples +#' @examplesIf require("nestcolor") #' # Example using ADaM structure analysis dataset. #' data <- teal_data() #' data <- within(data, { diff --git a/R/tm_g_gh_lineplot.R b/R/tm_g_gh_lineplot.R index de0c0e46..6639250e 100644 --- a/R/tm_g_gh_lineplot.R +++ b/R/tm_g_gh_lineplot.R @@ -51,7 +51,7 @@ #' #' @export #' -#' @examples +#' @examplesIf require("nestcolor") #' # Example using ADaM structure analysis dataset. #' data <- teal_data() #' data <- within(data, { diff --git a/man/tm_g_gh_boxplot.Rd b/man/tm_g_gh_boxplot.Rd index 8c22d20f..ae3d097e 100644 --- a/man/tm_g_gh_boxplot.Rd +++ b/man/tm_g_gh_boxplot.Rd @@ -104,6 +104,7 @@ This teal module renders the UI and calls the functions that create a box plot a summary table. } \examples{ +\dontshow{if (require("nestcolor")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Example using ADaM structure analysis dataset. data <- teal_data() data <- within(data, { @@ -203,7 +204,7 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} } \author{ Jeff Tomlinson (tomlinsj) jeffrey.tomlinson@roche.com diff --git a/man/tm_g_gh_lineplot.Rd b/man/tm_g_gh_lineplot.Rd index 881bc6df..c307d9b6 100644 --- a/man/tm_g_gh_lineplot.Rd +++ b/man/tm_g_gh_lineplot.Rd @@ -123,6 +123,7 @@ of the relative plot height slider} This teal module renders the UI and calls the function that creates a line plot. } \examples{ +\dontshow{if (require("nestcolor")) (if (getRversion() >= "3.4") withAutoprint else force)(\{ # examplesIf} # Example using ADaM structure analysis dataset. data <- teal_data() data <- within(data, { @@ -194,7 +195,7 @@ app <- init( if (interactive()) { shinyApp(app$ui, app$server) } - +\dontshow{\}) # examplesIf} } \author{ Wenyi Liu (luiw2) wenyi.liu@roche.com From 322d202c8cdfa4d9866050f07934df652d3d768f Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 8 Oct 2024 13:49:10 +0000 Subject: [PATCH 4/6] [skip actions] Bump version to 0.2.0.9012 --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3fcc79e2..dc8bbd15 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: teal.goshawk Title: Longitudinal Visualization `teal` Modules -Version: 0.2.0.9011 -Date: 2024-10-07 +Version: 0.2.0.9012 +Date: 2024-10-08 Authors@R: c( person("Nick", "Paszty", , "nick.paszty@gene.com", role = c("aut", "cre")), person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = "aut"), diff --git a/NEWS.md b/NEWS.md index 0166cbef..fab916cd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.goshawk 0.2.0.9011 +# teal.goshawk 0.2.0.9012 # teal.goshawk 0.2.0 From ad93f3c17d2487d6e5db14f0868c9d971d8c978d Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:50:01 +0200 Subject: [PATCH 5/6] 113 adjust `toggle_slider` ranges (#315) This is solution for #133 `toggle_slider` is a component that is a sliderInput that can be toggled to become a numericInput. image image The PR fixes the issue with ranges on sliderInput that should be adjusted based on numericInput. So if slider had ranges min_sliderInput and max_sliderInput and values for numercInput are changed, so that min(numercInput) is lower than min_sliderInput or max(numercInput) is greater than max_sliderInput, then `min_sliderInput` or `max_sliderInput` should be extended for new ranges. # Example 1 min_sliderInput, max_sliderInput - on start 0, 55 image hence numericInput on start 0, 55 image numericInput changes to -5, 65 image sliderInput changes to -5, 65 image # Example 2 Continuation of the previous one, if you change numericInput from -5, 65 image to 4, 45 image sliderInput is reset (the min and max) to original 0, 55 but values are set to 4, 45 image --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> --- R/toggleable_slider.R | 5 +++++ man/toggle_slider_ui.Rd | 1 + 2 files changed, 6 insertions(+) diff --git a/R/toggleable_slider.R b/R/toggleable_slider.R index 1fb9a986..2a02ae0b 100644 --- a/R/toggleable_slider.R +++ b/R/toggleable_slider.R @@ -31,6 +31,7 @@ #' #' # use non-exported function from teal.goshawk #' toggle_slider_ui <- getFromNamespace("toggle_slider_ui", "teal.goshawk") +#' toggle_slider_server <- getFromNamespace("toggle_slider_server", "teal.goshawk") #' #' ui <- div( #' toggle_slider_ui( @@ -213,6 +214,10 @@ toggle_slider_server <- function(id, is_dichotomous_slider = TRUE) { state_high$value <- state_high$value[[2]] } if (input$toggle %% 2 == 0) { + if (input$toggle > 0) { + state_slider$max <- max(state_slider$max, state_slider$value[2]) + state_slider$min <- min(state_slider$min, state_slider$value[1]) + } do.call(updateSliderInput, c(list(session, "slider"), state_slider)) } else { if (length(state_slider$value) > 1) { diff --git a/man/toggle_slider_ui.Rd b/man/toggle_slider_ui.Rd index 4cd99955..cdea0433 100644 --- a/man/toggle_slider_ui.Rd +++ b/man/toggle_slider_ui.Rd @@ -59,6 +59,7 @@ value <- c(20.3, 81.5) # dichotomous slider # use non-exported function from teal.goshawk toggle_slider_ui <- getFromNamespace("toggle_slider_ui", "teal.goshawk") +toggle_slider_server <- getFromNamespace("toggle_slider_server", "teal.goshawk") ui <- div( toggle_slider_ui( From 31455d96fce8ccf9a1a1983e4f23744a31666323 Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 9 Oct 2024 08:51:21 +0000 Subject: [PATCH 6/6] [skip actions] Bump version to 0.2.0.9013 --- DESCRIPTION | 4 ++-- NEWS.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index dc8bbd15..4c497c78 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Type: Package Package: teal.goshawk Title: Longitudinal Visualization `teal` Modules -Version: 0.2.0.9012 -Date: 2024-10-08 +Version: 0.2.0.9013 +Date: 2024-10-09 Authors@R: c( person("Nick", "Paszty", , "nick.paszty@gene.com", role = c("aut", "cre")), person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = "aut"), diff --git a/NEWS.md b/NEWS.md index fab916cd..bcbd05af 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# teal.goshawk 0.2.0.9012 +# teal.goshawk 0.2.0.9013 # teal.goshawk 0.2.0