Skip to content

Commit

Permalink
Merge branch 'main' into fix-pipelines@main
Browse files Browse the repository at this point in the history
  • Loading branch information
m7pr authored Oct 7, 2024
2 parents e0bd5e1 + 60caaa6 commit 6046050
Show file tree
Hide file tree
Showing 10 changed files with 108 additions and 113 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# All available hooks: https://pre-commit.com/hooks.html
# R specific hooks: https://github.com/lorenzwalthert/precommit
default_stages: [commit]
default_stages: [pre-commit]
default_language_version:
python: python3
repos:
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: teal.goshawk
Title: Longitudinal Visualization `teal` Modules
Version: 0.2.0.9008
Date: 2024-10-03
Version: 0.2.0.9011
Date: 2024-10-07
Authors@R: c(
person("Nick", "Paszty", , "[email protected]", role = c("aut", "cre")),
person("Dawid", "Kaledkowski", , "[email protected]", role = "aut"),
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# teal.goshawk 0.2.0.9008
# teal.goshawk 0.2.0.9011

# teal.goshawk 0.2.0

Expand Down
53 changes: 22 additions & 31 deletions R/tm_g_gh_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,6 @@ tm_g_gh_boxplot <- function(label,
server_args = list(
dataname = dataname,
param_var = param_var,
trt_group = trt_group,
facet_var = facet_var,
color_manual = color_manual,
shape_manual = shape_manual,
plot_height = plot_height,
Expand Down Expand Up @@ -248,21 +246,7 @@ ui_g_boxplot <- function(id, ...) {
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
templ_ui_dataname(a$dataname),
teal.widgets::optionalSelectInput(
ns("trt_group"),
label = "Select Treatment Variable",
choices = get_choices(a$trt_group$choices),
selected = a$trt_group$selected,
multiple = FALSE
),
uiOutput(ns("axis_selections")),
teal.widgets::optionalSelectInput(
ns("facet_var"),
label = "Facet by",
choices = get_choices(a$facet_var$choices),
selected = a$facet_var$selected,
multiple = FALSE
),
templ_ui_constraint(ns, label = "Data Constraint"), # required by constr_anl_q
if (length(a$hline_vars) > 0) {
teal.widgets::optionalSelectInput(
Expand Down Expand Up @@ -312,7 +296,6 @@ srv_g_boxplot <- function(id,
dataname,
param_var,
trt_group,
facet_var,
color_manual,
shape_manual,
plot_height,
Expand All @@ -331,6 +314,9 @@ srv_g_boxplot <- function(id,
resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env)
resolved_y <- teal.transform::resolve_delayed(module_args$yaxis_var, env)
resolved_param <- teal.transform::resolve_delayed(module_args$param, env)
resolved_facet_var <- teal.transform::resolve_delayed(module_args$facet_var, env)
resolved_trt <- teal.transform::resolve_delayed(module_args$trt_group, env)

templ_ui_params_vars(
session$ns,
xparam_choices = resolved_param$choices,
Expand All @@ -339,7 +325,11 @@ srv_g_boxplot <- function(id,
xchoices = resolved_x$choices,
xselected = resolved_x$selected,
ychoices = resolved_y$choices,
yselected = resolved_y$selected
yselected = resolved_y$selected,
facet_choices = resolved_facet_var$choices,
facet_selected = resolved_facet_var$selected,
trt_choices = resolved_trt$choices,
trt_selected = resolved_trt$selected
)
})
# reused in all modules
Expand Down Expand Up @@ -395,7 +385,7 @@ srv_g_boxplot <- function(id,
iv
})

create_plot <- reactive({
create_plot <- debounce(reactive({
teal::validate_inputs(iv_r())

req(anl_q())
Expand Down Expand Up @@ -468,15 +458,16 @@ srv_g_boxplot <- function(id,
)
})
)
})
}), 800)

create_table <- reactive({
create_table <- debounce(reactive({
req(iv_r()$is_valid())
req(anl_q())
param <- input$xaxis_param
xaxis_var <- input$yaxis_var # nolint
font_size <- input$font_size
trt_group <- input$trt_group
facet_var <- input$facet_var

anl_q()$qenv %>% teal.code::eval_code(
code = bquote({
Expand All @@ -486,11 +477,11 @@ srv_g_boxplot <- function(id,
param_var = .(param_var),
param = .(param),
xaxis_var = .(xaxis_var),
facet_var = .(input$facet_var)
facet_var = .(facet_var)
)
})
)
})
}), 800)

plot_r <- reactive({
create_plot()[["p"]]
Expand All @@ -511,8 +502,7 @@ srv_g_boxplot <- function(id,
numeric_cols <- setdiff(names(dplyr::select_if(tbl, is.numeric)), "n")

DT::datatable(tbl,
rownames = FALSE, options = list(scrollX = TRUE),
callback = DT::JS("$.fn.dataTable.ext.errMode = 'none';")
rownames = FALSE, options = list(scrollX = TRUE)
) %>%
DT::formatRound(numeric_cols, 4)
})
Expand Down Expand Up @@ -557,7 +547,7 @@ srv_g_boxplot <- function(id,
###

# highlight plot area
output$brush_data <- DT::renderDataTable({
reactive_df <- debounce(reactive({
boxplot_brush <- boxplot_data$brush()

ANL <- isolate(anl_q()$ANL) %>% droplevels() # nolint
Expand All @@ -570,19 +560,20 @@ srv_g_boxplot <- function(id,

req(all(c(xvar, yvar, facetv, trt_group) %in% names(ANL)))

df <- teal.widgets::clean_brushedPoints(
teal.widgets::clean_brushedPoints(
dplyr::select(
ANL, "USUBJID", dplyr::all_of(c(trt_group, facetv)),
"AVISITCD", "PARAMCD", dplyr::all_of(c(xvar, yvar)), "LOQFL"
),
boxplot_brush
)
}), 800)

numeric_cols <- names(dplyr::select_if(df, is.numeric))
output$brush_data <- DT::renderDataTable({
numeric_cols <- names(dplyr::select_if(reactive_df(), is.numeric))

DT::datatable(df,
rownames = FALSE, options = list(scrollX = TRUE),
callback = DT::JS("$.fn.dataTable.ext.errMode = 'none';")
DT::datatable(reactive_df(),
rownames = FALSE, options = list(scrollX = TRUE)
) %>%
DT::formatRound(numeric_cols, 4)
})
Expand Down
30 changes: 13 additions & 17 deletions R/tm_g_gh_correlationplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ tm_g_gh_correlationplot <- function(label,
server_args = list(
dataname = dataname,
param_var = param_var,
trt_group = trt_group,
trt_facet = trt_facet,
color_manual = color_manual,
shape_manual = shape_manual,
Expand Down Expand Up @@ -283,13 +282,6 @@ ui_g_correlationplot <- function(id, ...) {
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
templ_ui_dataname(a$dataname),
teal.widgets::optionalSelectInput(
ns("trt_group"),
label = "Select Treatment Variable",
choices = get_choices(a$trt_group$choices),
selected = a$trt_group$selected,
multiple = FALSE
),
uiOutput(ns("axis_selections")),
templ_ui_constraint(ns, "X-Axis Data Constraint"), # required by constr_anl_q
if (length(a$hline_vars) > 0) {
Expand Down Expand Up @@ -388,6 +380,7 @@ srv_g_correlationplot <- function(id,
resolved_x_var <- teal.transform::resolve_delayed(module_args$xaxis_var, env)
resolved_y_param <- teal.transform::resolve_delayed(module_args$yaxis_param, env)
resolved_y_var <- teal.transform::resolve_delayed(module_args$yaxis_var, env)
resolved_trt <- teal.transform::resolve_delayed(module_args$trt_group, env)
templ_ui_params_vars(
session$ns,
xparam_choices = resolved_x_param$choices,
Expand All @@ -397,7 +390,9 @@ srv_g_correlationplot <- function(id,
yparam_choices = resolved_y_param$choices,
yparam_selected = resolved_y_param$selected,
ychoices = resolved_y_var$choices,
yselected = resolved_y_var$selected
yselected = resolved_y_var$selected,
trt_choices = resolved_trt$choices,
trt_selected = resolved_trt$selected
)
})

Expand Down Expand Up @@ -722,7 +717,7 @@ srv_g_correlationplot <- function(id,
vertical_line <- srv_arbitrary_lines("vline_arb")

# plot
plot_q <- reactive({
plot_q <- debounce(reactive({
req(plot_data_transpose())
# nolint start
xaxis_param <- input$xaxis_param
Expand Down Expand Up @@ -814,7 +809,7 @@ srv_g_correlationplot <- function(id,
print(p)
})
)
})
}), 800)

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

Expand Down Expand Up @@ -862,8 +857,7 @@ srv_g_correlationplot <- function(id,
}
###

# highlight plot area
output$brush_data <- DT::renderDataTable({
reactive_df <- debounce(reactive({
req(iv_r()$is_valid())
plot_brush <- plot_data$brush()

Expand All @@ -876,12 +870,14 @@ srv_g_correlationplot <- function(id,
),
plot_brush
)
}), 800)

numeric_cols <- names(dplyr::select_if(df, is.numeric))
# highlight plot area
output$brush_data <- DT::renderDataTable({
numeric_cols <- names(dplyr::select_if(reactive_df(), is.numeric))

DT::datatable(df,
rownames = FALSE, options = list(scrollX = TRUE),
callback = DT::JS("$.fn.dataTable.ext.errMode = 'none';")
DT::datatable(reactive_df(),
rownames = FALSE, options = list(scrollX = TRUE)
) %>%
DT::formatRound(numeric_cols, 4)
})
Expand Down
25 changes: 10 additions & 15 deletions R/tm_g_gh_density_distribution_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ tm_g_gh_density_distribution_plot <- function(label, # nolint
dataname = dataname,
param_var = param_var,
param = param,
trt_group = trt_group,
color_manual = color_manual,
color_comb = color_comb,
plot_height = plot_height,
Expand Down Expand Up @@ -196,13 +195,6 @@ ui_g_density_distribution_plot <- function(id, ...) {
teal.reporter::simple_reporter_ui(ns("simple_reporter")),
###
templ_ui_dataname(a$dataname),
teal.widgets::optionalSelectInput(
ns("trt_group"),
label = "Select Treatment Variable",
choices = get_choices(a$trt_group$choices),
selected = a$trt_group$selected,
multiple = FALSE
),
uiOutput(ns("axis_selections")),
templ_ui_constraint(ns, label = "Data Constraint"),
ui_arbitrary_lines(id = ns("hline_arb"), a$hline_arb, a$hline_arb_label, a$hline_arb_color),
Expand Down Expand Up @@ -272,13 +264,17 @@ srv_g_density_distribution_plot <- function(id, # nolint
env <- shiny::isolate(as.list(data()@env))
resolved_x <- teal.transform::resolve_delayed(module_args$xaxis_var, env)
resolved_param <- teal.transform::resolve_delayed(module_args$param, env)
resolved_trt <- teal.transform::resolve_delayed(module_args$trt_group, env)

templ_ui_params_vars(
session$ns,
xparam_choices = resolved_param$choices,
xparam_selected = resolved_param$selected,
xparam_label = "Select a Biomarker",
xchoices = resolved_x$choices,
xselected = resolved_x$selected
xselected = resolved_x$selected,
trt_choices = resolved_trt$choices,
trt_selected = resolved_trt$selected
)
})

Expand Down Expand Up @@ -322,7 +318,7 @@ srv_g_density_distribution_plot <- function(id, # nolint
})


create_plot <- reactive({
create_plot <- debounce(reactive({
teal::validate_inputs(iv_r())
req(anl_q())

Expand Down Expand Up @@ -369,9 +365,9 @@ srv_g_density_distribution_plot <- function(id, # nolint
)
})
)
})
}), 800)

create_table <- reactive({
create_table <- debounce(reactive({
req(iv_r()$is_valid())
req(anl_q())
param <- input$xaxis_param
Expand All @@ -392,7 +388,7 @@ srv_g_density_distribution_plot <- function(id, # nolint
)
)
)
})
}), 800)

plot_r <- reactive({
create_plot()[["p"]]
Expand All @@ -411,8 +407,7 @@ srv_g_density_distribution_plot <- function(id, # nolint
numeric_cols <- names(dplyr::select_if(tbl, is.numeric))

DT::datatable(tbl,
rownames = FALSE, options = list(scrollX = TRUE),
callback = DT::JS("$.fn.dataTable.ext.errMode = 'none';")
rownames = FALSE, options = list(scrollX = TRUE)
) %>%
DT::formatRound(numeric_cols, 2)
})
Expand Down
Loading

0 comments on commit 6046050

Please sign in to comment.