Skip to content

Commit

Permalink
tm_g_ae_overview
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksander Chlebowski committed Nov 23, 2023
1 parent def7e30 commit e9175a0
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions R/tm_g_ae_oview.R
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,12 @@ srv_g_ae_oview <- function(id,
plot_width) {
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
checkmate::assert_class(data, "tdata")
checkmate::assert_class(data, "reactive")
checkmate::assert_class(isolate(data()), "teal_data")

moduleServer(id, function(input, output, session) {
iv <- reactive({
ANL <- data[[dataname]]() # nolint
ANL <- data()[[dataname]] # nolint

iv <- shinyvalidate::InputValidator$new()
iv$add_rule("arm_var", shinyvalidate::sv_required(
Expand Down Expand Up @@ -255,7 +256,7 @@ srv_g_ae_oview <- function(id,
})

observeEvent(input$arm_var, ignoreNULL = TRUE, {
ANL <- data[[dataname]]() # nolint
ANL <- data()[[dataname]] # nolint
arm_var <- input$arm_var
arm_val <- ANL[[arm_var]]
choices <- levels(arm_val)
Expand Down Expand Up @@ -283,7 +284,7 @@ srv_g_ae_oview <- function(id,
output_q <- shiny::debounce(
millis = 200,
r = reactive({
ANL <- data[[dataname]]() # nolint
ANL <- data()[[dataname]] # nolint

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

Expand All @@ -295,7 +296,7 @@ srv_g_ae_oview <- function(id,
))

q1 <- teal.code::eval_code(
teal.code::new_qenv(tdata2env(data), code = get_code_tdata(data)),
data(),
code = as.expression(c(
bquote(anl_labels <- formatters::var_labels(.(as.name(dataname)), fill = FALSE)),
bquote(flags <- .(as.name(dataname)) %>%
Expand Down

0 comments on commit e9175a0

Please sign in to comment.