From 1492348826594c2b763fcd7f014a33ba1adab9f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Wed, 17 Sep 2025 14:41:09 +0100 Subject: [PATCH 1/4] chore: remove source code from example_module encoding panel --- R/tm_g_ae_oview.R | 20 ++++++-------------- R/tm_g_ae_sub.R | 24 ++++++++---------------- R/tm_g_butterfly.R | 8 -------- R/tm_g_events_term_id.R | 20 ++++++-------------- R/tm_g_heat_bygrade.R | 24 ++++++++---------------- R/tm_g_patient_profile.R | 8 -------- R/tm_g_spiderplot.R | 8 -------- R/tm_g_swimlane.R | 8 -------- R/tm_g_waterfall.R | 9 --------- 9 files changed, 28 insertions(+), 101 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index cde73e55..0ba623fc 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -186,9 +186,6 @@ ui_g_ae_oview <- function(id, ...) { titles = "AE Overview", footnotes = "" ) - ), - forms = tagList( - teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") ) ) } @@ -229,13 +226,6 @@ srv_g_ae_oview <- function(id, iv }) - decorate_output <- srv_g_decorate( - id = NULL, plt = plot_r, - plot_height = plot_height, plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - observeEvent(list(input$diff_ci_method, input$conf_level), { req(!is.null(input$diff_ci_method) && !is.null(input$conf_level)) diff_ci_method <- input$diff_ci_method @@ -338,11 +328,13 @@ srv_g_ae_oview <- function(id, plot_r <- reactive(output_q()[["plot"]]) - teal.widgets::verbatim_popup_srv( - id = "rcode", - verbatim_content = reactive(teal.code::get_code(output_q())), - title = paste("R code for", label) + decorate_output <- srv_g_decorate( + id = NULL, plt = plot_r, + plot_height = plot_height, plot_width = plot_width ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index 2071f1dd..f2b74bf7 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -163,9 +163,6 @@ ui_g_ae_sub <- function(id, ...) { footnotes = "" ) ) - ), - forms = tagList( - teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") ) ) } @@ -209,15 +206,6 @@ srv_g_ae_sub <- function(id, iv }) - decorate_output <- srv_g_decorate( - id = NULL, - plt = plot_r, - plot_height = plot_height, - plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - observeEvent(input$arm_var, ignoreNULL = TRUE, { arm_var <- input$arm_var ANL <- data()[[dataname]] @@ -380,11 +368,15 @@ srv_g_ae_sub <- function(id, plot_r <- reactive(output_q()[["plot"]]) - teal.widgets::verbatim_popup_srv( - id = "rcode", - verbatim_content = reactive(teal.code::get_code(output_q())), - title = paste("R code for", label), + decorate_output <- srv_g_decorate( + id = NULL, + plt = plot_r, + plot_height = plot_height, + plot_width = plot_width ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 358e8cd0..8614fb82 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -253,9 +253,6 @@ ui_g_butterfly <- function(id, ...) { value = a$legend_on ) ), - forms = tagList( - teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") - ), pre_output = a$pre_output, post_output = a$post_output ) @@ -528,11 +525,6 @@ srv_g_butterfly <- function(id, data, dataname, label, plot_height, plot_width) width = plot_width ) - teal.widgets::verbatim_popup_srv( - id = "rcode", - title = paste("R code for", label), - verbatim_content = reactive(teal.code::get_code(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 9cbb36c2..40227e73 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -190,9 +190,6 @@ ui_g_events_term_id <- function(id, ...) { titles = "Common AE Table", footnotes = "" ) - ), - forms = tagList( - teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") ) ) } @@ -225,12 +222,6 @@ srv_g_events_term_id <- function(id, iv }) - decorate_output <- srv_g_decorate( - id = NULL, plt = plot_r, plot_height = plot_height, plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - observeEvent(list(input$diff_ci_method, input$conf_level), { req(!is.null(input$diff_ci_method) && !is.null(input$conf_level)) diff_ci_method <- input$diff_ci_method @@ -365,12 +356,13 @@ srv_g_events_term_id <- function(id, }) plot_r <- reactive(output_q()[["plot"]]) - - teal.widgets::verbatim_popup_srv( - id = "rcode", - title = paste("R code for", label), - verbatim_content = reactive(teal.code::get_code(output_q())) + decorate_output <- srv_g_decorate( + id = NULL, plt = plot_r, plot_height = plot_height, plot_width = plot_width ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index 8b3347c3..b48ba60d 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -264,9 +264,6 @@ ui_g_heatmap_bygrade <- function(id, ...) { titles = "Heatmap by Grade", footnotes = "" ) - ), - forms = tagList( - teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") ) ) ) @@ -364,15 +361,6 @@ srv_g_heatmap_bygrade <- function(id, iv_cm }) - decorate_output <- srv_g_decorate( - id = NULL, - plt = plot_r, - plot_height = plot_height, - plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - if (!is.na(cm_dataname)) { observeEvent(input$conmed_var, { ADCM <- data()[[cm_dataname]] @@ -460,11 +448,15 @@ srv_g_heatmap_bygrade <- function(id, plot_r <- reactive(output_q()[["plot"]]) - teal.widgets::verbatim_popup_srv( - id = "rcode", - title = paste("R code for", label), - verbatim_content = reactive(teal.code::get_code(output_q())) + decorate_output <- srv_g_decorate( + id = NULL, + plt = plot_r, + plot_height = plot_height, + plot_width = plot_width ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_patient_profile.R b/R/tm_g_patient_profile.R index 12c477ad..9f2f6809 100644 --- a/R/tm_g_patient_profile.R +++ b/R/tm_g_patient_profile.R @@ -327,9 +327,6 @@ ui_g_patient_profile <- function(id, ...) { value = a$x_limit ) ), - forms = tagList( - teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") - ), pre_output = a$pre_output, post_output = a$post_output ) @@ -913,11 +910,6 @@ srv_g_patient_profile <- function(id, width = plot_width ) - teal.widgets::verbatim_popup_srv( - id = "rcode", - title = paste("R code for", label), - verbatim_content = reactive(teal.code::get_code(output_q())) - ) set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index c1aa6b40..5a8ddc12 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -235,9 +235,6 @@ ui_g_spider <- function(id, ...) { value = a$href_line ) ), - forms = tagList( - teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") - ), pre_output = a$pre_output, post_output = a$post_output ) @@ -460,11 +457,6 @@ srv_g_spider <- function(id, data, dataname, paramcd, label, plot_height, plot_w width = plot_width ) - teal.widgets::verbatim_popup_srv( - id = "rcode", - title = paste("R code for", label), - verbatim_content = reactive(teal.code::get_code(output_q())) - ) set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_swimlane.R b/R/tm_g_swimlane.R index 10580f1c..bb138665 100644 --- a/R/tm_g_swimlane.R +++ b/R/tm_g_swimlane.R @@ -248,9 +248,6 @@ ui_g_swimlane <- function(id, ...) { value = paste(a$vref_line, collapse = ", ") ) ), - forms = tagList( - teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") - ), pre_output = a$pre_output, post_output = a$post_output ) @@ -525,11 +522,6 @@ srv_g_swimlane <- function(id, width = plot_width ) - teal.widgets::verbatim_popup_srv( - id = "rcode", - title = paste("R code for", label), - verbatim_content = reactive(teal.code::get_code(output_q())) - ) set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_waterfall.R b/R/tm_g_waterfall.R index e07af4a0..cd14ac2a 100644 --- a/R/tm_g_waterfall.R +++ b/R/tm_g_waterfall.R @@ -258,9 +258,6 @@ ui_g_waterfall <- function(id, ...) { value = a$gap_point_val ) ), - forms = tagList( - teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code") - ), pre_output = a$pre_output, post_output = a$post_output ) @@ -590,12 +587,6 @@ srv_g_waterfall <- function(id, width = plot_width ) - # Show R Code - teal.widgets::verbatim_popup_srv( - id = "rcode", - title = paste("R code for", label), - verbatim_content = reactive(teal.code::get_code(output_q())) - ) set_chunk_dims(pws, output_q) }) } From b562ba70eb87d60f738d89f0b1a91c34ffe82bac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 3 Oct 2025 09:40:31 +0100 Subject: [PATCH 2/4] revert: code change --- R/tm_g_ae_oview.R | 15 +++++++-------- R/tm_g_ae_sub.R | 19 +++++++++---------- R/tm_g_events_term_id.R | 13 ++++++------- R/tm_g_heat_bygrade.R | 19 +++++++++---------- 4 files changed, 31 insertions(+), 35 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 0ba623fc..848575f6 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -240,6 +240,13 @@ srv_g_ae_oview <- function(id, ) }) + decorate_output <- srv_g_decorate( + id = NULL, plt = plot_r, + plot_height = plot_height, plot_width = plot_width + ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + observeEvent(input$arm_var, ignoreNULL = TRUE, { ANL <- data()[[dataname]] arm_var <- input$arm_var @@ -327,14 +334,6 @@ srv_g_ae_oview <- function(id, ) plot_r <- reactive(output_q()[["plot"]]) - - decorate_output <- srv_g_decorate( - id = NULL, plt = plot_r, - plot_height = plot_height, plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_ae_sub.R b/R/tm_g_ae_sub.R index f2b74bf7..5658db71 100644 --- a/R/tm_g_ae_sub.R +++ b/R/tm_g_ae_sub.R @@ -206,6 +206,15 @@ srv_g_ae_sub <- function(id, iv }) + decorate_output <- srv_g_decorate( + id = NULL, + plt = plot_r, + plot_height = plot_height, + plot_width = plot_width + ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + observeEvent(input$arm_var, ignoreNULL = TRUE, { arm_var <- input$arm_var ANL <- data()[[dataname]] @@ -367,16 +376,6 @@ srv_g_ae_sub <- function(id, ) plot_r <- reactive(output_q()[["plot"]]) - - decorate_output <- srv_g_decorate( - id = NULL, - plt = plot_r, - plot_height = plot_height, - plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - 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 40227e73..7c720875 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -258,6 +258,12 @@ srv_g_events_term_id <- function(id, ignoreNULL = FALSE ) + decorate_output <- srv_g_decorate( + id = NULL, plt = plot_r, plot_height = plot_height, plot_width = plot_width + ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + observeEvent(input$arm_var, { arm_var <- input$arm_var @@ -356,13 +362,6 @@ srv_g_events_term_id <- function(id, }) plot_r <- reactive(output_q()[["plot"]]) - decorate_output <- srv_g_decorate( - id = NULL, plt = plot_r, plot_height = plot_height, plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - - set_chunk_dims(pws, output_q) }) } diff --git a/R/tm_g_heat_bygrade.R b/R/tm_g_heat_bygrade.R index b48ba60d..f06bc30c 100644 --- a/R/tm_g_heat_bygrade.R +++ b/R/tm_g_heat_bygrade.R @@ -361,6 +361,15 @@ srv_g_heatmap_bygrade <- function(id, iv_cm }) + decorate_output <- srv_g_decorate( + id = NULL, + plt = plot_r, + plot_height = plot_height, + plot_width = plot_width + ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + if (!is.na(cm_dataname)) { observeEvent(input$conmed_var, { ADCM <- data()[[cm_dataname]] @@ -447,16 +456,6 @@ srv_g_heatmap_bygrade <- function(id, ) plot_r <- reactive(output_q()[["plot"]]) - - decorate_output <- srv_g_decorate( - id = NULL, - plt = plot_r, - plot_height = plot_height, - plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - set_chunk_dims(pws, output_q) }) } From 09f61a4e76224fabc99f93d24e921e6d42a00a7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 3 Oct 2025 09:42:31 +0100 Subject: [PATCH 3/4] revert: code change --- R/tm_g_ae_oview.R | 14 +++++++------- R/tm_g_events_term_id.R | 13 ++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/R/tm_g_ae_oview.R b/R/tm_g_ae_oview.R index 848575f6..5adab9ce 100644 --- a/R/tm_g_ae_oview.R +++ b/R/tm_g_ae_oview.R @@ -226,6 +226,13 @@ srv_g_ae_oview <- function(id, iv }) + decorate_output <- srv_g_decorate( + id = NULL, plt = plot_r, + plot_height = plot_height, plot_width = plot_width + ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + observeEvent(list(input$diff_ci_method, input$conf_level), { req(!is.null(input$diff_ci_method) && !is.null(input$conf_level)) diff_ci_method <- input$diff_ci_method @@ -240,13 +247,6 @@ srv_g_ae_oview <- function(id, ) }) - decorate_output <- srv_g_decorate( - id = NULL, plt = plot_r, - plot_height = plot_height, plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - observeEvent(input$arm_var, ignoreNULL = TRUE, { ANL <- data()[[dataname]] arm_var <- input$arm_var diff --git a/R/tm_g_events_term_id.R b/R/tm_g_events_term_id.R index 7c720875..e1dff5fb 100644 --- a/R/tm_g_events_term_id.R +++ b/R/tm_g_events_term_id.R @@ -222,6 +222,12 @@ srv_g_events_term_id <- function(id, iv }) + decorate_output <- srv_g_decorate( + id = NULL, plt = plot_r, plot_height = plot_height, plot_width = plot_width + ) + font_size <- decorate_output$font_size + pws <- decorate_output$pws + observeEvent(list(input$diff_ci_method, input$conf_level), { req(!is.null(input$diff_ci_method) && !is.null(input$conf_level)) diff_ci_method <- input$diff_ci_method @@ -237,7 +243,6 @@ srv_g_events_term_id <- function(id, ) }) - observeEvent(input$sort, { sort <- if (is.null(input$sort)) " " else input$sort @@ -258,12 +263,6 @@ srv_g_events_term_id <- function(id, ignoreNULL = FALSE ) - decorate_output <- srv_g_decorate( - id = NULL, plt = plot_r, plot_height = plot_height, plot_width = plot_width - ) - font_size <- decorate_output$font_size - pws <- decorate_output$pws - observeEvent(input$arm_var, { arm_var <- input$arm_var From 021595f422f90df2f32062b8ecd95e6a8f0b0e3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 3 Oct 2025 09:53:13 +0100 Subject: [PATCH 4/4] chore: fix lintr errors --- R/tm_g_butterfly.R | 18 ++++++++++++------ R/tm_g_decorate.R | 7 +------ R/tm_g_spiderplot.R | 12 ++++++++---- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/R/tm_g_butterfly.R b/R/tm_g_butterfly.R index 8614fb82..5b22f2d5 100644 --- a/R/tm_g_butterfly.R +++ b/R/tm_g_butterfly.R @@ -468,16 +468,22 @@ 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), + sprintf("Preset Data Filters: %s.", 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), + sprintf("Faceted by: %s.", 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), + sprintf("Sorted by: %s.", paste(input$sort_by_var, collapse = ", ")) + ) } if (!is.null(right_val) && !is.null(left_val)) { diff --git a/R/tm_g_decorate.R b/R/tm_g_decorate.R index ac3d6152..b6c26dda 100644 --- a/R/tm_g_decorate.R +++ b/R/tm_g_decorate.R @@ -75,12 +75,7 @@ srv_g_decorate <- function(id, width = plot_width ) - return( - list( - font_size = reactive(input$fontsize), - pws = pws - ) - ) + list(font_size = reactive(input$fontsize), pws = pws) }) } diff --git a/R/tm_g_spiderplot.R b/R/tm_g_spiderplot.R index 5a8ddc12..2944d061 100644 --- a/R/tm_g_spiderplot.R +++ b/R/tm_g_spiderplot.R @@ -393,12 +393,16 @@ srv_g_spider <- function(id, data, dataname, paramcd, label, plot_height, plot_w 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), + sprintf("Faceted horizontally by: %s.", 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), + sprintf("Faceted vertically by: %s.", paste(input$yfacet_var, collapse = ", ")) + ) } q1 <- teal.code::eval_code(