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

qenv warnings #621

Merged
merged 14 commits into from
Oct 27, 2022
14 changes: 12 additions & 2 deletions R/tm_a_mmrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,10 @@ ui_mmrm <- function(id, ...) {
)
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = a$pre_output,
post_output = a$post_output
)
Expand Down Expand Up @@ -877,7 +880,7 @@ srv_mmrm <- function(id,
)

anl_merged_q <- reactive({
q1 <- teal.code::new_qenv(tdata2env(data), code = get_code(data))
q1 <- teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data))
q2 <- teal.code::eval_code(q1, as.expression(anl_merge_inputs()$expr))
teal.code::eval_code(q2, as.expression(adsl_merge_inputs()$expr))
})
Expand Down Expand Up @@ -1440,6 +1443,13 @@ srv_mmrm <- function(id,
return(what_to_return)
})

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(all_code())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(all_code())))
)

# Show R code once button is pressed.
teal.widgets::verbatim_popup_srv(
id = "rcode",
Expand Down
14 changes: 12 additions & 2 deletions R/tm_g_barchart_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ ui_g_barchart_simple <- function(id, ...) {
)
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code"),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
),
pre_output = args$pre_output,
post_output = args$post_output
)
Expand Down Expand Up @@ -332,7 +335,7 @@ srv_g_barchart_simple <- function(id,
shiny::validate({
shiny::need(merge_inputs()$columns_source$x, "Please select an x-variable")
})
quo <- teal.code::new_qenv(tdata2env(data), code = get_code(data))
quo <- teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data))
quo <- teal.code::eval_code(quo, as.expression(merge_inputs()$expr))
quo
})
Expand Down Expand Up @@ -481,6 +484,13 @@ srv_g_barchart_simple <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
14 changes: 12 additions & 2 deletions R/tm_g_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,10 @@ ui_g_ci <- function(id, ...) { # nolint
selected = args$stat
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = args$pre_output,
post_output = args$post_output
)
Expand Down Expand Up @@ -382,7 +385,7 @@ srv_g_ci <- function(id, # nolint

merged_data_q <- reactive(
teal.code::eval_code(
object = teal.code::new_qenv(tdata2env(data), code = get_code(data)),
object = teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data)),
code = as.expression(merged_data()$expr)
)
)
Expand Down Expand Up @@ -450,6 +453,13 @@ srv_g_ci <- function(id, # nolint

plot_r <- shiny::reactive(output_q()[["gg"]])

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
16 changes: 13 additions & 3 deletions R/tm_g_forest_rsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,10 @@ ui_g_forest_rsp <- function(id, ...) {
)
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code")
),
pre_output = a$pre_output,
post_output = a$post_output
)
Expand Down Expand Up @@ -513,7 +516,7 @@ srv_g_forest_rsp <- function(id,
)

anl_merged_q <- reactive({
q <- teal.code::new_qenv(tdata2env(data), code = get_code(data))
q <- teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data))
q1 <- teal.code::eval_code(q, as.expression(anl_merged()$expr))
teal.code::eval_code(q1, as.expression(adsl_merged()$expr))
})
Expand Down Expand Up @@ -704,6 +707,13 @@ srv_g_forest_rsp <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand All @@ -725,7 +735,7 @@ srv_g_forest_rsp <- function(id,
card$append_text("Comment", "header3")
card$append_text(comment)
}
card$append_src(paste(teal.code::get_code(output_q()), collapse = "\n"))
card$append_src(paste(teal.code::get_code(output_q()), collapse = "\n"), dd = "")
card
}
teal.reporter::simple_reporter_srv("simple_reporter", reporter = reporter, card_fun = card_fun)
Expand Down
14 changes: 12 additions & 2 deletions R/tm_g_forest_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,10 @@ ui_g_forest_tte <- function(id, ...) {
)
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
),
pre_output = a$pre_output,
post_output = a$post_output
)
Expand Down Expand Up @@ -520,7 +523,7 @@ srv_g_forest_tte <- function(id,
)

anl_merged_q <- reactive({
q <- teal.code::new_qenv(tdata2env(data), code = get_code(data))
q <- teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data))
q1 <- teal.code::eval_code(q, as.expression(anl_merged()$expr))
teal.code::eval_code(q1, as.expression(adsl_merged()$expr))
})
Expand Down Expand Up @@ -637,6 +640,13 @@ srv_g_forest_tte <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
14 changes: 12 additions & 2 deletions R/tm_g_ipp.R
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,10 @@ ui_g_ipp <- function(id, ...) {
)
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
),
pre_output = a$pre_output,
post_output = a$post_output
)
Expand Down Expand Up @@ -494,7 +497,7 @@ srv_g_ipp <- function(id,
)

anl_merged_q <- reactive({
q <- teal.code::new_qenv(tdata2env(data), code = get_code(data))
q <- teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data))
q1 <- teal.code::eval_code(q, as.expression(anl_merged()$expr))
teal.code::eval_code(q1, as.expression(adsl_merged()$expr))
})
Expand Down Expand Up @@ -594,6 +597,13 @@ srv_g_ipp <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
17 changes: 13 additions & 4 deletions R/tm_g_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,10 @@ ui_g_km <- function(id, ...) {
)
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"),
forms = tagList(
nikolas-burkoff marked this conversation as resolved.
Show resolved Hide resolved
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
),
pre_output = a$pre_output,
post_output = a$post_output
)
Expand Down Expand Up @@ -660,7 +663,7 @@ srv_g_km <- function(id,

anl_merged_q <- reactive({
teal.code::eval_code(
teal.code::new_qenv(tdata2env(data), code = get_code(data)),
teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data)),
code = as.expression(anl_merged()$expr)
)
})
Expand Down Expand Up @@ -696,13 +699,12 @@ srv_g_km <- function(id,
if (length(input_arm_var) > 0 && length(unique(adsl_filtered[[input_arm_var]])) == 1) {
validate_args <- append(validate_args, list(min_n_levels_armvar = NULL))
}
if (input$compare_arms) {
if (isTRUE(input$compare_arms)) {
validate_args <- append(
validate_args,
list(ref_arm = unlist(input$buckets$Ref), comp_arm = unlist(input$buckets$Comp))
)
}

do.call(what = "validate_standard_inputs", validate_args)

# validate xticks
Expand Down Expand Up @@ -789,6 +791,13 @@ srv_g_km <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
14 changes: 12 additions & 2 deletions R/tm_g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,10 @@ ui_g_lineplot <- function(id, ...) {
)
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
),
pre_output = a$pre_output,
post_output = a$post_output
)
Expand Down Expand Up @@ -523,7 +526,7 @@ srv_g_lineplot <- function(id,
)

anl_merged_q <- reactive({
teal.code::new_qenv(tdata2env(data), code = get_code(data)) %>% teal.code::eval_code(as.expression(anl_merged_input()$expr))
teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data)) %>% teal.code::eval_code(as.expression(anl_merged_input()$expr))
})

merged <- list(anl_input_r = anl_merged_input, anl_q_r = anl_merged_q)
Expand Down Expand Up @@ -613,6 +616,13 @@ srv_g_lineplot <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
14 changes: 12 additions & 2 deletions R/tm_g_pp_adverse_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,10 @@ ui_g_adverse_events <- function(id, ...) {
)
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
),
pre_output = ui_args$pre_output,
post_output = ui_args$post_output
)
Expand Down Expand Up @@ -467,7 +470,7 @@ srv_g_adverse_events <- function(id,
join_keys = get_join_keys(data)
)

anl_merged_q <- reactive(teal.code::eval_code(teal.code::new_qenv(tdata2env(data), code = get_code(data)), as.expression(anl_merged()$expr)))
anl_merged_q <- reactive(teal.code::eval_code(teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data)), as.expression(anl_merged()$expr)))

outputs_q <- shiny::reactive({
shiny::validate(shiny::need(patient_id(), "Please select a patient."))
Expand Down Expand Up @@ -545,6 +548,13 @@ srv_g_adverse_events <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(outputs_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(outputs_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(outputs_q())),
Expand Down
14 changes: 12 additions & 2 deletions R/tm_g_pp_patient_timeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,10 @@ ui_g_patient_timeline <- function(id, ...) {
)
)
),
forms = teal.widgets::verbatim_popup_ui(ns("rcode"), "Show R code"),
forms = tagList(
teal.widgets::verbatim_popup_ui(ns("warning"), button_label = "Show Warnings"),
teal.widgets::verbatim_popup_ui(ns("rcode"), button_label = "Show R code")
),
pre_output = ui_args$pre_output,
post_output = ui_args$post_output
)
Expand Down Expand Up @@ -761,7 +764,7 @@ srv_g_patient_timeline <- function(id,
)

merge_q_r <- reactive({
teal.code::new_qenv(tdata2env(data), code = get_code(data)) %>%
teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data)) %>%
teal.code::eval_code(as.expression(merge_input_r()$expr))
})

Expand Down Expand Up @@ -882,6 +885,13 @@ srv_g_patient_timeline <- function(id,
width = plot_width
)

teal.widgets::verbatim_popup_srv(
id = "warning",
verbatim_content = reactive(teal.code::get_warnings(output_q())),
title = "Warning",
disabled = reactive(is.null(teal.code::get_warnings(output_q())))
)

teal.widgets::verbatim_popup_srv(
id = "rcode",
verbatim_content = reactive(teal.code::get_code(output_q())),
Expand Down
Loading