Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify plot and table namespaces #1194

Closed
wants to merge 28 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c81fee9
remove dynamic_assertions
m7pr Feb 8, 2024
a62b153
git merge
m7pr Feb 9, 2024
0b5b408
Merge branch 'main' of https://github.com/insightsengineering/teal.mo…
m7pr Feb 15, 2024
ad6a8bb
Merge branch 'main' of https://github.com/insightsengineering/teal.mo…
m7pr Feb 16, 2024
ca06efc
Merge branch 'main' of https://github.com/insightsengineering/teal.mo…
m7pr Feb 19, 2024
4280dcb
Merge branch 'main' of https://github.com/insightsengineering/teal.mo…
m7pr Apr 22, 2024
7ceb490
Merge branch 'main' of https://github.com/insightsengineering/teal.mo…
m7pr May 7, 2024
c0a4b20
Merge branch 'main' of https://github.com/insightsengineering/teal.mo…
m7pr May 8, 2024
7d64929
Merge branch 'main' of https://github.com/insightsengineering/teal.mo…
m7pr Jun 4, 2024
b1915c9
exclude plots width and height from logging and change log level to T…
m7pr Jun 7, 2024
eddac0f
typo
m7pr Jun 7, 2024
51cee58
unify namespaces for plots
m7pr Jun 12, 2024
68061fd
do not change logging on this branch
m7pr Jun 12, 2024
38ef95d
Merge branch 'main' into unify_plot_ns@main
m7pr Jun 12, 2024
0541b99
fix names in plots
m7pr Jun 13, 2024
e09b728
Merge branch 'unify_plot_ns@main' of https://github.com/insightsengin…
m7pr Jun 13, 2024
1f63d38
unify names of plots
m7pr Jun 13, 2024
a9e28c3
Merge branch 'main' into unify_plot_ns@main
m7pr Jun 13, 2024
367594f
substitute teal.widgets::plot_with_settings_ui(id = ns("tmcplot")) wi…
m7pr Jun 13, 2024
df0c5da
introduce tmcplot_with_settings_srv and tmcplot_with_settings_ui
m7pr Jun 13, 2024
68d684a
unify table names
m7pr Jun 13, 2024
6bcfc46
unify table names in shinytest2 tests
m7pr Jun 13, 2024
40a1115
append loggin with tmc prefix
m7pr Jun 13, 2024
47cd302
merge
m7pr Jun 13, 2024
8c7abd3
bring back input
m7pr Jun 13, 2024
a9ccb56
Merge branch '553_log_shiny_input_changes@main' into unify_plot_ns@main
m7pr Jun 13, 2024
db1ba71
sprlintr
m7pr Jun 13, 2024
5c9536c
Merge branch '553_log_shiny_input_changes@main' into unify_plot_ns@main
m7pr Jun 13, 2024
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
9 changes: 3 additions & 6 deletions R/tm_a_gee.R
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ ui_gee <- function(id, ...) {
teal.widgets::standard_layout(
output = teal.widgets::white_small_well(
tags$h3(textOutput(ns("gee_title"))),
teal.widgets::table_with_settings_ui(ns("table"))
tmctable_with_settings_ui()
),
encoding = tags$div(
### Reporter
Expand Down Expand Up @@ -389,7 +389,7 @@ srv_gee <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
## split_covariates ----
observeEvent(input[[extract_input("cov_var", dataname)]],
ignoreNULL = FALSE,
Expand Down Expand Up @@ -547,10 +547,7 @@ srv_gee <- function(id,
table_q()[["result_table"]]
})

teal.widgets::table_with_settings_srv(
id = "table",
table_r = table_r
)
tmctable_with_settings_srv(table_r = table_r)

# Render R code
teal.widgets::verbatim_popup_srv(
Expand Down
16 changes: 7 additions & 9 deletions R/tm_a_mmrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -623,8 +623,8 @@ ui_mmrm <- function(id, ...) {
output = teal.widgets::white_small_well(
textOutput(ns("null_input_msg")),
tags$h3(textOutput(ns("mmrm_title"))),
teal.widgets::table_with_settings_ui(ns("mmrm_table")),
teal.widgets::plot_with_settings_ui(id = ns("mmrm_plot"))
tmctable_with_settings_ui(),
tmcplot_with_settings_ui()
),
encoding = tags$div(
### Reporter
Expand Down Expand Up @@ -845,7 +845,7 @@ srv_mmrm <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
# Reactive responsible for sending a disable/enable signal
# to show R code and debug info buttons
disable_r_code <- reactiveVal(FALSE)
Expand Down Expand Up @@ -1004,9 +1004,9 @@ srv_mmrm <- function(id,
output_function <- input$output_function
if (isTRUE(grepl("^t_", output_function))) {
show_plot_rv(FALSE)
shinyjs::show("mmrm_table")
shinyjs::show("table")
} else if (isTRUE(grepl("^g_", output_function))) {
shinyjs::hide("mmrm_table")
shinyjs::hide("table")
show_plot_rv(TRUE)
} else {
stop("unknown output type")
Expand Down Expand Up @@ -1420,16 +1420,14 @@ srv_mmrm <- function(id,
)
})

pws <- teal.widgets::plot_with_settings_srv(
id = "mmrm_plot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width,
show_hide_signal = reactive(show_plot_rv())
)

teal.widgets::table_with_settings_srv(
id = "mmrm_table",
tmctable_with_settings_srv(
table_r = table_r,
show_hide_signal = reactive(!show_plot_rv())
)
Expand Down
8 changes: 4 additions & 4 deletions R/tm_g_barchart_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ ui_g_barchart_simple <- function(id, ...) {
),
teal.widgets::standard_layout(
output = teal.widgets::white_small_well(
teal.widgets::plot_with_settings_ui(id = ns("myplot")),
tmcplot_with_settings_ui(),
uiOutput(ns("table"), class = "overflow-y-scroll max-h-250")
),
encoding = tags$div(
Expand Down Expand Up @@ -339,7 +339,8 @@ srv_g_barchart_simple <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")

tmc_track_shiny_input_changes(input)
rule_dupl <- function(others) {
function(value) {
othervals <- lapply(
Expand Down Expand Up @@ -535,8 +536,7 @@ srv_g_barchart_simple <- function(id,
}

# Insert the plot into a plot with settings module from teal.widgets
pws <- teal.widgets::plot_with_settings_srv(
id = "myplot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
7 changes: 3 additions & 4 deletions R/tm_g_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ ui_g_ci <- function(id, ...) {
args <- list(...)

teal.widgets::standard_layout(
output = teal.widgets::plot_with_settings_ui(id = ns("myplot")),
output = tmcplot_with_settings_ui(),
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
Expand Down Expand Up @@ -382,7 +382,7 @@ srv_g_ci <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(x_var = x_var, y_var = y_var, color = color),
datasets = data,
Expand Down Expand Up @@ -473,8 +473,7 @@ srv_g_ci <- function(id,
title = label
)

pws <- teal.widgets::plot_with_settings_srv(
id = "myplot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
7 changes: 3 additions & 4 deletions R/tm_g_forest_rsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ ui_g_forest_rsp <- function(id, ...) {
ns <- NS(id)

teal.widgets::standard_layout(
output = teal.widgets::plot_with_settings_ui(id = ns("myplot")),
output = tmcplot_with_settings_ui(),
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
Expand Down Expand Up @@ -508,7 +508,7 @@ srv_g_forest_rsp <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
# Setup arm variable selection, default reference arms, and default
# comparison arms for encoding panel
iv_arm_ref <- arm_ref_comp_observer(
Expand Down Expand Up @@ -733,8 +733,7 @@ srv_g_forest_rsp <- function(id,

plot_r <- reactive(all_q()[["p"]])

pws <- teal.widgets::plot_with_settings_srv(
id = "myplot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
7 changes: 3 additions & 4 deletions R/tm_g_forest_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ ui_g_forest_tte <- function(id, ...) {
ns <- NS(id)

teal.widgets::standard_layout(
output = teal.widgets::plot_with_settings_ui(id = ns("myplot")),
output = tmcplot_with_settings_ui(),
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
Expand Down Expand Up @@ -502,7 +502,7 @@ srv_g_forest_tte <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
# Setup arm variable selection, default reference arms, and default
# comparison arms for encoding panel
iv_arm_ref <- arm_ref_comp_observer(
Expand Down Expand Up @@ -658,8 +658,7 @@ srv_g_forest_tte <- function(id,
# Outputs to render.
plot_r <- reactive(all_q()[["p"]])

pws <- teal.widgets::plot_with_settings_srv(
id = "myplot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
7 changes: 3 additions & 4 deletions R/tm_g_ipp.R
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ ui_g_ipp <- function(id, ...) {
ns <- NS(id)

teal.widgets::standard_layout(
output = teal.widgets::plot_with_settings_ui(id = ns("myplot")),
output = tmcplot_with_settings_ui(),
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
Expand Down Expand Up @@ -482,7 +482,7 @@ srv_g_ipp <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
selector_list <- teal.transform::data_extract_multiple_srv(
datasets = data,
data_extract = list(
Expand Down Expand Up @@ -610,8 +610,7 @@ srv_g_ipp <- function(id,
plot_r <- reactive(all_q()[["plot"]])

# Insert the plot into a plot with settings module from teal.widgets
pws <- teal.widgets::plot_with_settings_srv(
id = "myplot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
9 changes: 3 additions & 6 deletions R/tm_g_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -435,9 +435,7 @@ ui_g_km <- function(id, ...) {
teal.widgets::standard_layout(
output = teal.widgets::white_small_well(
verbatimTextOutput(outputId = ns("text")),
teal.widgets::plot_with_settings_ui(
id = ns("myplot")
)
tmcplot_with_settings_ui()
),
encoding = tags$div(
### Reporter
Expand Down Expand Up @@ -637,7 +635,7 @@ srv_g_km <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
# Setup arm variable selection, default reference arms and default
# comparison arms for encoding panel
iv_arm_ref <- arm_ref_comp_observer(
Expand Down Expand Up @@ -807,8 +805,7 @@ srv_g_km <- function(id,
plot_r <- reactive(all_q()[["plot"]])

# Insert the plot into a plot with settings module from teal.widgets
pws <- teal.widgets::plot_with_settings_srv(
id = "myplot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
9 changes: 3 additions & 6 deletions R/tm_g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,7 @@ ui_g_lineplot <- function(id, ...) {
teal.widgets::standard_layout(
output = teal.widgets::white_small_well(
verbatimTextOutput(outputId = ns("text")),
teal.widgets::plot_with_settings_ui(
id = ns("myplot")
)
tmcplot_with_settings_ui()
),
encoding = tags$div(
### Reporter
Expand Down Expand Up @@ -516,7 +514,7 @@ srv_g_lineplot <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
selector_list <- teal.transform::data_extract_multiple_srv(
data_extract = list(x = x, y = y, strata = strata, paramcd = paramcd, y_unit = y_unit, param = param),
datasets = data,
Expand Down Expand Up @@ -627,8 +625,7 @@ srv_g_lineplot <- function(id,
plot_r <- reactive(all_q()[["plot"]])

# Insert the plot into a plot with settings module from teal.widgets
pws <- teal.widgets::plot_with_settings_srv(
id = "myplot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
7 changes: 3 additions & 4 deletions R/tm_g_pp_adverse_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ ui_g_adverse_events <- function(id, ...) {
htmlOutput(ns("title")),
teal.widgets::get_dt_rows(ns("table"), ns("table_rows")),
DT::DTOutput(outputId = ns("table")),
teal.widgets::plot_with_settings_ui(id = ns("chart"))
tmcplot_with_settings_ui()
),
encoding = tags$div(
### Reporter
Expand Down Expand Up @@ -442,7 +442,7 @@ srv_g_adverse_events <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
patient_id <- reactive(input$patient_id)

# Init
Expand Down Expand Up @@ -564,8 +564,7 @@ srv_g_adverse_events <- function(id,
all_q()[["plot"]]
})

pws <- teal.widgets::plot_with_settings_srv(
id = "chart",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
9 changes: 4 additions & 5 deletions R/tm_g_pp_patient_timeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ ui_g_patient_timeline <- function(id, ...) {

ns <- NS(id)
teal.widgets::standard_layout(
output = teal.widgets::plot_with_settings_ui(id = ns("patient_timeline_plot")),
output = tmcplot_with_settings_ui(),
encoding = tags$div(
### Reporter
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
Expand Down Expand Up @@ -713,7 +713,7 @@ srv_g_patient_timeline <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
patient_id <- reactive(input$patient_id)

# Init
Expand Down Expand Up @@ -903,10 +903,9 @@ srv_g_patient_timeline <- function(id,
teal.code::eval_code(object = qenv, as.expression(patient_timeline_calls))
})

plot_r <- reactive(all_q()[["patient_timeline_plot"]])
plot_r <- reactive(all_q()[["tmcplot"]])

pws <- teal.widgets::plot_with_settings_srv(
id = "patient_timeline_plot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
9 changes: 4 additions & 5 deletions R/tm_g_pp_therapy.R
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ ui_g_therapy <- function(id, ...) {
htmlOutput(ns("title")),
teal.widgets::get_dt_rows(ns("therapy_table"), ns("therapy_table_rows")),
DT::DTOutput(outputId = ns("therapy_table")),
teal.widgets::plot_with_settings_ui(id = ns("therapy_plot"))
tmcplot_with_settings_ui()
),
encoding = tags$div(
### Reporter
Expand Down Expand Up @@ -557,7 +557,7 @@ srv_g_therapy <- function(id,
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
if (shiny::isRunning()) logger::log_shiny_input_changes(input, namespace = "teal.modules.clinical")
tmc_track_shiny_input_changes(input)
patient_id <- reactive(input$patient_id)

# Init
Expand Down Expand Up @@ -681,11 +681,10 @@ srv_g_therapy <- function(id,

plot_r <- reactive({
req(iv_r()$is_valid())
all_q()[["therapy_plot"]]
all_q()[["tmcplot"]]
})

pws <- teal.widgets::plot_with_settings_srv(
id = "therapy_plot",
pws <- tmcplot_with_settings_srv(
plot_r = plot_r,
height = plot_height,
width = plot_width
Expand Down
Loading
Loading