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

edit card names #493

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions R/tm_a_pca.R
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ tm_a_pca <- function(label = "Principal Component Analysis",
server_args = c(
data_extract_list,
list(
label = label,
plot_height = plot_height,
plot_width = plot_width,
ggplot2_args = ggplot2_args
Expand Down Expand Up @@ -251,7 +252,7 @@ ui_a_pca <- function(id, ...) {
)
}

srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, plot_width, ggplot2_args) {
srv_a_pca <- function(id, label, data, reporter, filter_panel_api, dat, plot_height, plot_width, ggplot2_args) {
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
checkmate::assert_class(data, "tdata")
Expand Down Expand Up @@ -953,9 +954,10 @@ srv_a_pca <- function(id, data, reporter, filter_panel_api, dat, plot_height, pl

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
Comment on lines +957 to +958
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
card_name <- label
card_fun <- function(comment, label = card_name) {
card_fun <- function(comment, label = label) {

why not simply ?

Comment on lines +957 to +958
Copy link
Contributor

@Polkas Polkas Nov 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
card_name <- label
card_fun <- function(comment, label = card_name) {
label <- lable
card_fun <- function(comment) {

card <- teal.reporter::TealReportCard$new()
card$set_name("PCA Plot")
card$set_name(label)
card$append_text("PCA Plot", "header2")
card$append_text("Principal Component Analysis Plot", "header3")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
Expand Down
7 changes: 5 additions & 2 deletions R/tm_a_regression.R
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ tm_a_regression <- function(label = "Regression Analysis",
server_args = c(
data_extract_list,
list(
label = label,
plot_height = plot_height,
plot_width = plot_width,
default_outlier_label = default_outlier_label,
Expand Down Expand Up @@ -228,6 +229,7 @@ ui_a_regression <- function(id, ...) {


srv_a_regression <- function(id,
label,
data,
reporter,
filter_panel_api,
Expand Down Expand Up @@ -861,9 +863,10 @@ srv_a_regression <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
card <- teal.reporter::TealReportCard$new()
card$set_name("Linear Regression Plot")
card$set_name(label)
card$append_text("Linear Regression Plot", "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
card$append_text("Plot", "header3")
Expand Down
6 changes: 4 additions & 2 deletions R/tm_g_association.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ tm_g_association <- function(label = "Association",
ui_args = args,
server_args = c(
data_extract_list,
list(plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
list(label = label, plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
),
filters = teal.transform::get_extract_datanames(data_extract_list)
)
Expand Down Expand Up @@ -210,6 +210,7 @@ ui_tm_g_association <- function(id, ...) {
}

srv_tm_g_association <- function(id,
label,
data,
reporter,
filter_panel_api,
Expand Down Expand Up @@ -445,9 +446,10 @@ srv_tm_g_association <- function(id,

### REPORTER
if (with_reporter) {
card_name <- label
card_fun <- function(comment) {
card <- teal.reporter::TealReportCard$new()
card$set_name("Association Plot")
card$set_name(label)
card$append_text("Association Plot", "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
card$append_text("Plot", "header3")
Expand Down
10 changes: 6 additions & 4 deletions R/tm_g_bivariate.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
#' if (interactive()) {
#' shinyApp(app$ui, app$server)
#' }
tm_g_bivariate <- function(label = "Bivariate Plots",
tm_g_bivariate <- function(label = "Bivariate Plot",
x,
y,
row_facet = NULL,
Expand Down Expand Up @@ -192,7 +192,7 @@ tm_g_bivariate <- function(label = "Bivariate Plots",
ui_args = args,
server_args = c(
data_extract_list,
list(plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
list(label = label, plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
),
filters = teal.transform::get_extract_datanames(data_extract_list)
)
Expand Down Expand Up @@ -340,6 +340,7 @@ ui_g_bivariate <- function(id, ...) {


srv_g_bivariate <- function(id,
label,
data,
reporter,
filter_panel_api,
Expand Down Expand Up @@ -555,9 +556,10 @@ srv_g_bivariate <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
card <- teal.reporter::TealReportCard$new()
card$set_name("Bivariate Plot")
card$set_name(label)
card$append_text("Bivariate Plot", "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
card$append_text("Plot", "header3")
Expand Down
9 changes: 6 additions & 3 deletions R/tm_g_distribution.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ tm_g_distribution <- function(label = "Distribution Module",
server = srv_distribution,
server_args = c(
data_extract_list,
list(plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
list(label = label, plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
),
ui = ui_distribution,
ui_args = args,
Expand Down Expand Up @@ -327,6 +327,7 @@ ui_distribution <- function(id, ...) {
}

srv_distribution <- function(id,
label,
data,
reporter,
filter_panel_api,
Expand Down Expand Up @@ -1141,10 +1142,12 @@ srv_distribution <- function(id,
)

### REPORTER

if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
card <- teal.reporter::TealReportCard$new()
card$set_name("Distribution Plot")
card$set_name(label)
card$append_text("Distribution Plot", "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
card$append_text("Plot", "header3")
Expand Down
10 changes: 6 additions & 4 deletions R/tm_g_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#' ),
#' modules = modules(
#' tm_g_response(
#' label = "Response Plots",
#' label = "Response Plot",
#' response = data_extract_spec(
#' dataname = "ADSL",
#' select = select_spec(
Expand Down Expand Up @@ -136,7 +136,7 @@ tm_g_response <- function(label = "Response Plot",
ui_args = args,
server_args = c(
data_extract_list,
list(plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
list(label = label, plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
),
filters = teal.transform::get_extract_datanames(data_extract_list)
)
Expand Down Expand Up @@ -218,6 +218,7 @@ ui_g_response <- function(id, ...) {
}

srv_g_response <- function(id,
label,
data,
reporter,
filter_panel_api,
Expand Down Expand Up @@ -447,9 +448,10 @@ srv_g_response <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
card <- teal.reporter::TealReportCard$new()
card$set_name("Response Plot")
card$set_name(label)
card$append_text("Response Plot", "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
card$append_text("Plot", "header3")
Expand Down
13 changes: 9 additions & 4 deletions R/tm_g_scatterplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#' ),
#' modules = modules(
#' tm_g_scatterplot(
#' label = "Scatterplot Choices",
#' label = "Scatterplot",
#' x = data_extract_spec(
#' dataname = "ADSL",
#' select = select_spec(
Expand Down Expand Up @@ -213,7 +213,10 @@ tm_g_scatterplot <- function(label = "Scatterplot",
ui_args = args,
server_args = c(
data_extract_list,
list(plot_height = plot_height, plot_width = plot_width, table_dec = table_dec, ggplot2_args = ggplot2_args)
list(
label = label, plot_height = plot_height, plot_width = plot_width,
table_dec = table_dec, ggplot2_args = ggplot2_args
)
),
filters = teal.transform::get_extract_datanames(data_extract_list)
)
Expand Down Expand Up @@ -371,6 +374,7 @@ ui_g_scatterplot <- function(id, ...) {
}

srv_g_scatterplot <- function(id,
label,
data,
reporter,
filter_panel_api,
Expand Down Expand Up @@ -890,9 +894,10 @@ srv_g_scatterplot <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
card <- teal.reporter::TealReportCard$new()
card$set_name("Scatter Plot")
card$set_name(label)
card$append_text("Scatter Plot", "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
card$append_text("Plot", "header3")
Expand Down
9 changes: 5 additions & 4 deletions R/tm_g_scatterplotmatrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ tm_g_scatterplotmatrix <- function(label = "Scatterplot Matrix",
server = srv_g_scatterplotmatrix,
ui = ui_g_scatterplotmatrix,
ui_args = args,
server_args = list(variables = variables, plot_height = plot_height, plot_width = plot_width),
server_args = list(label = label, variables = variables, plot_height = plot_height, plot_width = plot_width),
filters = teal.transform::get_extract_datanames(variables)
)
}
Expand Down Expand Up @@ -159,7 +159,7 @@ ui_g_scatterplotmatrix <- function(id, ...) {
)
}

srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variables, plot_height, plot_width) {
srv_g_scatterplotmatrix <- function(id, label, data, reporter, filter_panel_api, variables, plot_height, 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")
Expand Down Expand Up @@ -344,9 +344,10 @@ srv_g_scatterplotmatrix <- function(id, data, reporter, filter_panel_api, variab

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
card <- teal.reporter::TealReportCard$new()
card$set_name("Scatter Plot Matrix")
card$set_name(label)
card$append_text("Scatter Plot Matrix", "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
card$append_text("Plot", "header3")
Expand Down
14 changes: 8 additions & 6 deletions R/tm_missing_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ tm_missing_data <- function(label = "Missing data",
checkmate::assert_subset(names(ggplot2_args), c("default", plot_choices))

module(
label,
label = label,
server = srv_page_missing_data,
server_args = list(
parent_dataname = parent_dataname, plot_height = plot_height,
label = label, parent_dataname = parent_dataname, plot_height = plot_height,
plot_width = plot_width, ggplot2_args = ggplot2_args
),
ui = ui_page_missing_data,
Expand Down Expand Up @@ -157,14 +157,15 @@ ui_page_missing_data <- function(id, data, parent_dataname, pre_output = NULL, p
)
}

srv_page_missing_data <- function(id, data, reporter, filter_panel_api, parent_dataname,
srv_page_missing_data <- function(id, label, data, reporter, filter_panel_api, parent_dataname,
plot_height, plot_width, ggplot2_args) {
moduleServer(id, function(input, output, session) {
lapply(
names(data),
function(x) {
srv_missing_data(
id = x,
label = label,
data = data,
reporter = reporter,
filter_panel_api = filter_panel_api,
Expand Down Expand Up @@ -341,7 +342,7 @@ encoding_missing_data <- function(id, summary_per_patient = FALSE, ggtheme, data
)
}

srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, parent_dataname,
srv_missing_data <- function(id, label, data, reporter, filter_panel_api, dataname, parent_dataname,
plot_height, plot_width, ggplot2_args) {
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
Expand Down Expand Up @@ -1172,12 +1173,13 @@ srv_missing_data <- function(id, data, reporter, filter_panel_api, dataname, par

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
card <- teal.reporter::TealReportCard$new()
sum_type <- input$summary_type
title <- if (sum_type == "By Variable Levels") paste0(sum_type, " Table") else paste0(sum_type, " Plot")
title_dataname <- paste(title, dataname, sep = " - ")
card$set_name(paste("Missing Data", sum_type, dataname, sep = " - "))
card$set_name(paste(label, sum_type, dataname, sep = " - "))
card$append_text(title_dataname, "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
if (sum_type == "Summary") {
Expand Down
9 changes: 5 additions & 4 deletions R/tm_outliers.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ tm_outliers <- function(label = "Outliers Module",
server = srv_outliers,
server_args = c(
data_extract_list,
list(plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
list(label = label, plot_height = plot_height, plot_width = plot_width, ggplot2_args = ggplot2_args)
),
ui = ui_outliers,
ui_args = args,
Expand Down Expand Up @@ -234,7 +234,7 @@ ui_outliers <- function(id, ...) {
)
}

srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,
srv_outliers <- function(id, label, data, reporter, filter_panel_api, outlier_var,
categorical_var, plot_height, plot_width, ggplot2_args) {
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
Expand Down Expand Up @@ -1096,10 +1096,11 @@ srv_outliers <- function(id, data, reporter, filter_panel_api, outlier_var,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
card <- teal.reporter::TealReportCard$new()
tab_type <- input$tabs
card$set_name(paste0("Outliers - ", tab_type))
card$set_name(paste0(label, " - ", tab_type))
card$append_text(tab_type, "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())

Expand Down
7 changes: 4 additions & 3 deletions R/tm_t_crosstable.R
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ ui_t_crosstable <- function(id, x, y, show_percentage, show_total, pre_output, p
)
}

srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y, basic_table_args) {
srv_t_crosstable <- function(id, label, data, reporter, filter_panel_api, x, y, basic_table_args) {
with_reporter <- !missing(reporter) && inherits(reporter, "Reporter")
with_filter <- !missing(filter_panel_api) && inherits(filter_panel_api, "FilterPanelAPI")
checkmate::assert_class(data, "tdata")
Expand Down Expand Up @@ -333,9 +333,10 @@ srv_t_crosstable <- function(id, data, reporter, filter_panel_api, label, x, y,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card_name <- label
card_fun <- function(comment, label = card_name) {
card <- teal.reporter::TealReportCard$new()
card$set_name("Cross Table")
card$set_name(label)
card$append_text("Cross Table", "header2")
if (with_filter) card$append_fs(filter_panel_api$get_filter_state())
card$append_text("Table", "header3")
Expand Down
Loading