Skip to content

Commit

Permalink
Merge branch 'main' into 263_loq_flag@main
Browse files Browse the repository at this point in the history
  • Loading branch information
ayogasekaram authored Feb 20, 2024
2 parents 3af494f + 3f3b1f5 commit 773918e
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 61 deletions.
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.1.15.9009
Date: 2024-02-09
Version: 0.1.15.9011
Date: 2024-02-14
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.1.15.9009
# teal.goshawk 0.1.15.9011

### Breaking Changes
* Adapted all modules to use `teal_data` objects.
Expand Down
4 changes: 1 addition & 3 deletions R/teal_goshawk.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
#' The data used for teal.goshawk have some constraints.
#' It must contain the columns `AVISITCD`, `BASE`, `BASE2`, `AVALU`, `LBSTRESC`, `LOQFL`, `CHG2`, and `PCHG2`.
#'
#' @docType package
#'
#' @name teal_goshawk
#'
#' @import goshawk
Expand All @@ -17,4 +15,4 @@
#' @importFrom rlang .data sym
#' @importFrom teal.transform choices_selected
#' @keywords internal
NULL
"_PACKAGE"
33 changes: 21 additions & 12 deletions R/tm_g_gh_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ tm_g_gh_boxplot <- function(label,
plot_height = plot_height,
plot_width = plot_width,
hline_vars_colors = hline_vars_colors,
hline_vars_labels = hline_vars_labels
hline_vars_labels = hline_vars_labels,
module_args = args
),
ui = ui_g_boxplot,
ui_args = args
Expand Down Expand Up @@ -251,16 +252,7 @@ ui_g_boxplot <- function(id, ...) {
selected = a$trt_group$selected,
multiple = FALSE
),
templ_ui_params_vars(
ns,
xparam_choices = a$param$choices,
xparam_selected = a$param$selected,
xparam_label = "Select a Biomarker",
xchoices = a$xaxis_var$choices,
xselected = a$xaxis_var$selected,
ychoices = a$yaxis_var$choices,
yselected = a$yaxis_var$selected
),
uiOutput(ns("axis_selections")),
teal.widgets::optionalSelectInput(
ns("facet_var"),
label = "Facet by",
Expand Down Expand Up @@ -324,13 +316,30 @@ srv_g_boxplot <- function(id,
plot_height,
plot_width,
hline_vars_colors,
hline_vars_labels) {
hline_vars_labels,
module_args) {
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")

moduleServer(id, function(input, output, session) {
output$axis_selections <- renderUI({
env <- shiny::isolate(as.list(data()@env))
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)
templ_ui_params_vars(
session$ns,
xparam_choices = resolved_param$choices,
xparam_selected = resolved_param$selected,
xparam_label = module_args$"Select a Biomarker",
xchoices = resolved_x$choices,
xselected = resolved_x$selected,
ychoices = resolved_y$choices,
yselected = resolved_y$selected
)
})
# reused in all modules
anl_q_output <- constr_anl_q(
session, input, data, dataname,
Expand Down
33 changes: 24 additions & 9 deletions R/tm_g_gh_correlationplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@ tm_g_gh_correlationplot <- function(label,
hline_vars_colors = hline_vars_colors,
hline_vars_labels = hline_vars_labels,
vline_vars_colors = vline_vars_colors,
vline_vars_labels = vline_vars_labels
vline_vars_labels = vline_vars_labels,
module_args = args
),
ui = ui_g_correlationplot,
ui_args = args
Expand All @@ -284,13 +285,7 @@ ui_g_correlationplot <- function(id, ...) {
selected = a$trt_group$selected,
multiple = FALSE
),
templ_ui_params_vars(
ns,
xparam_choices = a$xaxis_param$choices, xparam_selected = a$xaxis_param$selected,
xchoices = a$xaxis_var$choices, xselected = a$xaxis_var$selected,
yparam_choices = a$yaxis_param$choices, yparam_selected = a$yaxis_param$selected,
ychoices = a$yaxis_var$choices, yselected = a$yaxis_var$selected
),
uiOutput(ns("axis_selections")),
templ_ui_constraint(ns, "X-Axis Data Constraint"), # required by constr_anl_q
if (length(a$hline_vars) > 0) {
teal.widgets::optionalSelectInput(
Expand Down Expand Up @@ -375,13 +370,33 @@ srv_g_correlationplot <- function(id,
hline_vars_colors,
hline_vars_labels,
vline_vars_colors,
vline_vars_labels) {
vline_vars_labels,
module_args) {
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")

moduleServer(id, function(input, output, session) {
output$axis_selections <- renderUI({
env <- shiny::isolate(as.list(data()@env))
resolved_x_param <- teal.transform::resolve_delayed(module_args$xaxis_param, env)
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)
templ_ui_params_vars(
session$ns,
xparam_choices = resolved_x_param$choices,
xparam_selected = resolved_x_param$selected,
xchoices = resolved_x_var$choices,
xselected = resolved_x_var$selected,
yparam_choices = resolved_y_param$choices,
yparam_selected = resolved_y_param$selected,
ychoices = resolved_y_var$choices,
yselected = resolved_y_var$selected
)
})

iv_r <- reactive({
iv <- shinyvalidate::InputValidator$new()

Expand Down
26 changes: 19 additions & 7 deletions R/tm_g_gh_density_distribution_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ tm_g_gh_density_distribution_plot <- function(label, # nolint
color_manual = color_manual,
color_comb = color_comb,
plot_height = plot_height,
plot_width = plot_width
plot_width = plot_width,
module_args = args
),
ui = ui_g_density_distribution_plot,
ui_args = args
Expand Down Expand Up @@ -201,11 +202,7 @@ ui_g_density_distribution_plot <- function(id, ...) {
selected = a$trt_group$selected,
multiple = FALSE
),
templ_ui_params_vars(
ns,
xparam_choices = a$param$choices, xparam_selected = a$param$selected, xparam_label = "Select a Biomarker",
xchoices = a$xaxis_var$choices, xselected = a$xaxis_var$selected
),
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),
teal.widgets::panel_group(
Expand Down Expand Up @@ -263,13 +260,28 @@ srv_g_density_distribution_plot <- function(id, # nolint
color_manual,
color_comb,
plot_height,
plot_width) {
plot_width,
module_args) {
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")

moduleServer(id, function(input, output, session) {
output$axis_selections <- renderUI({
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)
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
)
})

anl_q_output <- constr_anl_q(
session, input, data, dataname,
param_id = "xaxis_param", param_var = param_var, trt_group = input$trt_group, min_rows = 2
Expand Down
33 changes: 24 additions & 9 deletions R/tm_g_gh_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ tm_g_gh_lineplot <- function(label,
xtick = xtick,
xlabel = xlabel,
plot_height = plot_height,
plot_width = plot_width
plot_width = plot_width,
module_args = args
),
ui = ui_lineplot,
ui_args = args,
Expand Down Expand Up @@ -226,13 +227,7 @@ ui_lineplot <- function(id, ...) {
selected = a$trt_group$selected,
multiple = FALSE
),
templ_ui_params_vars(
ns,
# xparam and yparam are identical, so we only show the user one
xparam_choices = a$param$choices, xparam_selected = a$param$selected, xparam_label = "Select a Biomarker",
xchoices = a$xaxis_var$choices, xselected = a$xaxis_var$selected,
ychoices = a$yaxis_var$choices, yselected = a$yaxis_var$selected
),
uiOutput(ns("axis_selections")),
uiOutput(ns("shape_ui")),
radioButtons(ns("stat"), "Select a Statistic:", c("mean", "median"), a$stat),
checkboxInput(ns("include_stat"), "Include Statistic Table", value = TRUE),
Expand Down Expand Up @@ -328,14 +323,34 @@ srv_lineplot <- function(id,
xtick,
xlabel,
plot_height,
plot_width) {
plot_width,
module_args) {
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")

moduleServer(id, function(input, output, session) {
ns <- session$ns

output$axis_selections <- renderUI({
env <- shiny::isolate(as.list(data()@env))
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)
templ_ui_params_vars(
ns,
# xparam and yparam are identical, so we only show the user one
xparam_choices = resolved_param$choices,
xparam_selected = resolved_param$selected,
xparam_label = "Select a Biomarker",
xchoices = resolved_x$choices,
xselected = resolved_x$selected,
ychoices = resolved_y$choices,
yselected = resolved_y$selected
)
})

output$shape_ui <- renderUI({
if (!is.null(shape_choices)) {
if (methods::is(shape_choices, "choices_selected")) {
Expand Down
32 changes: 23 additions & 9 deletions R/tm_g_gh_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ tm_g_gh_scatterplot <- function(label,
color_manual = color_manual,
shape_manual = shape_manual,
plot_height = plot_height,
plot_width = plot_width
plot_width = plot_width,
module_args = args
),
ui = ui_g_scatterplot,
ui_args = args
Expand All @@ -200,13 +201,7 @@ ui_g_scatterplot <- function(id, ...) {
selected = a$trt_group$selected,
multiple = FALSE
),
templ_ui_params_vars(
ns,
# xparam and yparam are identical, so we only show the user one
xparam_choices = a$param$choices, xparam_selected = a$param$selected, xparam_label = "Select a Biomarker",
xchoices = a$xaxis_var$choices, xselected = a$xaxis_var$selected,
ychoices = a$yaxis_var$choices, yselected = a$yaxis_var$selected
),
uiOutput(ns("axis_selections")),
templ_ui_constraint(ns), # required by constr_anl_q
teal.widgets::panel_group(
teal.widgets::panel_item(
Expand Down Expand Up @@ -263,13 +258,32 @@ srv_g_scatterplot <- function(id,
color_manual,
shape_manual,
plot_height,
plot_width) {
plot_width,
module_args) {
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")

moduleServer(id, function(input, output, session) {
output$axis_selections <- renderUI({
env <- shiny::isolate(as.list(data()@env))
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)
templ_ui_params_vars(
session$ns,
# xparam and yparam are identical, so we only show the user one
xparam_choices = resolved_param$choices,
xparam_selected = resolved_param$selected,
xparam_label = "Select a Biomarker",
xchoices = resolved_x$choices,
xselected = resolved_x$selected,
ychoices = resolved_y$choices,
yselected = resolved_y$selected
)
})

# reused in all modules
anl_q_output <- constr_anl_q(
session, input, data, dataname,
Expand Down
32 changes: 23 additions & 9 deletions R/tm_g_gh_spaghettiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ tm_g_gh_spaghettiplot <- function(label,
plot_height = plot_height,
plot_width = plot_width,
hline_vars_colors = hline_vars_colors,
hline_vars_labels = hline_vars_labels
hline_vars_labels = hline_vars_labels,
module_args = args
),
ui = g_ui_spaghettiplot,
ui_args = args,
Expand Down Expand Up @@ -250,13 +251,7 @@ g_ui_spaghettiplot <- function(id, ...) {
selected = a$trt_group$selected,
multiple = FALSE
),
templ_ui_params_vars(
ns,
# xparam and yparam are identical, so we only show the user one
xparam_choices = a$param$choices, xparam_selected = a$param$selected, xparam_label = "Select a Biomarker",
xchoices = a$xaxis_var$choices, xselected = a$xaxis_var$selected,
ychoices = a$yaxis_var$choices, yselected = a$yaxis_var$selected
),
uiOutput(ns("axis_selections")),
radioButtons(
ns("group_stats"),
"Group Statistics",
Expand Down Expand Up @@ -339,13 +334,32 @@ srv_g_spaghettiplot <- function(id,
plot_height,
plot_width,
hline_vars_colors,
hline_vars_labels) {
hline_vars_labels,
module_args) {
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")

moduleServer(id, function(input, output, session) {
output$axis_selections <- renderUI({
env <- shiny::isolate(as.list(data()@env))
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)
templ_ui_params_vars(
session$ns,
# xparam and yparam are identical, so we only show the user one
xparam_choices = resolved_param$choices,
xparam_selected = resolved_param$selected,
xparam_label = "Select a Biomarker",
xchoices = resolved_x$choices,
xselected = resolved_x$selected,
ychoices = resolved_y$choices,
yselected = resolved_y$selected
)
})

# reused in all modules
anl_q_output <- constr_anl_q(
session, input, data, dataname,
Expand Down

0 comments on commit 773918e

Please sign in to comment.