From 44ab94d4fbfbb9963e024afc243d2e41368c56c3 Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 11 Jul 2025 09:36:02 +0200 Subject: [PATCH 01/28] set Remotes and vbump packages --- DESCRIPTION | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a0ba2066..1e2deea1 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,7 +24,7 @@ Depends: osprey (>= 0.1.17), R (>= 3.6), shiny (>= 1.6.0), - teal (>= 0.16.0), + teal (>= 0.16.0.9003), teal.transform (>= 0.6.0) Imports: bslib (>= 0.8.0), @@ -34,11 +34,11 @@ Imports: ggplot2 (>= 3.4.0), lifecycle (>= 0.2.0), shinyvalidate, - teal.code (>= 0.6.1), - teal.data (>= 0.7.0), + teal.code (>= 0.6.1.9002), + teal.data (>= 0.7.0.9002), teal.logger (>= 0.4.0), - teal.reporter (>= 0.4.0), - teal.widgets (>= 0.4.3), + teal.reporter (>= 0.4.0.9004), + teal.widgets (>= 0.4.3.9001), tern (>= 0.9.7), tidyr (>= 0.8.3) Suggests: @@ -48,7 +48,12 @@ Suggests: testthat (>= 3.2.3), withr (>= 2.0.0) Remotes: - insightsengineering/osprey + insightsengineering/osprey, + insightsengineering/teal.code@main, + insightsengineering/teal.data@main, + insightsengineering/teal@teal_reportable, + insightsengineering/teal.reporter@teal_reportable, + insightsengineering/teal.widgets@main Config/Needs/verdepcheck: insightsengineering/osprey, rstudio/shiny, insightsengineering/teal, insightsengineering/teal.slice, insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr, From dbc0f5d8c0e55836939760cbd22fb5febffa8c1f Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 11 Jul 2025 10:30:04 +0200 Subject: [PATCH 02/28] initial attempt --- R/tm_g_ae_oview.R | 46 ++++++++++++++------------------ R/tm_g_ae_sub.R | 45 +++++++++++++------------------ R/tm_g_butterfly.R | 57 ++++++++++++++-------------------------- R/tm_g_events_term_id.R | 45 +++++++++++++------------------ R/tm_g_heat_bygrade.R | 45 +++++++++++++------------------ R/tm_g_patient_profile.R | 45 +++++++++++++------------------ R/tm_g_spiderplot.R | 57 ++++++++++++++-------------------------- R/tm_g_swimlane.R | 49 +++++++++++++--------------------- R/tm_g_waterfall.R | 53 +++++++++++++------------------------ 9 files changed, 165 insertions(+), 277 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 63e0beeb..109c38aa 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -13,6 +13,7 @@ #' sub-groups (e.g. Serious events, Related events, etc.) #' #' @inherit argument_convention return +#' @inheritSection teal::example_module Reporting #' #' @export #' @@ -129,9 +130,6 @@ ui_g_ae_oview <- function(id, ...) { plot_decorate_output(id = ns(NULL)) ), encoding = tags$div( - ### Reporter - teal.reporter::simple_reporter_ui(ns("simple_reporter")), - ### teal.widgets::optionalSelectInput( ns("arm_var"), "Arm Variable", @@ -197,14 +195,10 @@ ui_g_ae_oview <- function(id, ...) { srv_g_ae_oview <- function(id, data, - filter_panel_api, - reporter, dataname, label, plot_height, plot_width) { - with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") - with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") checkmate::assert_class(data, "reactive") checkmate::assert_class(isolate(data()), "teal_data") @@ -339,25 +333,23 @@ srv_g_ae_oview <- function(id, verbatim_content = reactive(teal.code::get_code(output_q())), title = paste("R code for", label) ) - ### REPORTER - if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "AE Overview", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) - card$append_text("Plot", "header3") - card$append_plot(plot_r(), dim = pws$dim()) - if (!comment == "") { - card$append_text("Comment", "header3") - card$append_text(comment) - } - card$append_src(teal.code::get_code(output_q())) - card - } - teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) - } + output_q + + # card_fun <- function(comment, label) { + # card <- teal::report_card_template( + # title = "AE Overview", + # label = label, + # with_filter = with_filter, + # filter_panel_api = filter_panel_api + # ) + # card$append_text("Plot", "header3") + # card$append_plot(plot_r(), dim = pws$dim()) + # if (!comment == "") { + # card$append_text("Comment", "header3") + # card$append_text(comment) + # } + # card$append_src(teal.code::get_code(output_q())) + # card + # } }) } diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index ee3c5024..923eff4f 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -14,6 +14,7 @@ #' @author Molly He (hey59) \email{hey59@gene.com} #' #' @inherit argument_convention return +#' @inheritSection teal::example_module Reporting #' #' @export #' @@ -105,9 +106,6 @@ ui_g_ae_sub <- function(id, ...) { plot_decorate_output(id = ns(NULL)) ), encoding = tags$div( - ### Reporter - teal.reporter::simple_reporter_ui(ns("simple_reporter")), - ### tags$label("Encodings", class = "text-primary"), helpText("Analysis data:", tags$code("ADAE")), teal.widgets::optionalSelectInput( @@ -175,14 +173,10 @@ ui_g_ae_sub <- function(id, ...) { srv_g_ae_sub <- function(id, data, - filter_panel_api, - reporter, dataname, label, plot_height, plot_width) { - with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") - with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") checkmate::assert_class(data, "reactive") checkmate::assert_class(shiny::isolate(data()), "teal_data") @@ -382,25 +376,22 @@ srv_g_ae_sub <- function(id, title = paste("R code for", label), ) - ### REPORTER - if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "AE Subgroups", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) - card$append_text("Plot", "header3") - card$append_plot(plot_r(), dim = pws$dim()) - if (!comment == "") { - card$append_text("Comment", "header3") - card$append_text(comment) - } - card$append_src(teal.code::get_code(output_q())) - card - } - teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) - } + output_q + # card_fun <- function(comment, label) { + # card <- teal::report_card_template( + # title = "AE by Subgroups", + # label = label, + # with_filter = with_filter, + # filter_panel_api = filter_panel_api + # ) + # card$append_text("Plot", "header3") + # card$append_plot(plot_r(), dim = pws$dim()) + # if (!comment == "") { + # card$append_text("Comment", "header3") + # card$append_text(comment) + # } + # card$append_src(teal.code::get_code(output_q())) + # card + # } }) } diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 9e18e1c5..41bcec83 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -34,6 +34,7 @@ #' used directly as filter. #' #' @inherit argument_convention return +#' @inheritSection teal::example_module Reporting #' #' @export #' @@ -166,9 +167,6 @@ ui_g_butterfly <- function(id, ...) { teal.widgets::plot_with_settings_ui(id = ns("butterflyplot")) ), encoding = tags$div( - ### Reporter - teal.reporter::simple_reporter_ui(ns("simple_reporter")), - ### tags$label("Encodings", class = "text-primary"), helpText("Dataset is:", tags$code(a$dataname)), if (!is.null(a$filter_var)) { @@ -263,9 +261,7 @@ ui_g_butterfly <- function(id, ...) { ) } -srv_g_butterfly <- function(id, data, filter_panel_api, reporter, dataname, label, plot_height, plot_width) { - with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") - with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") +srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) { checkmate::assert_class(data, "reactive") checkmate::assert_class(shiny::isolate(data()), "teal_data") @@ -511,37 +507,22 @@ srv_g_butterfly <- function(id, data, filter_panel_api, reporter, dataname, labe verbatim_content = reactive(teal.code::get_code(output_q())) ) - ### REPORTER - if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "Butterfly Plot", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) - if (!is.null(input$filter_var) || !is.null(input$facet_var) || !is.null(input$sort_by_var)) { - card$append_text("Selected Options", "header3") - } - if (!is.null(input$filter_var)) { - card$append_text(paste0("Preset Data Filters: ", paste(input$filter_var, collapse = ", "), ".")) - } - if (!is.null(input$facet_var)) { - card$append_text(paste0("Faceted by: ", paste(input$facet_var, collapse = ", "), ".")) - } - if (!is.null(input$sort_by_var)) { - card$append_text(paste0("Sorted by: ", paste(input$sort_by_var, collapse = ", "), ".")) - } - card$append_text("Plot", "header3") - card$append_plot(plot_r(), dim = pws$dim()) - if (!comment == "") { - card$append_text("Comment", "header3") - card$append_text(comment) - } - card$append_src(teal.code::get_code(output_q())) - card - } - teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) - } + output_q + # card_fun <- function(comment, label) { + # card <- teal::report_card_template( + # title = "Butterfly Plot", + # label = label, + # with_filter = with_filter, + # filter_panel_api = filter_panel_api + # ) + # card$append_text("Plot", "header3") + # card$append_plot(plot_r(), dim = pws$dim()) + # if (!comment == "") { + # card$append_text("Comment", "header3") + # card$append_text(comment) + # } + # card$append_src(teal.code::get_code(output_q())) + # card + # } }) } diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index 92468958..c72b6218 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -12,6 +12,7 @@ #' and pre-selected option names that can be used to specify the term for events #' #' @inherit argument_convention return +#' @inheritSection teal::example_module Reporting #' #' @export #' @@ -105,9 +106,6 @@ ui_g_events_term_id <- function(id, ...) { plot_decorate_output(id = ns(NULL)) ), encoding = tags$div( - ### Reporter - teal.reporter::simple_reporter_ui(ns("simple_reporter")), - ### teal.widgets::optionalSelectInput( ns("term"), "Term Variable", @@ -202,14 +200,10 @@ ui_g_events_term_id <- function(id, ...) { srv_g_events_term_id <- function(id, data, - filter_panel_api, - reporter, dataname, label, plot_height, plot_width) { - with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") - with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") checkmate::assert_class(data, "reactive") checkmate::assert_class(shiny::isolate(data()), "teal_data") @@ -371,25 +365,22 @@ srv_g_events_term_id <- function(id, verbatim_content = reactive(teal.code::get_code(output_q())) ) - ### REPORTER - if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "Events by Term", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) - card$append_text("Plot", "header3") - card$append_plot(plot_r(), dim = pws$dim()) - if (!comment == "") { - card$append_text("Comment", "header3") - card$append_text(comment) - } - card$append_src(teal.code::get_code(output_q())) - card - } - teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) - } + output_q + # card_fun <- function(comment, label) { + # card <- teal::report_card_template( + # title = "Events by Term", + # label = label, + # with_filter = with_filter, + # filter_panel_api = filter_panel_api + # ) + # card$append_text("Plot", "header3") + # card$append_plot(plot_r(), dim = pws$dim()) + # if (!comment == "") { + # card$append_text("Comment", "header3") + # card$append_text(comment) + # } + # card$append_src(teal.code::get_code(output_q())) + # card + # } }) } diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index f923fe62..678a7196 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -31,6 +31,7 @@ #' specify to `NA` if no concomitant medications data is available #' #' @inherit argument_convention return +#' @inheritSection teal::example_module Reporting #' #' @export #' @@ -195,9 +196,6 @@ ui_g_heatmap_bygrade <- function(id, ...) { plot_decorate_output(id = ns(NULL)) ), encoding = tags$div( - ### Reporter - teal.reporter::simple_reporter_ui(ns("simple_reporter")), - ### teal.widgets::optionalSelectInput( ns("id_var"), "ID Variable", @@ -276,8 +274,6 @@ ui_g_heatmap_bygrade <- function(id, ...) { srv_g_heatmap_bygrade <- function(id, data, - filter_panel_api, - reporter, sl_dataname, ex_dataname, ae_dataname, @@ -285,8 +281,6 @@ srv_g_heatmap_bygrade <- function(id, label, plot_height, plot_width) { - with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") - with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") checkmate::assert_class(data, "reactive") checkmate::assert_class(shiny::isolate(data()), "teal_data") if (!is.na(sl_dataname)) checkmate::assert_names(sl_dataname, subset.of = names(data)) @@ -462,25 +456,22 @@ srv_g_heatmap_bygrade <- function(id, verbatim_content = reactive(teal.code::get_code(output_q())) ) - ### REPORTER - if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "Heatmap by Grade", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) - card$append_text("Plot", "header3") - card$append_plot(plot_r(), dim = pws$dim()) - if (!comment == "") { - card$append_text("Comment", "header3") - card$append_text(comment) - } - card$append_src(teal.code::get_code(output_q())) - card - } - teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) - } + output_q + # card_fun <- function(comment, label) { + # card <- teal::report_card_template( + # title = "Heatmap by Grade", + # label = label, + # with_filter = with_filter, + # filter_panel_api = filter_panel_api + # ) + # card$append_text("Plot", "header3") + # card$append_plot(plot_r(), dim = pws$dim()) + # if (!comment == "") { + # card$append_text("Comment", "header3") + # card$append_text(comment) + # } + # card$append_src(teal.code::get_code(output_q())) + # card + # } }) } diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index fc74af2f..987fecc0 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -48,6 +48,7 @@ #' @template author_qit3 #' #' @inherit argument_convention return +#' @inheritSection teal::example_module Reporting #' #' @details #' As the patient profile module plots different domains in one plot, the study day (x-axis) @@ -219,9 +220,6 @@ ui_g_patient_profile <- function(id, ...) { teal.widgets::plot_with_settings_ui(id = ns("patientprofileplot")) ), encoding = tags$div( - ### Reporter - teal.reporter::simple_reporter_ui(ns("simple_reporter")), - ### tags$label("Encodings", class = "text-primary"), selectizeInput( inputId = ns("patient_id"), @@ -339,8 +337,6 @@ ui_g_patient_profile <- function(id, ...) { srv_g_patient_profile <- function(id, data, - filter_panel_api, - reporter, patient_id, sl_dataname, ex_dataname, @@ -352,8 +348,6 @@ srv_g_patient_profile <- function(id, ae_line_col_opt, plot_height, plot_width) { - with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") - with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelApi") checkmate::assert_class(data, "reactive") checkmate::assert_class(shiny::isolate(data()), "teal_data") if (!is.na(ex_dataname)) checkmate::assert_names(ex_dataname, subset.of = names(data)) @@ -913,25 +907,22 @@ srv_g_patient_profile <- function(id, verbatim_content = reactive(teal.code::get_code(output_q())) ) - ### REPORTER - if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "Patient Profile", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) - card$append_text("Plot", "header3") - card$append_plot(plot_r(), dim = pws$dim()) - if (!comment == "") { - card$append_text("Comment", "header3") - card$append_text(comment) - } - card$append_src(teal.code::get_code(output_q())) - card - } - teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) - } + output_q + # card_fun <- function(comment, label) { + # card <- teal::report_card_template( + # title = "Patient Profile", + # label = label, + # with_filter = with_filter, + # filter_panel_api = filter_panel_api + # ) + # card$append_text("Plot", "header3") + # card$append_plot(plot_r(), dim = pws$dim()) + # if (!comment == "") { + # card$append_text("Comment", "header3") + # card$append_text(comment) + # } + # card$append_src(teal.code::get_code(output_q())) + # card + # } }) } diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 64b7aa5d..b6527404 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -20,6 +20,7 @@ #' @param yfacet_var variable for y facets #' #' @inherit argument_convention return +#' @inheritSection teal::example_module Reporting #' @export #' #' @template author_zhanc107 @@ -146,9 +147,6 @@ ui_g_spider <- function(id, ...) { teal.widgets::plot_with_settings_ui(id = ns("spiderplot")) ), encoding = tags$div( - ### Reporter - teal.reporter::simple_reporter_ui(ns("simple_reporter")), - ### tags$label("Encodings", class = "text-primary"), helpText("Analysis data:", tags$code(a$dataname)), left_bordered_div( @@ -246,9 +244,7 @@ ui_g_spider <- function(id, ...) { ) } -srv_g_spider <- function(id, data, filter_panel_api, paramcd, reporter, dataname, label, plot_height, plot_width) { - with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") - with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") +srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_width) { checkmate::assert_class(data, "reactive") checkmate::assert_class(shiny::isolate(data()), "teal_data") @@ -447,37 +443,22 @@ srv_g_spider <- function(id, data, filter_panel_api, paramcd, reporter, dataname verbatim_content = reactive(teal.code::get_code(output_q())) ) - ### REPORTER - if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "Spider Plot", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) - if (!is.null(input$paramcd) || !is.null(input$xfacet_var) || !is.null(input$yfacet_var)) { - card$append_text("Selected Options", "header3") - } - if (!is.null(input$paramcd)) { - card$append_text(paste0("Parameter - (from ", dataname, "): ", input$paramcd, ".")) - } - if (!is.null(input$xfacet_var)) { - card$append_text(paste0("Faceted horizontally by: ", paste(input$xfacet_var, collapse = ", "), ".")) - } - if (!is.null(input$yfacet_var)) { - card$append_text(paste0("Faceted vertically by: ", paste(input$yfacet_var, collapse = ", "), ".")) - } - card$append_text("Plot", "header3") - card$append_plot(plot_r(), dim = pws$dim()) - if (!comment == "") { - card$append_text("Comment", "header3") - card$append_text(comment) - } - card$append_src(teal.code::get_code(output_q())) - card - } - teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) - } + output_q + # card_fun <- function(comment, label) { + # card <- teal::report_card_template( + # title = "Spider Plot", + # label = label, + # with_filter = with_filter, + # filter_panel_api = filter_panel_api + # ) + # card$append_text("Plot", "header3") + # card$append_plot(plot_r(), dim = pws$dim()) + # if (!comment == "") { + # card$append_text("Comment", "header3") + # card$append_text(comment) + # } + # card$append_src(teal.code::get_code(output_q())) + # card + # } }) } diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index 7b7e2b0f..a3042c51 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -30,6 +30,7 @@ #' @param x_label the label of the x axis #' #' @inherit argument_convention return +#' @inheritSection teal::example_module Reporting #' #' @export #' @@ -183,9 +184,6 @@ ui_g_swimlane <- function(id, ...) { teal.widgets::plot_with_settings_ui(id = ns("swimlaneplot")) ), encoding = tags$div( - ### Reporter - teal.reporter::simple_reporter_ui(ns("simple_reporter")), - ### tags$label("Encodings", class = "text-primary"), helpText("Analysis data:", tags$code(a$dataname)), left_bordered_div( @@ -261,8 +259,6 @@ ui_g_swimlane <- function(id, ...) { srv_g_swimlane <- function(id, data, - filter_panel_api, - reporter, dataname, marker_pos_var, marker_shape_var, @@ -273,8 +269,6 @@ srv_g_swimlane <- function(id, plot_height, plot_width, x_label) { - with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") - with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") checkmate::assert_class(data, "reactive") checkmate::assert_class(shiny::isolate(data()), "teal_data") @@ -523,29 +517,22 @@ srv_g_swimlane <- function(id, verbatim_content = reactive(teal.code::get_code(output_q())) ) - ### REPORTER - if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "Swimlane Plot", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) - if (!is.null(input$sort_var)) { - card$append_text("Selected Options", "header3") - card$append_text(paste("Sorted by:", input$sort_var)) - } - card$append_text("Plot", "header3") - card$append_plot(plot_r(), dim = pws$dim()) - if (!comment == "") { - card$append_text("Comment", "header3") - card$append_text(comment) - } - card$append_src(teal.code::get_code(output_q())) - card - } - teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) - } + output_q + # card_fun <- function(comment, label) { + # card <- teal::report_card_template( + # title = "Swimlane Plot", + # label = label, + # with_filter = with_filter, + # filter_panel_api = filter_panel_api + # ) + # card$append_text("Plot", "header3") + # card$append_plot(plot_r(), dim = pws$dim()) + # if (!comment == "") { + # card$append_text("Comment", "header3") + # card$append_text(comment) + # } + # card$append_src(teal.code::get_code(output_q())) + # card + # } }) } diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index 6121958a..bc949cf2 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -41,6 +41,7 @@ #' @param show_value boolean of whether value of bar height is shown, default is `TRUE` #' #' @inherit argument_convention return +#' @inheritSection teal::example_module Reporting #' #' @export #' @@ -160,9 +161,6 @@ ui_g_waterfall <- function(id, ...) { teal.widgets::plot_with_settings_ui(id = ns("waterfallplot")) ), encoding = tags$div( - ### Reporter - teal.reporter::simple_reporter_ui(ns("simple_reporter")), - ### tags$label("Encodings", class = "text-primary"), helpText("Analysis Data: ", tags$code(a$dataname_tr), tags$code(a$dataname_rs)), teal.widgets::optionalSelectInput( @@ -270,8 +268,6 @@ ui_g_waterfall <- function(id, ...) { srv_g_waterfall <- function(id, data, - filter_panel_api, - reporter, bar_paramcd, add_label_paramcd_rs, anno_txt_paramcd_rs, @@ -281,8 +277,6 @@ srv_g_waterfall <- function(id, label, plot_height, plot_width) { - with_reporter <- !missing(reporter) && inherits(reporter, "Reporter") - with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI") checkmate::assert_class(data, "reactive") checkmate::assert_class(shiny::isolate(data()), "teal_data") @@ -573,33 +567,22 @@ srv_g_waterfall <- function(id, verbatim_content = reactive(teal.code::get_code(output_q())) ) - ### REPORTER - if (with_reporter) { - card_fun <- function(comment, label) { - card <- teal::report_card_template( - title = "Waterfall Plot", - label = label, - with_filter = with_filter, - filter_panel_api = filter_panel_api - ) - card$append_text("Selected Options", "header3") - card$append_text(paste0("Tumor Burden Parameter: ", input$bar_paramcd, ".")) - if (!is.null(input$sort_var)) { - card$append_text(paste0("Sorted by: ", input$sort_var, ".")) - } - if (!is.null(input$facet_var)) { - card$append_text(paste0("Faceted by: ", paste(input$facet_var, collapse = ", "), ".")) - } - card$append_text("Plot", "header3") - card$append_plot(plot_r(), dim = pws$dim()) - if (!comment == "") { - card$append_text("Comment", "header3") - card$append_text(comment) - } - card$append_src(teal.code::get_code(output_q())) - card - } - teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun) - } + output_q + # card_fun <- function(comment, label) { + # card <- teal::report_card_template( + # title = "Waterfall Plot", + # label = label, + # with_filter = with_filter, + # filter_panel_api = filter_panel_api + # ) + # card$append_text("Plot", "header3") + # card$append_plot(plot_r(), dim = pws$dim()) + # if (!comment == "") { + # card$append_text("Comment", "header3") + # card$append_text(comment) + # } + # card$append_src(teal.code::get_code(output_q())) + # card + # } }) } From 3493b5d0a4268f4c5cbf9840ca62cbc3d8361cfe Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 11 Jul 2025 11:48:28 +0200 Subject: [PATCH 03/28] substitute card_fun with teal_card --- R/tm_g_ae_oview.R | 31 ++++++++++++------------------- R/tm_g_ae_sub.R | 38 +++++++++++++++++--------------------- R/tm_g_butterfly.R | 32 +++++++++++++------------------- R/tm_g_events_term_id.R | 30 ++++++++++++------------------ R/tm_g_heat_bygrade.R | 36 +++++++++++++++--------------------- R/tm_g_patient_profile.R | 40 +++++++++++++++++----------------------- R/tm_g_spiderplot.R | 32 +++++++++++++------------------- R/tm_g_swimlane.R | 38 ++++++++++++++++---------------------- R/tm_g_waterfall.R | 34 ++++++++++++++-------------------- 9 files changed, 129 insertions(+), 182 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 109c38aa..3f83e469 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -279,7 +279,15 @@ srv_g_ae_oview <- function(id, output_q <- shiny::debounce( millis = 200, r = reactive({ - ANL <- data()[[dataname]] + obj <- data() + teal.reporter::teal_card(obj) <- + c( + teal.reporter::teal_card("# AE Overview"), + teal.reporter::teal_card(obj), + teal.reporter::teal_card("## Module's code") + ) + + ANL <- obj[[dataname]] teal::validate_has_data(ANL, min_nrow = 10, msg = sprintf("%s has not enough data", dataname)) @@ -291,7 +299,7 @@ srv_g_ae_oview <- function(id, )) q1 <- teal.code::eval_code( - data(), + obj, code = as.expression(c( bquote(anl_labels <- formatters::var_labels(.(as.name(dataname)), fill = FALSE)), bquote( @@ -302,6 +310,8 @@ srv_g_ae_oview <- function(id, )) ) + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + teal.code::eval_code( q1, code = as.expression(c( @@ -334,22 +344,5 @@ srv_g_ae_oview <- function(id, title = paste("R code for", label) ) output_q - - # card_fun <- function(comment, label) { - # card <- teal::report_card_template( - # title = "AE Overview", - # label = label, - # with_filter = with_filter, - # filter_panel_api = filter_panel_api - # ) - # card$append_text("Plot", "header3") - # card$append_plot(plot_r(), dim = pws$dim()) - # if (!comment == "") { - # card$append_text("Comment", "header3") - # card$append_text(comment) - # } - # card$append_src(teal.code::get_code(output_q())) - # card - # } }) } diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 923eff4f..88760aa3 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -311,8 +311,16 @@ srv_g_ae_sub <- function(id, output_q <- shiny::debounce( millis = 200, r = reactive({ - ANL <- data()[[dataname]] - ADSL <- data()[["ADSL"]] + obj <- data() + teal.reporter::teal_card(obj) <- + c( + teal.reporter::teal_card("# AE by Subgroups"), + teal.reporter::teal_card(obj), + teal.reporter::teal_card("## Module's code") + ) + + ANL <- obj[[dataname]] + ADSL <- obj[["ADSL"]] teal::validate_has_data(ANL, min_nrow = 10, msg = sprintf("%s has not enough data", dataname)) @@ -341,9 +349,13 @@ srv_g_ae_sub <- function(id, bquote(group_labels <- setNames(.(group_labels), .(input$groups))) } - teal.code::eval_code(data(), code = group_labels_call) %>% - teal.code::eval_code(code = "") %>% - teal.code::eval_code( + q1 <- teal.code::eval_code(obj, code = group_labels_call) %>% + teal.code::eval_code(code = "") + + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + + teal.code::eval_code( + q1, code = as.expression(c( bquote( plot <- osprey::g_ae_sub( @@ -377,21 +389,5 @@ srv_g_ae_sub <- function(id, ) output_q - # card_fun <- function(comment, label) { - # card <- teal::report_card_template( - # title = "AE by Subgroups", - # label = label, - # with_filter = with_filter, - # filter_panel_api = filter_panel_api - # ) - # card$append_text("Plot", "header3") - # card$append_plot(plot_r(), dim = pws$dim()) - # if (!comment == "") { - # card$append_text("Comment", "header3") - # card$append_text(comment) - # } - # card$append_src(teal.code::get_code(output_q())) - # card - # } }) } diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 41bcec83..1610c39f 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -381,8 +381,16 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) output_q <- shiny::debounce( millis = 200, r = reactive({ - ADSL <- data()[["ADSL"]] - ANL <- data()[[dataname]] + obj <- data() + teal.reporter::teal_card(obj) <- + c( + teal.reporter::teal_card("# Butterfly Plot"), + teal.reporter::teal_card(obj), + teal.reporter::teal_card("## Module's code") + ) + + ADSL <- obj[["ADSL"]] + ANL <- obj[[dataname]] teal::validate_has_data(ADSL, min_nrow = 0, msg = sprintf("%s Data is empty", "ADSL")) teal::validate_has_data(ANL, min_nrow = 0, msg = sprintf("%s Data is empty", dataname)) @@ -418,7 +426,7 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) anl_vars <- unique(c("USUBJID", "STUDYID", varlist_from_anl)) q1 <- teal.code::eval_code( - data(), + obj, code = bquote({ ADSL <- ADSL[, .(adsl_vars)] %>% as.data.frame() ANL <- .(as.name(dataname))[, .(anl_vars)] %>% as.data.frame() @@ -456,6 +464,8 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) ) } + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + if (!is.null(right_val) && !is.null(left_val)) { q1 <- teal.code::eval_code( q1, @@ -508,21 +518,5 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) ) output_q - # card_fun <- function(comment, label) { - # card <- teal::report_card_template( - # title = "Butterfly Plot", - # label = label, - # with_filter = with_filter, - # filter_panel_api = filter_panel_api - # ) - # card$append_text("Plot", "header3") - # card$append_plot(plot_r(), dim = pws$dim()) - # if (!comment == "") { - # card$append_text("Comment", "header3") - # card$append_text(comment) - # } - # card$append_src(teal.code::get_code(output_q())) - # card - # } }) } diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index c72b6218..12aa9b36 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -298,7 +298,15 @@ srv_g_events_term_id <- function(id, ) output_q <- reactive({ - ANL <- data()[[dataname]] + obj <- data() + teal.reporter::teal_card(obj) <- + c( + teal.reporter::teal_card("# Events by Term"), + teal.reporter::teal_card(obj), + teal.reporter::teal_card("## Module's code") + ) + + ANL <- obj[[dataname]] teal::validate_inputs(iv()) @@ -314,7 +322,7 @@ srv_g_events_term_id <- function(id, anl_vars <- c("USUBJID", "STUDYID", input$term) q1 <- teal.code::eval_code( - data(), + obj, code = bquote( ANL <- merge( x = ADSL[, .(adsl_vars), drop = FALSE], @@ -331,6 +339,8 @@ srv_g_events_term_id <- function(id, msg = "Analysis data set must have at least 10 data points" ) + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + q2 <- teal.code::eval_code( q1, code = bquote( @@ -366,21 +376,5 @@ srv_g_events_term_id <- function(id, ) output_q - # card_fun <- function(comment, label) { - # card <- teal::report_card_template( - # title = "Events by Term", - # label = label, - # with_filter = with_filter, - # filter_panel_api = filter_panel_api - # ) - # card$append_text("Plot", "header3") - # card$append_plot(plot_r(), dim = pws$dim()) - # if (!comment == "") { - # card$append_text("Comment", "header3") - # card$append_text(comment) - # } - # card$append_src(teal.code::get_code(output_q())) - # card - # } }) } diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 678a7196..9422a7b1 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -390,10 +390,18 @@ srv_g_heatmap_bygrade <- function(id, output_q <- shiny::debounce( millis = 200, r = reactive({ - ADSL <- data()[[sl_dataname]] - ADEX <- data()[[ex_dataname]] - ADAE <- data()[[ae_dataname]] - ADCM <- data()[[cm_dataname]] + obj <- data() + teal.reporter::teal_card(obj) <- + c( + teal.reporter::teal_card("# Heatmap by Grade"), + teal.reporter::teal_card(obj), + teal.reporter::teal_card("## Module's code") + ) + + ADSL <- obj[[sl_dataname]] + ADEX <- obj[[ex_dataname]] + ADAE <- obj[[ae_dataname]] + ADCM <- obj[[cm_dataname]] teal::validate_has_data(ADSL, min_nrow = 1, msg = sprintf("%s contains no data", sl_dataname)) teal::validate_inputs(iv(), iv_cm()) @@ -401,7 +409,7 @@ srv_g_heatmap_bygrade <- function(id, shiny::validate(shiny::need(all(input$conmed_level %in% ADCM[[input$conmed_var]]), "Updating Conmed Levels")) } - qenv <- data() + qenv <- obj if (isTRUE(input$plot_cm)) { ADCM <- qenv[[cm_dataname]] @@ -426,6 +434,8 @@ srv_g_heatmap_bygrade <- function(id, ) } + teal.reporter::teal_card(qenv) <- c(teal.reporter::teal_card(qenv), "## Plot") + qenv <- teal.code::eval_code( qenv, code = bquote( @@ -457,21 +467,5 @@ srv_g_heatmap_bygrade <- function(id, ) output_q - # card_fun <- function(comment, label) { - # card <- teal::report_card_template( - # title = "Heatmap by Grade", - # label = label, - # with_filter = with_filter, - # filter_panel_api = filter_panel_api - # ) - # card$append_text("Plot", "header3") - # card$append_plot(plot_r(), dim = pws$dim()) - # if (!comment == "") { - # card$append_text("Comment", "header3") - # card$append_text(comment) - # } - # card$append_src(teal.code::get_code(output_q())) - # card - # } }) } diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index 987fecc0..586b02e0 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -453,6 +453,14 @@ srv_g_patient_profile <- function(id, output_q <- shiny::debounce( millis = 200, r = reactive({ + obj <- data() + teal.reporter::teal_card(obj) <- + c( + teal.reporter::teal_card("# Patient Profile"), + teal.reporter::teal_card(obj), + teal.reporter::teal_card("## Module's code") + ) + teal::validate_inputs(iv()) # get inputs --- @@ -499,31 +507,31 @@ srv_g_patient_profile <- function(id, )) # get ADSL dataset --- - ADSL <- data()[[sl_dataname]] + ADSL <- obj[[sl_dataname]] ADEX <- NULL if (isTRUE(select_plot()[ex_dataname])) { - ADEX <- data()[[ex_dataname]] + ADEX <- obj[[ex_dataname]] teal::validate_has_variable(ADEX, adex_vars) } ADAE <- NULL if (isTRUE(select_plot()[ae_dataname])) { - ADAE <- data()[[ae_dataname]] + ADAE <- obj[[ae_dataname]] teal::validate_has_variable(ADAE, adae_vars) } ADRS <- NULL if (isTRUE(select_plot()[rs_dataname])) { - ADRS <- data()[[rs_dataname]] + ADRS <- obj[[rs_dataname]] teal::validate_has_variable(ADRS, adrs_vars) } ADCM <- NULL if (isTRUE(select_plot()[cm_dataname])) { - ADCM <- data()[[cm_dataname]] + ADCM <- obj[[cm_dataname]] teal::validate_has_variable(ADCM, adcm_vars) } ADLB <- NULL if (isTRUE(select_plot()[lb_dataname])) { - ADLB <- data()[[lb_dataname]] + ADLB <- obj[[lb_dataname]] teal::validate_has_variable(ADLB, adlb_vars) } @@ -534,7 +542,7 @@ srv_g_patient_profile <- function(id, empty_lb <- FALSE q1 <- teal.code::eval_code( - data(), + obj, code = substitute( expr = { ADSL <- ADSL %>% @@ -866,6 +874,8 @@ srv_g_patient_profile <- function(id, x_limit <- q1[["x_limit"]] } + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + q1 <- teal.code::eval_code( q1, code = substitute( @@ -908,21 +918,5 @@ srv_g_patient_profile <- function(id, ) output_q - # card_fun <- function(comment, label) { - # card <- teal::report_card_template( - # title = "Patient Profile", - # label = label, - # with_filter = with_filter, - # filter_panel_api = filter_panel_api - # ) - # card$append_text("Plot", "header3") - # card$append_plot(plot_r(), dim = pws$dim()) - # if (!comment == "") { - # card$append_text("Comment", "header3") - # card$append_text(comment) - # } - # card$append_src(teal.code::get_code(output_q())) - # card - # } }) } diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index b6527404..4794aee9 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -301,9 +301,17 @@ srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_w # render plot output_q <- reactive({ + obj <- data() + teal.reporter::teal_card(obj) <- + c( + teal.reporter::teal_card("# Spider Plot"), + teal.reporter::teal_card(obj), + teal.reporter::teal_card("## Module's code") + ) + # get datasets --- - ADSL <- data()[["ADSL"]] - ADTR <- data()[[dataname]] + ADSL <- obj[["ADSL"]] + ADTR <- obj[[dataname]] teal::validate_inputs(iv()) @@ -343,7 +351,7 @@ srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_w # merge q1 <- teal.code::eval_code( - data(), + obj, code = bquote({ ADSL <- ADSL[, .(adsl_vars)] %>% as.data.frame() ADTR <- .(as.name(dataname))[, .(adtr_vars)] %>% as.data.frame() @@ -379,6 +387,8 @@ srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_w # plot code to qenv --- + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + q1 <- teal.code::eval_code( q1, code = bquote({ @@ -444,21 +454,5 @@ srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_w ) output_q - # card_fun <- function(comment, label) { - # card <- teal::report_card_template( - # title = "Spider Plot", - # label = label, - # with_filter = with_filter, - # filter_panel_api = filter_panel_api - # ) - # card$append_text("Plot", "header3") - # card$append_plot(plot_r(), dim = pws$dim()) - # if (!comment == "") { - # card$append_text("Comment", "header3") - # card$append_text(comment) - # } - # card$append_src(teal.code::get_code(output_q())) - # card - # } }) } diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index a3042c51..00249484 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -317,18 +317,26 @@ srv_g_swimlane <- function(id, # create plot output_q <- reactive({ + obj <- data() + teal.reporter::teal_card(obj) <- + c( + teal.reporter::teal_card("# Swimlane Plot"), + teal.reporter::teal_card(obj), + teal.reporter::teal_card("## Module's code") + ) + teal::validate_inputs(iv()) - validate(need("ADSL" %in% names(data()), "'ADSL' not included in data")) + validate(need("ADSL" %in% names(obj), "'ADSL' not included in data")) validate(need( - (length(data()) == 1 && dataname == "ADSL") || - (length(data()) >= 2 && dataname != "ADSL"), paste( + (length(obj) == 1 && dataname == "ADSL") || + (length(obj) >= 2 && dataname != "ADSL"), paste( "Please either add just 'ADSL' as dataname when just ADSL is available.", "In case 2 datasets are available ADSL is not supposed to be the dataname." ) )) - ADSL <- data()[["ADSL"]] + ADSL <- obj[["ADSL"]] anl_vars <- unique(c( "USUBJID", "STUDYID", @@ -343,7 +351,7 @@ srv_g_swimlane <- function(id, teal::validate_has_data(ADSL, min_nrow = 3) teal::validate_has_variable(ADSL, adsl_vars) } else { - anl <- data()[[dataname]] + anl <- obj[[dataname]] teal::validate_has_data(anl, min_nrow = 3) teal::validate_has_variable(anl, anl_vars) @@ -372,7 +380,7 @@ srv_g_swimlane <- function(id, } vref_line <- suppressWarnings(as_numeric_from_comma_sep_str(debounce(reactive(input$vref_line), 1500)())) - q1 <- data() + q1 <- obj q2 <- teal.code::eval_code( q1, @@ -497,6 +505,8 @@ srv_g_swimlane <- function(id, ) } + teal.reporter::teal_card(q3) <- c(teal.reporter::teal_card(q3), "## Plot") + q4 <- teal.code::eval_code(q3, code = plot_call) teal.code::eval_code(q4, quote(plot)) }) @@ -518,21 +528,5 @@ srv_g_swimlane <- function(id, ) output_q - # card_fun <- function(comment, label) { - # card <- teal::report_card_template( - # title = "Swimlane Plot", - # label = label, - # with_filter = with_filter, - # filter_panel_api = filter_panel_api - # ) - # card$append_text("Plot", "header3") - # card$append_plot(plot_r(), dim = pws$dim()) - # if (!comment == "") { - # card$append_text("Comment", "header3") - # card$append_text(comment) - # } - # card$append_src(teal.code::get_code(output_q())) - # card - # } }) } diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index bc949cf2..ac1e11bc 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -359,9 +359,17 @@ srv_g_waterfall <- function(id, }) output_q <- reactive({ - adsl <- data()[["ADSL"]] - adtr <- data()[[dataname_tr]] - adrs <- data()[[dataname_rs]] + obj <- data() + teal.reporter::teal_card(obj) <- + c( + teal.reporter::teal_card("# Waterfall Plot"), + teal.reporter::teal_card(obj), + teal.reporter::teal_card("## Module's code") + ) + + adsl <- obj[["ADSL"]] + adtr <- obj[[dataname_tr]] + adrs <- obj[[dataname_rs]] # validate data rows teal::validate_has_data(adsl, min_nrow = 2) @@ -427,7 +435,7 @@ srv_g_waterfall <- function(id, # write variables to qenv q1 <- teal.code::eval_code( - data(), + obj, code = bquote({ bar_var <- .(bar_var) bar_color_var <- .(bar_color_var) @@ -494,6 +502,8 @@ srv_g_waterfall <- function(id, # write plotting code to qenv anl <- q1[["anl"]] + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + q1 <- teal.code::eval_code( q1, code = bquote({ @@ -568,21 +578,5 @@ srv_g_waterfall <- function(id, ) output_q - # card_fun <- function(comment, label) { - # card <- teal::report_card_template( - # title = "Waterfall Plot", - # label = label, - # with_filter = with_filter, - # filter_panel_api = filter_panel_api - # ) - # card$append_text("Plot", "header3") - # card$append_plot(plot_r(), dim = pws$dim()) - # if (!comment == "") { - # card$append_text("Comment", "header3") - # card$append_text(comment) - # } - # card$append_src(teal.code::get_code(output_q())) - # card - # } }) } From 6e829485d1dd783972930aec32814d4e05f4a052 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 09:52:00 +0000 Subject: [PATCH 04/28] [skip style] [skip vbump] Restyle files --- R/tm_g_ae_oview.R | 4 ++-- R/tm_g_ae_sub.R | 46 ++++++++++++++++++++-------------------- R/tm_g_butterfly.R | 4 ++-- R/tm_g_events_term_id.R | 4 ++-- R/tm_g_heat_bygrade.R | 4 ++-- R/tm_g_patient_profile.R | 4 ++-- R/tm_g_spiderplot.R | 4 ++-- R/tm_g_swimlane.R | 4 ++-- R/tm_g_waterfall.R | 4 ++-- 9 files changed, 39 insertions(+), 39 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 3f83e469..a568c8d5 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -280,13 +280,13 @@ srv_g_ae_oview <- function(id, millis = 200, r = reactive({ obj <- data() - teal.reporter::teal_card(obj) <- + teal.reporter::teal_card(obj) <- c( teal.reporter::teal_card("# AE Overview"), teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - + ANL <- obj[[dataname]] teal::validate_has_data(ANL, min_nrow = 10, msg = sprintf("%s has not enough data", dataname)) diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 88760aa3..f5b79f31 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -312,13 +312,13 @@ srv_g_ae_sub <- function(id, millis = 200, r = reactive({ obj <- data() - teal.reporter::teal_card(obj) <- + teal.reporter::teal_card(obj) <- c( teal.reporter::teal_card("# AE by Subgroups"), teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - + ANL <- obj[[dataname]] ADSL <- obj[["ADSL"]] @@ -356,27 +356,27 @@ srv_g_ae_sub <- function(id, teal.code::eval_code( q1, - code = as.expression(c( - bquote( - plot <- osprey::g_ae_sub( - id = .(as.name(dataname))$USUBJID, - arm = as.factor(.(as.name(dataname))[[.(input$arm_var)]]), - arm_sl = as.character(ADSL[[.(input$arm_var)]]), - trt = .(input$arm_trt), - ref = .(input$arm_ref), - subgroups = .(as.name(dataname))[.(input$groups)], - subgroups_sl = ADSL[.(input$groups)], - subgroups_levels = group_labels, - conf_level = .(input$conf_level), - diff_ci_method = .(input$ci), - fontsize = .(font_size()), - arm_n = .(input$arm_n), - draw = TRUE - ) - ), - quote(plot) - )) - ) + code = as.expression(c( + bquote( + plot <- osprey::g_ae_sub( + id = .(as.name(dataname))$USUBJID, + arm = as.factor(.(as.name(dataname))[[.(input$arm_var)]]), + arm_sl = as.character(ADSL[[.(input$arm_var)]]), + trt = .(input$arm_trt), + ref = .(input$arm_ref), + subgroups = .(as.name(dataname))[.(input$groups)], + subgroups_sl = ADSL[.(input$groups)], + subgroups_levels = group_labels, + conf_level = .(input$conf_level), + diff_ci_method = .(input$ci), + fontsize = .(font_size()), + arm_n = .(input$arm_n), + draw = TRUE + ) + ), + quote(plot) + )) + ) }) ) diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 1610c39f..ec0caa7b 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -382,13 +382,13 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) millis = 200, r = reactive({ obj <- data() - teal.reporter::teal_card(obj) <- + teal.reporter::teal_card(obj) <- c( teal.reporter::teal_card("# Butterfly Plot"), teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - + ADSL <- obj[["ADSL"]] ANL <- obj[[dataname]] diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index 12aa9b36..f7c02190 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -299,13 +299,13 @@ srv_g_events_term_id <- function(id, output_q <- reactive({ obj <- data() - teal.reporter::teal_card(obj) <- + teal.reporter::teal_card(obj) <- c( teal.reporter::teal_card("# Events by Term"), teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - + ANL <- obj[[dataname]] teal::validate_inputs(iv()) diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 9422a7b1..6eb245f4 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -391,13 +391,13 @@ srv_g_heatmap_bygrade <- function(id, millis = 200, r = reactive({ obj <- data() - teal.reporter::teal_card(obj) <- + teal.reporter::teal_card(obj) <- c( teal.reporter::teal_card("# Heatmap by Grade"), teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - + ADSL <- obj[[sl_dataname]] ADEX <- obj[[ex_dataname]] ADAE <- obj[[ae_dataname]] diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index 586b02e0..3004b798 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -454,13 +454,13 @@ srv_g_patient_profile <- function(id, millis = 200, r = reactive({ obj <- data() - teal.reporter::teal_card(obj) <- + teal.reporter::teal_card(obj) <- c( teal.reporter::teal_card("# Patient Profile"), teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - + teal::validate_inputs(iv()) # get inputs --- diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 4794aee9..2ada20db 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -302,13 +302,13 @@ srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_w # render plot output_q <- reactive({ obj <- data() - teal.reporter::teal_card(obj) <- + teal.reporter::teal_card(obj) <- c( teal.reporter::teal_card("# Spider Plot"), teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - + # get datasets --- ADSL <- obj[["ADSL"]] ADTR <- obj[[dataname]] diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index 00249484..46c1b1cd 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -318,13 +318,13 @@ srv_g_swimlane <- function(id, # create plot output_q <- reactive({ obj <- data() - teal.reporter::teal_card(obj) <- + teal.reporter::teal_card(obj) <- c( teal.reporter::teal_card("# Swimlane Plot"), teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - + teal::validate_inputs(iv()) validate(need("ADSL" %in% names(obj), "'ADSL' not included in data")) diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index ac1e11bc..909e1697 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -360,13 +360,13 @@ srv_g_waterfall <- function(id, output_q <- reactive({ obj <- data() - teal.reporter::teal_card(obj) <- + teal.reporter::teal_card(obj) <- c( teal.reporter::teal_card("# Waterfall Plot"), teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - + adsl <- obj[["ADSL"]] adtr <- obj[[dataname_tr]] adrs <- obj[[dataname_rs]] From c0011165c26dcf325b8aa5694e2704d9770032a0 Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 11 Jul 2025 14:26:08 +0200 Subject: [PATCH 05/28] add selected_options --- R/tm_g_butterfly.R | 13 +++++++++++++ R/tm_g_spiderplot.R | 12 ++++++++++++ R/tm_g_swimlane.R | 5 +++++ R/tm_g_waterfall.R | 16 ++++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 1610c39f..6e91496c 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -466,6 +466,19 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + if (!is.null(input$filter_var) || !is.null(input$facet_var) || !is.null(input$sort_by_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options") + } + if (!is.null(input$filter_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Preset Data Filters: ", paste(input$filter_var, collapse = ", "), ".")) + } + if (!is.null(input$facet_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Faceted by: ", paste(input$facet_var, collapse = ", "), ".")) + } + if (!is.null(input$sort_by_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Sorted by: ", paste(input$sort_by_var, collapse = ", "), ".")) + } + if (!is.null(right_val) && !is.null(left_val)) { q1 <- teal.code::eval_code( q1, diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 4794aee9..b8c9732b 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -388,6 +388,18 @@ srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_w # plot code to qenv --- teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + if (!is.null(input$paramcd) || !is.null(input$xfacet_var) || !is.null(input$yfacet_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options") + } + if (!is.null(input$paramcd)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Parameter - (from ", dataname, "): ", input$paramcd, ".")) + } + if (!is.null(input$xfacet_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Faceted horizontally by: ", paste(input$xfacet_var, collapse = ", "), ".")) + } + if (!is.null(input$yfacet_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Faceted vertically by: ", paste(input$yfacet_var, collapse = ", "), ".")) + } q1 <- teal.code::eval_code( q1, diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index 00249484..587ef160 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -507,6 +507,11 @@ srv_g_swimlane <- function(id, teal.reporter::teal_card(q3) <- c(teal.reporter::teal_card(q3), "## Plot") + if (!is.null(input$sort_var)) { + teal.reporter::teal_card(q3) <- c(teal.reporter::teal_card(q3), "### Selected Options") + teal.reporter::teal_card(q3) <- c(teal.reporter::teal_card(q3), paste("Sorted by:", input$sort_var)) + } + q4 <- teal.code::eval_code(q3, code = plot_call) teal.code::eval_code(q4, quote(plot)) }) diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index ac1e11bc..20acf178 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -504,6 +504,22 @@ srv_g_waterfall <- function(id, teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + if (!is.null(input$filter_var) || !is.null(input$facet_var) || !is.null(input$sort_by_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options") + } + if (!is.null(input$filter_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), + paste0("Preset Data Filters: ", paste(input$filter_var, collapse = ", "), ".")) + } + if (!is.null(input$facet_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), + paste0("Faceted by: ", paste(input$facet_var, collapse = ", "), ".")) + } + if (!is.null(input$sort_by_var)) { + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), + paste0("Sorted by: ", paste(input$sort_by_var, collapse = ", "), ".")) + } + q1 <- teal.code::eval_code( q1, code = bquote({ From 198218ad0770aeb0fc7ac4fafaefd57d505bb7ba Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 11 Jul 2025 12:28:36 +0000 Subject: [PATCH 06/28] [skip style] [skip vbump] Restyle files --- R/tm_g_waterfall.R | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index e633309c..fd9bd780 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -508,16 +508,22 @@ srv_g_waterfall <- function(id, teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options") } if (!is.null(input$filter_var)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), - paste0("Preset Data Filters: ", paste(input$filter_var, collapse = ", "), ".")) + teal.reporter::teal_card(q1) <- c( + teal.reporter::teal_card(q1), + paste0("Preset Data Filters: ", paste(input$filter_var, collapse = ", "), ".") + ) } if (!is.null(input$facet_var)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), - paste0("Faceted by: ", paste(input$facet_var, collapse = ", "), ".")) + teal.reporter::teal_card(q1) <- c( + teal.reporter::teal_card(q1), + paste0("Faceted by: ", paste(input$facet_var, collapse = ", "), ".") + ) } if (!is.null(input$sort_by_var)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), - paste0("Sorted by: ", paste(input$sort_by_var, collapse = ", "), ".")) + teal.reporter::teal_card(q1) <- c( + teal.reporter::teal_card(q1), + paste0("Sorted by: ", paste(input$sort_by_var, collapse = ", "), ".") + ) } q1 <- teal.code::eval_code( From 683ec6240ac0d85b1c25f93effc63f44782e83ea Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Wed, 27 Aug 2025 13:25:06 +0200 Subject: [PATCH 07/28] Update DESCRIPTION Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 73984893..1116342c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -51,7 +51,7 @@ Suggests: Remotes: insightsengineering/osprey, insightsengineering/teal@teal_reportable, - insightsengineering/teal.reporter@teal_reportable, + insightsengineering/teal.reporter@teal_reportable Config/Needs/verdepcheck: insightsengineering/osprey, rstudio/shiny, insightsengineering/teal, insightsengineering/teal.slice, insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr, From eb550c12a2968da29f440b94e647e1fe09731df9 Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 28 Aug 2025 09:53:00 +0200 Subject: [PATCH 08/28] missing ) --- R/tm_g_patient_profile.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index 38dc5493..cc3dccfe 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -562,6 +562,7 @@ srv_g_patient_profile <- function(id, patient_id = patient_id ) ) + ) # ADSL with single subject validate( From 1c35d66afdec81148f3a5897655cfc9c623d5fcc Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 28 Aug 2025 07:55:24 +0000 Subject: [PATCH 09/28] [skip style] [skip vbump] Restyle files --- R/tm_g_patient_profile.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index cc3dccfe..7c1eeb21 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -461,7 +461,7 @@ srv_g_patient_profile <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, expression(library("dplyr"))) + obj <- teal.code::eval_code(obj, expression(library("dplyr"))) teal::validate_inputs(iv()) From 00d99ccf8933dd40ec79ab31a445f925bdf17ead Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 28 Aug 2025 12:27:21 +0200 Subject: [PATCH 10/28] remove extra plot calls --- R/tm_g_ae_sub.R | 3 +-- R/tm_g_butterfly.R | 2 +- R/tm_g_heat_bygrade.R | 3 +-- R/tm_g_spiderplot.R | 2 -- R/tm_g_swimlane.R | 4 ++-- 5 files changed, 5 insertions(+), 9 deletions(-) diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 14a60335..9b958ec6 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -372,8 +372,7 @@ srv_g_ae_sub <- function(id, arm_n = .(input$arm_n), draw = TRUE ) - ), - quote(plot) + ) )) ) }) diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 1407d585..e7d01dd2 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -511,7 +511,7 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) ) } - teal.code::eval_code(q1, quote(plot)) + q1 }) ) diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index b82ce7d7..896d6d96 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -437,7 +437,7 @@ srv_g_heatmap_bygrade <- function(id, teal.reporter::teal_card(qenv) <- c(teal.reporter::teal_card(qenv), "## Plot") - qenv <- teal.code::eval_code( + teal.code::eval_code( qenv, code = bquote( plot <- osprey::g_heat_bygrade( @@ -455,7 +455,6 @@ srv_g_heatmap_bygrade <- function(id, ) ) ) - teal.code::eval_code(qenv, quote(plot)) }) ) diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 9c20aeb8..9c7b4c95 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -444,8 +444,6 @@ srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_w }, show_legend = .(legend_on) ) - - plot }) ) }) diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index 5aa4a298..0071c5e2 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -512,8 +512,8 @@ srv_g_swimlane <- function(id, teal.reporter::teal_card(q3) <- c(teal.reporter::teal_card(q3), paste("Sorted by:", input$sort_var)) } - q4 <- teal.code::eval_code(q3, code = plot_call) - teal.code::eval_code(q4, quote(plot)) + teal.code::eval_code(q3, code = plot_call) + }) plot_r <- reactive(output_q()[["plot"]]) From d8d07127afe359eea9265554d9a0af902774d84c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 28 Aug 2025 10:29:46 +0000 Subject: [PATCH 11/28] [skip style] [skip vbump] Restyle files --- R/tm_g_swimlane.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index 0071c5e2..8c279e14 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -513,7 +513,6 @@ srv_g_swimlane <- function(id, } teal.code::eval_code(q3, code = plot_call) - }) plot_r <- reactive(output_q()[["plot"]]) From 2887192ea13bdf6f0e69aee25ad3c06137a634e8 Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 28 Aug 2025 12:40:08 +0200 Subject: [PATCH 12/28] Empty-Commit From fc3de3329dd94a9f66820d5b99181ce25d2445b1 Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 4 Sep 2025 15:38:59 +0200 Subject: [PATCH 13/28] vbump teal and teal.reporter --- DESCRIPTION | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1116342c..076cadd2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -24,7 +24,7 @@ Depends: osprey (>= 0.1.17), R (>= 3.6), shiny (>= 1.8.1), - teal (>= 1.0.0), + teal (>= 1.0.0.9003), teal.transform (>= 0.7.0) Imports: bslib (>= 0.8.0), @@ -37,7 +37,7 @@ Imports: teal.code (>= 0.7.0), teal.data (>= 0.8.0), teal.logger (>= 0.4.0), - teal.reporter (>= 0.5.0), + teal.reporter (>= 0.5.0.9001), teal.widgets (>= 0.5.0), tern (>= 0.9.7), tidyr (>= 0.8.3) @@ -50,8 +50,8 @@ Suggests: withr (>= 3.0.0) Remotes: insightsengineering/osprey, - insightsengineering/teal@teal_reportable, - insightsengineering/teal.reporter@teal_reportable + insightsengineering/teal, + insightsengineering/teal.reporter Config/Needs/verdepcheck: insightsengineering/osprey, rstudio/shiny, insightsengineering/teal, insightsengineering/teal.slice, insightsengineering/teal.transform, mllg/checkmate, tidyverse/dplyr, From e3e221e1ba770a21d06e7ccbff35afcb36dca6f9 Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 5 Sep 2025 10:24:38 +0200 Subject: [PATCH 14/28] revert back expression(library to 'library' --- R/tm_g_ae_oview.R | 2 +- R/tm_g_butterfly.R | 2 +- R/tm_g_heat_bygrade.R | 2 +- R/tm_g_patient_profile.R | 2 +- R/tm_g_spiderplot.R | 2 +- R/tm_g_waterfall.R | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 0a02260c..33fdaa19 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -286,7 +286,7 @@ srv_g_ae_oview <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, expression(library("dplyr"))) + obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes ANL <- obj[[dataname]] diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index e7d01dd2..c72cd05b 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -388,7 +388,7 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, expression(library("dplyr"))) + obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes ADSL <- obj[["ADSL"]] ANL <- obj[[dataname]] diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 896d6d96..0d80ccf1 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -397,7 +397,7 @@ srv_g_heatmap_bygrade <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, expression(library("dplyr"))) + obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes ADSL <- obj[[sl_dataname]] ADEX <- obj[[ex_dataname]] diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index 7c1eeb21..f01c9dff 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -461,7 +461,7 @@ srv_g_patient_profile <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, expression(library("dplyr"))) + obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes teal::validate_inputs(iv()) diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 9c7b4c95..72a0f3cf 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -308,7 +308,7 @@ srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_w teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, expression(library("dplyr"))) + obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes # get datasets --- ADSL <- obj[["ADSL"]] diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index ea42a7fd..cb52c682 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -366,7 +366,7 @@ srv_g_waterfall <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, expression(library("dplyr"))) + obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes adsl <- obj[["ADSL"]] adtr <- obj[[dataname_tr]] From b3201c10ad3a831f4c47a7b6b4eaa610ff45e1ea Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 9 Sep 2025 14:59:41 +0200 Subject: [PATCH 15/28] add support for plots size --- R/tm_g_butterfly.R | 2 +- R/tm_g_patient_profile.R | 2 +- R/tm_g_spiderplot.R | 2 +- R/tm_g_swimlane.R | 2 +- R/tm_g_waterfall.R | 2 +- R/utils.R | 99 ++++++++++++++++++++++++++++++++++++++++ 6 files changed, 104 insertions(+), 5 deletions(-) diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index c72cd05b..a37e8e80 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -530,6 +530,6 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) title = paste("R code for", label), verbatim_content = reactive(teal.code::get_code(output_q())) ) - output_q + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index f01c9dff..cb1a770b 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -918,6 +918,6 @@ srv_g_patient_profile <- function(id, title = paste("R code for", label), verbatim_content = reactive(teal.code::get_code(output_q())) ) - output_q + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 72a0f3cf..d36cbc0f 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -462,6 +462,6 @@ srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_w title = paste("R code for", label), verbatim_content = reactive(teal.code::get_code(output_q())) ) - output_q + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index 8c279e14..10580f1c 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -530,6 +530,6 @@ srv_g_swimlane <- function(id, title = paste("R code for", label), verbatim_content = reactive(teal.code::get_code(output_q())) ) - output_q + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index cb52c682..35d0150e 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -598,6 +598,6 @@ srv_g_waterfall <- function(id, title = paste("R code for", label), verbatim_content = reactive(teal.code::get_code(output_q())) ) - output_q + set_chunk_dims(pws, output_q) }) } diff --git a/R/utils.R b/R/utils.R index 96c4a2f0..fe60590c 100644 --- a/R/utils.R +++ b/R/utils.R @@ -136,3 +136,102 @@ left_bordered_div <- function(...) { ... ) } + +#' Set the attributes of the last chunk outputs +#' +#' This function modifies the attributes of the last `n` elements of a `teal_card` +#' that are `chunk_output` objects. It can be used to set attributes like `dev.width` +#' and `dev.height` for plot outputs. +#' +#' @param teal_card (`teal_card`) the teal_card object to modify +#' @param attributes (`list`) named list of attributes to set +#' @param n (`integer(1)`) number of the last element of `teal_card` to modify. +#' it will only change `chunk_output` objects. +#' @param inner_classes (`character`) classes within `chunk_output` that should be modified. +#' This can be used to only change `recordedplot`, `ggplot2` or other type of objects. +#' @param quiet (`logical`) whether to suppress warnings +#' @keywords internal +set_chunk_attrs <- function(teal_card, + attributes, + n = 1, + inner_classes = NULL, + quiet = FALSE) { + checkmate::assert_class(teal_card, "teal_card") + checkmate::assert_list(attributes, names = "unique") + checkmate::assert_int(n, lower = 1) + checkmate::assert_character(inner_classes, null.ok = TRUE) + checkmate::assert_flag(quiet) + + if (!inherits(teal_card[[length(teal_card)]], "chunk_output")) { + if (!quiet) { + warning("The last element of the `teal_card` is not a `chunk_output` object. No attributes were modified.") + } + return(teal_card) + } + + for (ix in seq_len(length(teal_card))) { + if (ix > n) { + break + } + current_ix <- length(teal_card) + 1 - ix + if (!inherits(teal_card[[current_ix]], "chunk_output")) { + if (!quiet) { + warning( + "The ", ix, + " to last element of the `teal_card` is not a `chunk_output` object. Skipping any further modifications." + ) + } + return(teal_card) + } + + if (length(inner_classes) > 0 && !checkmate::test_multi_class(teal_card[[current_ix]][[1]], inner_classes)) { + next + } + + attributes(teal_card[[current_ix]]) <- utils::modifyList( + attributes(teal_card[[current_ix]]), + attributes + ) + } + + teal_card +} + +#' Create a reactive that sets plot dimensions on a `teal_card` +#' +#' This is a convenience function that creates a reactive expression that +#' automatically sets the `dev.width` and `dev.height` attributes on the last +#' chunk outputs of a `teal_card` based on plot dimensions from a plot widget. +#' +#' @param pws (`plot_widget`) plot widget that provides dimensions via `dim()` method +#' @param q_r (`reactive`) reactive expression that returns a `teal_reporter` +#' @param inner_classes (`character`) classes within `chunk_output` that should be modified. +#' This can be used to only change `recordedplot`, `ggplot2` or other type of objects. +#' +#' @return A reactive expression that returns the `teal_card` with updated dimensions +#' +#' @keywords internal +set_chunk_dims <- function(pws, q_r, inner_classes = NULL) { + checkmate::assert_list(pws) + checkmate::assert_names(names(pws), must.include = "dim") + checkmate::assert_class(pws$dim, "reactive") + checkmate::assert_class(q_r, "reactive") + checkmate::assert_character(inner_classes, null.ok = TRUE) + + reactive({ + pws_dim <- stats::setNames(as.list(req(pws$dim())), c("width", "height")) + if (identical(pws_dim$width, "auto")) { # ignore non-numeric values (such as "auto") + pws_dim$width <- NULL + } + if (identical(pws_dim$height, "auto")) { # ignore non-numeric values (such as "auto") + pws_dim$height <- NULL + } + q <- req(q_r()) + teal.reporter::teal_card(q) <- set_chunk_attrs( + teal.reporter::teal_card(q), + list(dev.width = pws_dim$width, dev.height = pws_dim$height), + inner_classes = inner_classes + ) + q + }) +} \ No newline at end of file From 701a7e691ec6a59d5dfbb4cd9f6505e6d02c3b73 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 13:02:20 +0000 Subject: [PATCH 16/28] [skip style] [skip vbump] Restyle files --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index fe60590c..714b3db8 100644 --- a/R/utils.R +++ b/R/utils.R @@ -234,4 +234,4 @@ set_chunk_dims <- function(pws, q_r, inner_classes = NULL) { ) q }) -} \ No newline at end of file +} From 0b086be069c999079e54632c9c23afdf3a9a120c Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 9 Sep 2025 13:06:05 +0000 Subject: [PATCH 17/28] [skip roxygen] [skip vbump] Roxygen Man Pages Auto Update --- DESCRIPTION | 2 +- man/set_chunk_attrs.Rd | 33 +++++++++++++++++++++++++++++++++ man/set_chunk_dims.Rd | 25 +++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 man/set_chunk_attrs.Rd create mode 100644 man/set_chunk_dims.Rd diff --git a/DESCRIPTION b/DESCRIPTION index 076cadd2..6b5167b7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -67,4 +67,4 @@ Encoding: UTF-8 Language: en-US LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.3 diff --git a/man/set_chunk_attrs.Rd b/man/set_chunk_attrs.Rd new file mode 100644 index 00000000..8f657ea9 --- /dev/null +++ b/man/set_chunk_attrs.Rd @@ -0,0 +1,33 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{set_chunk_attrs} +\alias{set_chunk_attrs} +\title{Set the attributes of the last chunk outputs} +\usage{ +set_chunk_attrs( + teal_card, + attributes, + n = 1, + inner_classes = NULL, + quiet = FALSE +) +} +\arguments{ +\item{teal_card}{(\code{teal_card}) the teal_card object to modify} + +\item{attributes}{(\code{list}) named list of attributes to set} + +\item{n}{(\code{integer(1)}) number of the last element of \code{teal_card} to modify. +it will only change \code{chunk_output} objects.} + +\item{inner_classes}{(\code{character}) classes within \code{chunk_output} that should be modified. +This can be used to only change \code{recordedplot}, \code{ggplot2} or other type of objects.} + +\item{quiet}{(\code{logical}) whether to suppress warnings} +} +\description{ +This function modifies the attributes of the last \code{n} elements of a \code{teal_card} +that are \code{chunk_output} objects. It can be used to set attributes like \code{dev.width} +and \code{dev.height} for plot outputs. +} +\keyword{internal} diff --git a/man/set_chunk_dims.Rd b/man/set_chunk_dims.Rd new file mode 100644 index 00000000..aea85363 --- /dev/null +++ b/man/set_chunk_dims.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{set_chunk_dims} +\alias{set_chunk_dims} +\title{Create a reactive that sets plot dimensions on a \code{teal_card}} +\usage{ +set_chunk_dims(pws, q_r, inner_classes = NULL) +} +\arguments{ +\item{pws}{(\code{plot_widget}) plot widget that provides dimensions via \code{dim()} method} + +\item{q_r}{(\code{reactive}) reactive expression that returns a \code{teal_reporter}} + +\item{inner_classes}{(\code{character}) classes within \code{chunk_output} that should be modified. +This can be used to only change \code{recordedplot}, \code{ggplot2} or other type of objects.} +} +\value{ +A reactive expression that returns the \code{teal_card} with updated dimensions +} +\description{ +This is a convenience function that creates a reactive expression that +automatically sets the \code{dev.width} and \code{dev.height} attributes on the last +chunk outputs of a \code{teal_card} based on plot dimensions from a plot widget. +} +\keyword{internal} From 3aa11ecdda53f9f0976614fb2d70cf4897db5532 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 9 Sep 2025 15:09:31 +0200 Subject: [PATCH 18/28] indirect pws setup throug srv_g_decorate --- R/tm_g_ae_oview.R | 2 +- R/tm_g_ae_sub.R | 2 +- R/tm_g_events_term_id.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 33fdaa19..fa67d1c1 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -343,6 +343,6 @@ srv_g_ae_oview <- function(id, verbatim_content = reactive(teal.code::get_code(output_q())), title = paste("R code for", label) ) - output_q + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 9b958ec6..2071f1dd 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -385,6 +385,6 @@ srv_g_ae_sub <- function(id, verbatim_content = reactive(teal.code::get_code(output_q())), title = paste("R code for", label), ) - output_q + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index e43368c0..9cbb36c2 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -371,6 +371,6 @@ srv_g_events_term_id <- function(id, title = paste("R code for", label), verbatim_content = reactive(teal.code::get_code(output_q())) ) - output_q + set_chunk_dims(pws, output_q) }) } From 28de1821dc1625e2eb712e5fe44689ea0e8126a6 Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Thu, 11 Sep 2025 15:53:29 +0200 Subject: [PATCH 19/28] Update R/tm_g_spiderplot.R Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- R/tm_g_spiderplot.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index d36cbc0f..24923b8e 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -244,7 +244,7 @@ ui_g_spider <- function(id, ...) { ) } -srv_g_spider <- function(id, data, paramcd, dataname, label, plot_height, plot_width) { +srv_g_spider <- function(id, data, dataname, paramcd, label, plot_height, plot_width) { checkmate::assert_class(data, "reactive") checkmate::assert_class(shiny::isolate(data()), "teal_data") From a1a28b8935ecacc5671993b77e0bcd8eb4c9277e Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Thu, 11 Sep 2025 15:54:09 +0200 Subject: [PATCH 20/28] Update R/utils.R Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- R/utils.R | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 714b3db8..cc220973 100644 --- a/R/utils.R +++ b/R/utils.R @@ -184,7 +184,11 @@ set_chunk_attrs <- function(teal_card, return(teal_card) } - if (length(inner_classes) > 0 && !checkmate::test_multi_class(teal_card[[current_ix]][[1]], inner_classes)) { + if ( + length(inner_classes) > 0 && + length(teal_card[[current_ix]]) >= 1 && + !checkmate::test_multi_class(teal_card[[current_ix]][[1]], inner_classes) + ) { next } From f67875c9dfbf5a27aef77698fe20f46d9d417550 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 11 Sep 2025 13:56:28 +0000 Subject: [PATCH 21/28] [skip style] [skip vbump] Restyle files --- R/utils.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index cc220973..1dfcf628 100644 --- a/R/utils.R +++ b/R/utils.R @@ -186,8 +186,8 @@ set_chunk_attrs <- function(teal_card, if ( length(inner_classes) > 0 && - length(teal_card[[current_ix]]) >= 1 && - !checkmate::test_multi_class(teal_card[[current_ix]][[1]], inner_classes) + length(teal_card[[current_ix]]) >= 1 && + !checkmate::test_multi_class(teal_card[[current_ix]][[1]], inner_classes) ) { next } From 88116b9e9c4886713a95640b4b88d21e3d138eea Mon Sep 17 00:00:00 2001 From: m7pr Date: Thu, 11 Sep 2025 15:58:18 +0200 Subject: [PATCH 22/28] add plot settings for heat_bygrade --- R/tm_g_heat_bygrade.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 0d80ccf1..fc82e9ab 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -465,6 +465,6 @@ srv_g_heatmap_bygrade <- function(id, title = paste("R code for", label), verbatim_content = reactive(teal.code::get_code(output_q())) ) - output_q + set_chunk_dims(pws, output_q) }) } From 8180fd8182bbf9a90c2f9b2778dc429066d6ae65 Mon Sep 17 00:00:00 2001 From: Marcin <133694481+m7pr@users.noreply.github.com> Date: Fri, 12 Sep 2025 15:54:36 +0200 Subject: [PATCH 23/28] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: André Veríssimo <211358+averissimo@users.noreply.github.com> Signed-off-by: Marcin <133694481+m7pr@users.noreply.github.com> --- R/tm_g_heat_bygrade.R | 2 +- R/tm_g_spiderplot.R | 2 +- R/tm_g_waterfall.R | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index fc82e9ab..39abfabf 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -397,7 +397,7 @@ srv_g_heatmap_bygrade <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes + obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes. ADSL <- obj[[sl_dataname]] ADEX <- obj[[ex_dataname]] diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 24923b8e..137fa880 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -308,7 +308,7 @@ srv_g_spider <- function(id, data, dataname, paramcd, label, plot_height, plot_w teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes + obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes. # get datasets --- ADSL <- obj[["ADSL"]] diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index 35d0150e..d749a724 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -366,7 +366,7 @@ srv_g_waterfall <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes + obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes. adsl <- obj[["ADSL"]] adtr <- obj[[dataname_tr]] From 9d20593b6376ead8d9228de64703e2fcecbed9d8 Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 15 Sep 2025 11:51:07 +0200 Subject: [PATCH 24/28] replace the way we call dplyr in modules --- R/tm_g_ae_oview.R | 2 +- R/tm_g_butterfly.R | 2 +- R/tm_g_heat_bygrade.R | 2 +- R/tm_g_patient_profile.R | 2 +- R/tm_g_spiderplot.R | 2 +- R/tm_g_waterfall.R | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index fa67d1c1..cde73e55 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -286,7 +286,7 @@ srv_g_ae_oview <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes + obj <- teal.code::eval_code(obj, "library(dplyr)") ANL <- obj[[dataname]] diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index a37e8e80..b782fca7 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -388,7 +388,7 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes + obj <- teal.code::eval_code(obj, "library(dplyr)") ADSL <- obj[["ADSL"]] ANL <- obj[[dataname]] diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 39abfabf..cf6a221b 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -397,7 +397,7 @@ srv_g_heatmap_bygrade <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes. + obj <- teal.code::eval_code(obj, "library(dplyr)"). ADSL <- obj[[sl_dataname]] ADEX <- obj[[ex_dataname]] diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index cb1a770b..12c477ad 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -461,7 +461,7 @@ srv_g_patient_profile <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes + obj <- teal.code::eval_code(obj, "library(dplyr)") teal::validate_inputs(iv()) diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 137fa880..d8bce134 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -308,7 +308,7 @@ srv_g_spider <- function(id, data, dataname, paramcd, label, plot_height, plot_w teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes. + obj <- teal.code::eval_code(obj, "library(dplyr)"). # get datasets --- ADSL <- obj[["ADSL"]] diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index d749a724..84c2cc34 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -366,7 +366,7 @@ srv_g_waterfall <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, 'library("dplyr")') # nolint: quotes. + obj <- teal.code::eval_code(obj, "library(dplyr)"). adsl <- obj[["ADSL"]] adtr <- obj[[dataname_tr]] From 4b8603c3876cb5046b086e5171cd4a60722b8b41 Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 15 Sep 2025 11:53:19 +0200 Subject: [PATCH 25/28] remove filter_var from waterfall --- R/tm_g_waterfall.R | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index 84c2cc34..2aecf109 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -505,15 +505,9 @@ srv_g_waterfall <- function(id, teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") - if (!is.null(input$filter_var) || !is.null(input$facet_var) || !is.null(input$sort_by_var)) { + if (!is.null(input$facet_var) || !is.null(input$sort_by_var)) { teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options") } - if (!is.null(input$filter_var)) { - teal.reporter::teal_card(q1) <- c( - teal.reporter::teal_card(q1), - paste0("Preset Data Filters: ", paste(input$filter_var, collapse = ", "), ".") - ) - } if (!is.null(input$facet_var)) { teal.reporter::teal_card(q1) <- c( teal.reporter::teal_card(q1), From 0a8de78269e2c04309749dd4db430473402715dd Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 15 Sep 2025 11:58:20 +0200 Subject: [PATCH 26/28] typo --- R/tm_g_heat_bygrade.R | 2 +- R/tm_g_spiderplot.R | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index cf6a221b..8b3347c3 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -397,7 +397,7 @@ srv_g_heatmap_bygrade <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, "library(dplyr)"). + obj <- teal.code::eval_code(obj, "library(dplyr)") ADSL <- obj[[sl_dataname]] ADEX <- obj[[ex_dataname]] diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index d8bce134..ddfb7596 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -308,7 +308,7 @@ srv_g_spider <- function(id, data, dataname, paramcd, label, plot_height, plot_w teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, "library(dplyr)"). + obj <- teal.code::eval_code(obj, "library(dplyr)") # get datasets --- ADSL <- obj[["ADSL"]] From 7267f780e922824c2497ce026f1df8893951b6b9 Mon Sep 17 00:00:00 2001 From: m7pr Date: Mon, 15 Sep 2025 12:19:55 +0200 Subject: [PATCH 27/28] last changes for waterfall plot --- R/tm_g_waterfall.R | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index 2aecf109..962f1b9e 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -366,7 +366,7 @@ srv_g_waterfall <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's code") ) - obj <- teal.code::eval_code(obj, "library(dplyr)"). + obj <- teal.code::eval_code(obj, "library(dplyr)") adsl <- obj[["ADSL"]] adtr <- obj[[dataname_tr]] @@ -503,24 +503,23 @@ srv_g_waterfall <- function(id, # write plotting code to qenv anl <- q1[["anl"]] - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options", paste0("Tumor Burden Parameter: ", input$bar_paramcd, ".")) - if (!is.null(input$facet_var) || !is.null(input$sort_by_var)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options") - } - if (!is.null(input$facet_var)) { + if (!is.null(facet_var)) { teal.reporter::teal_card(q1) <- c( teal.reporter::teal_card(q1), - paste0("Faceted by: ", paste(input$facet_var, collapse = ", "), ".") + paste0("Faceted by: ", paste(facet_var, collapse = ", "), ".") ) } - if (!is.null(input$sort_by_var)) { + if (!is.null(sort_var)) { teal.reporter::teal_card(q1) <- c( teal.reporter::teal_card(q1), - paste0("Sorted by: ", paste(input$sort_by_var, collapse = ", "), ".") + paste0("Sorted by: ", paste(sort_var, collapse = ", "), ".") ) } + teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot") + q1 <- teal.code::eval_code( q1, code = bquote({ From dd96ec04692935f3c579bebe1b9f0a56fa5c98f9 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 16 Sep 2025 09:12:29 +0200 Subject: [PATCH 28/28] lintr --- R/tm_g_butterfly.R | 9 ++++++--- R/tm_g_spiderplot.R | 9 ++++++--- R/tm_g_waterfall.R | 7 ++++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index b782fca7..358e8cd0 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -471,13 +471,16 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options") } if (!is.null(input$filter_var)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Preset Data Filters: ", paste(input$filter_var, collapse = ", "), ".")) + teal.reporter::teal_card(q1) <- + c(teal.reporter::teal_card(q1), paste0("Preset Data Filters: ", paste(input$filter_var, collapse = ", "), ".")) } if (!is.null(input$facet_var)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Faceted by: ", paste(input$facet_var, collapse = ", "), ".")) + teal.reporter::teal_card(q1) <- + c(teal.reporter::teal_card(q1), paste0("Faceted by: ", paste(input$facet_var, collapse = ", "), ".")) } if (!is.null(input$sort_by_var)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Sorted by: ", paste(input$sort_by_var, collapse = ", "), ".")) + teal.reporter::teal_card(q1) <- + c(teal.reporter::teal_card(q1), paste0("Sorted by: ", paste(input$sort_by_var, collapse = ", "), ".")) } if (!is.null(right_val) && !is.null(left_val)) { diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index ddfb7596..c1aa6b40 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -392,13 +392,16 @@ srv_g_spider <- function(id, data, dataname, paramcd, label, plot_height, plot_w teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options") } if (!is.null(input$paramcd)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Parameter - (from ", dataname, "): ", input$paramcd, ".")) + teal.reporter::teal_card(q1) <- + c(teal.reporter::teal_card(q1), paste0("Parameter - (from ", dataname, "): ", input$paramcd, ".")) } if (!is.null(input$xfacet_var)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Faceted horizontally by: ", paste(input$xfacet_var, collapse = ", "), ".")) + teal.reporter::teal_card(q1) <- + c(teal.reporter::teal_card(q1), paste0("Faceted horizontally by: ", paste(input$xfacet_var, collapse = ", "), ".")) } if (!is.null(input$yfacet_var)) { - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), paste0("Faceted vertically by: ", paste(input$yfacet_var, collapse = ", "), ".")) + teal.reporter::teal_card(q1) <- + c(teal.reporter::teal_card(q1), paste0("Faceted vertically by: ", paste(input$yfacet_var, collapse = ", "), ".")) } q1 <- teal.code::eval_code( diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index 962f1b9e..e07af4a0 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -503,7 +503,12 @@ srv_g_waterfall <- function(id, # write plotting code to qenv anl <- q1[["anl"]] - teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "### Selected Options", paste0("Tumor Burden Parameter: ", input$bar_paramcd, ".")) + teal.reporter::teal_card(q1) <- + c( + teal.reporter::teal_card(q1), + "### Selected Options", + paste0("Tumor Burden Parameter: ", input$bar_paramcd, ".") + ) if (!is.null(facet_var)) { teal.reporter::teal_card(q1) <- c(