Skip to content

Commit

Permalink
Merge pull request #237 from NEST/prf/234_change_minimal_records_requ…
Browse files Browse the repository at this point in the history
…ired

changed minimum records required in all modules
  • Loading branch information
Zhao, Junlue {MDBO~South San Francisco} authored and GitHub Enterprise committed Mar 16, 2021
2 parents e68e16c + 80129d9 commit 6030246
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 17 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
- Fixed displaying the number of messages, warnings and errors on the Debug Info button.
- Fixed treatment variable having values with with symbols (e.g. ':').
- Allow treatment variables with different arm levels.

### Miscellaneous
* Reduced minimum number of records required in dataset to either 1 or 2 in all modules.

# teal.goshawk 0.1.6

Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_gh_boxplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ srv_g_boxplot <- function(input,
# reused in all modules
anl_chunks <- constr_anl_chunks(
session, input, datasets, dataname,
param_id = "xaxis_param", param_var = param_var, trt_group = input$trt_group
param_id = "xaxis_param", param_var = param_var, trt_group = input$trt_group, min_rows = 2
)
# update sliders for axes taking constraints into account
yrange_slider <- callModule(toggle_slider_server, "yrange_scale")
Expand Down Expand Up @@ -445,7 +445,7 @@ srv_g_boxplot <- function(input,
boxplot_brush <- boxplot_data$brush()

ANL <- isolate(anl_chunks()$ANL) %>% droplevels() #nolint
validate_has_data(ANL, 5)
validate_has_data(ANL, 2)

xvar <- isolate(input$xaxis_var)
yvar <- isolate(input$yaxis_var)
Expand Down
6 changes: 3 additions & 3 deletions R/tm_g_gh_correlationplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ srv_g_correlationplot <- function(input,

dataset_var <- paste0(dataname, "_FILTERED")
ANL_FILTERED <- datasets$get_data(dataname, filtered = TRUE) # nolint
validate_has_data(ANL_FILTERED, 5)
validate_has_data(ANL_FILTERED, 1)


validate_has_variable(ANL_FILTERED, param_var)
Expand Down Expand Up @@ -373,7 +373,7 @@ srv_g_correlationplot <- function(input,
)

ANL <- chunks_safe_eval(private_chunks) # nolint
validate_has_data(ANL, 5)
validate_has_data(ANL, 1)

return(list(ANL = ANL, chunks = private_chunks))
})
Expand Down Expand Up @@ -450,7 +450,7 @@ srv_g_correlationplot <- function(input,
}
})

anl_constraint <- create_anl_constraint_reactive(anl_param, input, param_id = "xaxis_param")
anl_constraint <- create_anl_constraint_reactive(anl_param, input, param_id = "xaxis_param", min_rows = 1)

# update sliders for axes taking constraints into account
xrange_slider <- callModule(toggle_slider_server, "xrange_scale")
Expand Down
2 changes: 1 addition & 1 deletion R/tm_g_gh_density_distribution_plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ srv_g_density_distribution_plot <- function(input, # nolint
init_chunks()
anl_chunks <- constr_anl_chunks(
session, input, datasets, dataname,
param_id = "xaxis_param", param_var = param_var, trt_group = input$trt_group
param_id = "xaxis_param", param_var = param_var, trt_group = input$trt_group, min_rows = 2
)

# update sliders for axes taking constraints into account
Expand Down
3 changes: 2 additions & 1 deletion R/tm_g_gh_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ srv_lineplot <- function(input,
dataname = dataname,
param_id = "xaxis_param",
param_var = param_var,
trt_group = input$trt_group)
trt_group = input$trt_group,
min_rows = 2)
keep_data_const_opts_updated(session, input, anl_chunks, "xaxis_param")

yrange_slider <- callModule(toggle_slider_server, "yrange_scale")
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_gh_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ srv_g_scatterplot <- function(input,
# reused in all modules
anl_chunks <- constr_anl_chunks(
session, input, datasets, dataname,
param_id = "xaxis_param", param_var = param_var, trt_group = input$trt_group
param_id = "xaxis_param", param_var = param_var, trt_group = input$trt_group, min_rows = 1
)

# update sliders for axes taking constraints into account
Expand Down Expand Up @@ -366,7 +366,7 @@ srv_g_scatterplot <- function(input,
plot_brush <- plot_data$brush()

ANL <- isolate(anl_chunks()$ANL) # nolint
validate_has_data(ANL, 5)
validate_has_data(ANL, 1)

xvar <- isolate(input$xaxis_var)
yvar <- isolate(input$yaxis_var)
Expand Down
4 changes: 2 additions & 2 deletions R/tm_g_gh_spaghettiplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ srv_g_spaghettiplot <- function(input,
# reused in all modules
anl_chunks <- constr_anl_chunks(
session, input, datasets, dataname,
param_id = "xaxis_param", param_var = param_var, trt_group = input$trt_group
param_id = "xaxis_param", param_var = param_var, trt_group = input$trt_group, min_rows = 1
)

# update sliders for axes taking constraints into account
Expand Down Expand Up @@ -372,7 +372,7 @@ srv_g_spaghettiplot <- function(input,
plot_brush <- plot_data$brush()

ANL <- isolate(anl_chunks()$ANL) # nolint
validate_has_data(ANL, 5)
validate_has_data(ANL, 1)

xvar <- isolate(input$xaxis_var)
yvar <- isolate(input$yaxis_var)
Expand Down
12 changes: 6 additions & 6 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ keep_range_slider_updated <- function(session, input, update_slider_fcn, id_var,
# param_var: currently only "PARAMCD" is supported
#' @importFrom dplyr filter sym
#' @importFrom shinyjs hide show
constr_anl_chunks <- function(session, input, datasets, dataname, param_id, param_var, trt_group) {
constr_anl_chunks <- function(session, input, datasets, dataname, param_id, param_var, trt_group, min_rows) {
dataset_var <- paste0(dataname, "_FILTERED")
if (!identical(param_var, "PARAMCD")) {
# why is there a variable param_id which is provided to this function and always equal to "param"?
Expand All @@ -155,7 +155,7 @@ constr_anl_chunks <- function(session, input, datasets, dataname, param_id, para
stopifnot(is_character_single(param_var_value))

ANL_FILTERED <- datasets$get_data(dataname, filtered = TRUE) # nolint
validate_has_data(ANL_FILTERED, 5)
validate_has_data(ANL_FILTERED, min_rows)

validate_has_variable(ANL_FILTERED, param_var)
validate_has_variable(ANL_FILTERED, "AVISITCD")
Expand All @@ -178,7 +178,7 @@ constr_anl_chunks <- function(session, input, datasets, dataname, param_id, para
)

ANL <- chunks_safe_eval(private_chunks) # nolint
validate_has_data(ANL, 5)
validate_has_data(ANL, min_rows)

return(list(ANL = ANL, chunks = private_chunks))
})
Expand Down Expand Up @@ -256,7 +256,7 @@ constr_anl_chunks <- function(session, input, datasets, dataname, param_id, para
}
})

anl_constraint <- create_anl_constraint_reactive(anl_param, input, param_id = param_id)
anl_constraint <- create_anl_constraint_reactive(anl_param, input, param_id = param_id, min_rows = min_rows)

return(anl_constraint)
}
Expand All @@ -266,7 +266,7 @@ constr_anl_chunks <- function(session, input, datasets, dataname, param_id, para
# `param_id.constraint_var` in the specified range
# constraint var means that `param_id.constraint_var` is constrained to the filtered range (or NA),
# e.g. `ALT.BASE2` (i.e. `PARAMCD = ALT & range_filter_on(BASE2)`)
create_anl_constraint_reactive <- function(anl_param, input, param_id) {
create_anl_constraint_reactive <- function(anl_param, input, param_id, min_rows) {
reactive({
private_chunks <- anl_param()$chunks$clone(deep = TRUE)

Expand Down Expand Up @@ -312,7 +312,7 @@ create_anl_constraint_reactive <- function(anl_param, input, param_id) {
)

ANL <- chunks_safe_eval(private_chunks) # nolint
validate_has_data(ANL, 5)
validate_has_data(ANL, min_rows)
}

chunks_push_new_line(private_chunks)
Expand Down

0 comments on commit 6030246

Please sign in to comment.