Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
44ab94d
set Remotes and vbump packages
m7pr Jul 11, 2025
dbc0f5d
initial attempt
m7pr Jul 11, 2025
3493b5d
substitute card_fun with teal_card
m7pr Jul 11, 2025
6e82948
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 11, 2025
c001116
add selected_options
m7pr Jul 11, 2025
97751af
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr Jul 11, 2025
198218a
[skip style] [skip vbump] Restyle files
github-actions[bot] Jul 11, 2025
4639631
Merge branch 'main' into teal_reportable
m7pr Aug 27, 2025
683ec62
Update DESCRIPTION
m7pr Aug 27, 2025
eb550c1
missing )
m7pr Aug 28, 2025
1c35d66
[skip style] [skip vbump] Restyle files
github-actions[bot] Aug 28, 2025
00d99cc
remove extra plot calls
m7pr Aug 28, 2025
d8d0712
[skip style] [skip vbump] Restyle files
github-actions[bot] Aug 28, 2025
2887192
Empty-Commit
m7pr Aug 28, 2025
fc3de33
vbump teal and teal.reporter
m7pr Sep 4, 2025
e3e221e
revert back expression(library to 'library'
m7pr Sep 5, 2025
b3201c1
add support for plots size
m7pr Sep 9, 2025
701a7e6
[skip style] [skip vbump] Restyle files
github-actions[bot] Sep 9, 2025
0b086be
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Sep 9, 2025
3aa11ec
indirect pws setup throug srv_g_decorate
m7pr Sep 9, 2025
c88d97a
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr Sep 9, 2025
28de182
Update R/tm_g_spiderplot.R
m7pr Sep 11, 2025
a1a28b8
Update R/utils.R
m7pr Sep 11, 2025
f67875c
[skip style] [skip vbump] Restyle files
github-actions[bot] Sep 11, 2025
88116b9
add plot settings for heat_bygrade
m7pr Sep 11, 2025
97c0d2b
Merge branch 'teal_reportable' of https://github.com/insightsengineer…
m7pr Sep 11, 2025
8180fd8
Apply suggestions from code review
m7pr Sep 12, 2025
9d20593
replace the way we call dplyr in modules
m7pr Sep 15, 2025
4b8603c
remove filter_var from waterfall
m7pr Sep 15, 2025
0a8de78
typo
m7pr Sep 15, 2025
7267f78
last changes for waterfall plot
m7pr Sep 15, 2025
dd96ec0
lintr
m7pr Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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:
Expand All @@ -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,
Expand Down
43 changes: 14 additions & 29 deletions R/tm_g_ae_oview.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#' sub-groups (e.g. Serious events, Related events, etc.)
#'
#' @inherit argument_convention return
#' @inheritSection teal::example_module Reporting
#'
#' @export
#'
Expand Down Expand Up @@ -129,9 +130,6 @@
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",
Expand Down Expand Up @@ -197,14 +195,10 @@

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")

Expand Down Expand Up @@ -285,7 +279,15 @@
output_q <- shiny::debounce(
millis = 200,
r = reactive({
ANL <- data()[[dataname]]
obj <- data()
teal.reporter::teal_card(obj) <-

Check warning on line 283 in R/tm_g_ae_oview.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_g_ae_oview.R,line=283,col=41,[trailing_whitespace_linter] Remove trailing whitespace.
c(
teal.reporter::teal_card("# AE Overview"),
teal.reporter::teal_card(obj),
teal.reporter::teal_card("## Module's code")
)

Check warning on line 289 in R/tm_g_ae_oview.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_g_ae_oview.R,line=289,col=1,[trailing_whitespace_linter] Remove trailing whitespace.
ANL <- obj[[dataname]]

teal::validate_has_data(ANL, min_nrow = 10, msg = sprintf("%s has not enough data", dataname))

Expand All @@ -297,7 +299,7 @@
))

q1 <- teal.code::eval_code(
data(),
obj,
code = as.expression(c(
bquote(anl_labels <- formatters::var_labels(.(as.name(dataname)), fill = FALSE)),
bquote(
Expand All @@ -308,6 +310,8 @@
))
)

teal.reporter::teal_card(q1) <- c(teal.reporter::teal_card(q1), "## Plot")

teal.code::eval_code(
q1,
code = as.expression(c(
Expand Down Expand Up @@ -339,25 +343,6 @@
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
})
}
51 changes: 19 additions & 32 deletions R/tm_g_ae_sub.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#' @author Molly He (hey59) \email{[email protected]}
#'
#' @inherit argument_convention return
#' @inheritSection teal::example_module Reporting
#'
#' @export
#'
Expand Down Expand Up @@ -105,9 +106,6 @@
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(
Expand Down Expand Up @@ -175,14 +173,10 @@

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")

Expand Down Expand Up @@ -317,8 +311,16 @@
output_q <- shiny::debounce(
millis = 200,
r = reactive({
ANL <- data()[[dataname]]
ADSL <- data()[["ADSL"]]
obj <- data()
teal.reporter::teal_card(obj) <-

Check warning on line 315 in R/tm_g_ae_sub.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_g_ae_sub.R,line=315,col=41,[trailing_whitespace_linter] Remove trailing whitespace.
c(
teal.reporter::teal_card("# AE by Subgroups"),
teal.reporter::teal_card(obj),
teal.reporter::teal_card("## Module's code")
)

Check warning on line 321 in R/tm_g_ae_sub.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_g_ae_sub.R,line=321,col=1,[trailing_whitespace_linter] Remove trailing whitespace.
ANL <- obj[[dataname]]
ADSL <- obj[["ADSL"]]

teal::validate_has_data(ANL, min_nrow = 10, msg = sprintf("%s has not enough data", dataname))

Expand Down Expand Up @@ -347,10 +349,14 @@
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(

Check warning on line 359 in R/tm_g_ae_sub.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_g_ae_sub.R,line=359,col=12,[indentation_linter] Indentation should be 10 spaces but is 12 spaces.
bquote(
plot <- osprey::g_ae_sub(
id = .(as.name(dataname))$USUBJID,
Expand Down Expand Up @@ -382,25 +388,6 @@
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
})
}
57 changes: 16 additions & 41 deletions R/tm_g_butterfly.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#' used directly as filter.
#'
#' @inherit argument_convention return
#' @inheritSection teal::example_module Reporting
#'
#' @export
#'
Expand Down Expand Up @@ -166,9 +167,6 @@
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)) {
Expand Down Expand Up @@ -263,9 +261,7 @@
)
}

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")

Expand Down Expand Up @@ -385,8 +381,16 @@
output_q <- shiny::debounce(
millis = 200,
r = reactive({
ADSL <- data()[["ADSL"]]
ANL <- data()[[dataname]]
obj <- data()
teal.reporter::teal_card(obj) <-

Check warning on line 385 in R/tm_g_butterfly.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_g_butterfly.R,line=385,col=41,[trailing_whitespace_linter] Remove trailing whitespace.
c(
teal.reporter::teal_card("# Butterfly Plot"),
teal.reporter::teal_card(obj),
teal.reporter::teal_card("## Module's code")
)

Check warning on line 391 in R/tm_g_butterfly.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=R/tm_g_butterfly.R,line=391,col=1,[trailing_whitespace_linter] Remove trailing whitespace.
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))
Expand Down Expand Up @@ -422,7 +426,7 @@
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()
Expand Down Expand Up @@ -460,6 +464,8 @@
)
}

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,
Expand Down Expand Up @@ -511,37 +517,6 @@
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
})
}
Loading
Loading