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

198 Include user's card labels when generating the report #835

Merged
merged 18 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 14 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
3 changes: 2 additions & 1 deletion .lintr
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
linters: linters_with_defaults(
line_length_linter = line_length_linter(120),
cyclocomp_linter = NULL,
object_usage_linter = NULL
object_usage_linter = NULL,
indentation_linter = NULL
kartikeyakirar marked this conversation as resolved.
Show resolved Hide resolved
)
16 changes: 9 additions & 7 deletions R/tm_a_gee.R
Original file line number Diff line number Diff line change
Expand Up @@ -547,14 +547,16 @@ srv_gee <- function(id,
title = label
)

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Generalized Estimating Equations (GEE) Analysis Table")
card$append_text("Generalized Estimating Equations (GEE) Analysis Table", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Generalized Estimating Equations (GEE) Analysis Table",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
table_type <- switch(input$output_table,
"t_gee_cov" = "Residual Covariance Matrix Estimate",
"t_gee_coef" = "Model Coefficients",
Expand Down
26 changes: 11 additions & 15 deletions R/tm_a_mmrm.R
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,10 @@ template_mmrm_tables <- function(parentname,
layout_list <- add_expr(
layout_list,
substitute(
expr =
rtables::add_overall_col(total_label) %>%
rtables::split_rows_by(visit_var) %>%
tern.mmrm::summarize_lsmeans(arms = FALSE) %>%
rtables::append_topleft(paste0(" ", paramcd)),
expr = rtables::add_overall_col(total_label) %>%
rtables::split_rows_by(visit_var) %>%
tern.mmrm::summarize_lsmeans(arms = FALSE) %>%
rtables::append_topleft(paste0(" ", paramcd)),
env = list(
total_label = total_label,
visit_var = visit_var,
Expand Down Expand Up @@ -1432,20 +1431,17 @@ srv_mmrm <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("MMRM")
card$append_text("Mixed Model Repeated Measurements (MMRM) Analysis", "header2")
card$append_text(
paste(
card_fun <- function(comment, label) {
card <- card_template(
title = "Mixed Model Repeated Measurements (MMRM) Analysis",
label = label,
description = paste(
"Mixed Models procedure analyzes results from repeated measures designs",
"in which the outcome is continuous and measured at fixed time points"
),
"header3"
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
if (!is.null(table_r())) {
card$append_text("Table", "header3")
card$append_table(table_r())
Expand Down
15 changes: 8 additions & 7 deletions R/tm_g_barchart_simple.R
Original file line number Diff line number Diff line change
Expand Up @@ -538,13 +538,14 @@ srv_g_barchart_simple <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Barchart Plot")
card$append_text("Barchart Plot", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Barchart Plot",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Plot", "header3")
card$append_plot(plot_r(), dim = pws$dim())
if (!comment == "") {
Expand Down
16 changes: 8 additions & 8 deletions R/tm_g_ci.R
Original file line number Diff line number Diff line change
Expand Up @@ -483,14 +483,14 @@ srv_g_ci <- function(id, # nolint

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("CI Plot")
card$append_text("CI Plot", "header2")
card$append_text("Confidence Interval Plot", "header3")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "CI Plot",
label = label,
description = "Confidence Interval Plot",
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Plot", "header3")
card$append_plot(plot_r(), dim = pws$dim())
if (!comment == "") {
Expand Down
15 changes: 8 additions & 7 deletions R/tm_g_forest_rsp.R
Original file line number Diff line number Diff line change
Expand Up @@ -718,13 +718,14 @@ srv_g_forest_rsp <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Forest Response Plot")
card$append_text("Forest Response Plot", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Forest Response Plot",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Plot", "header3")
card$append_plot(plot_r(), dim = pws$dim())
if (!comment == "") {
Expand Down
15 changes: 8 additions & 7 deletions R/tm_g_forest_tte.R
Original file line number Diff line number Diff line change
Expand Up @@ -652,13 +652,14 @@ srv_g_forest_tte <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Forest Survival Plot")
card$append_text("Forest Survival Plot", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Forest Survival Plot",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Plot", "header3")
card$append_plot(plot_r(), dim = pws$dim())
if (!comment == "") {
Expand Down
15 changes: 8 additions & 7 deletions R/tm_g_ipp.R
Original file line number Diff line number Diff line change
Expand Up @@ -611,13 +611,14 @@ srv_g_ipp <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Individual Patient Plot")
card$append_text("Individual Patient Plot", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Individual Patient Plot",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Plot", "header3")
card$append_plot(plot_r(), dim = pws$dim())
if (!comment == "") {
Expand Down
16 changes: 8 additions & 8 deletions R/tm_g_km.R
Original file line number Diff line number Diff line change
Expand Up @@ -773,14 +773,14 @@ srv_g_km <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Kaplan Meier Plot")
card$append_text("Kaplan Meier Plot", "header2")
card$append_text("Non-parametric method used to estimate the survival function from lifetime data", "header3")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Kaplan Meier Plot",
label = label,
description = "Non-parametric method used to estimate the survival function from lifetime data",
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Plot", "header3")
card$append_plot(plot_r(), dim = pws$dim())
if (!comment == "") {
Expand Down
15 changes: 8 additions & 7 deletions R/tm_g_lineplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -648,13 +648,14 @@ srv_g_lineplot <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Line Plot")
card$append_text("Line Plot", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Line Plot",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Plot", "header3")
card$append_plot(plot_r(), dim = pws$dim())
if (!comment == "") {
Expand Down
15 changes: 8 additions & 7 deletions R/tm_g_pp_adverse_events.R
Original file line number Diff line number Diff line change
Expand Up @@ -575,13 +575,14 @@ srv_g_adverse_events <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Patient Profile Adverse Events")
card$append_text("Patient Profile Adverse Events", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Patient Profile Adverse Events Plot",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Table", "header3")
card$append_table(teal.code::dev_suppress(all_q()[["table"]]))
card$append_text("Plot", "header3")
Expand Down
21 changes: 12 additions & 9 deletions R/tm_g_pp_patient_timeline.R
Original file line number Diff line number Diff line change
Expand Up @@ -831,8 +831,10 @@ srv_g_patient_timeline <- function(id,
shiny::validate(
shiny::need(
!input$relday_x_axis ||
(sum(stats::complete.cases(p_time_data_pat[, c(aerelday_start_name, aerelday_end_name)])) > 0 ||
sum(stats::complete.cases(p_time_data_pat[, c(dsrelday_start_name, dsrelday_end_name)])) > 0),
(
sum(stats::complete.cases(p_time_data_pat[, c(aerelday_start_name, aerelday_end_name)])) > 0 ||
sum(stats::complete.cases(p_time_data_pat[, c(dsrelday_start_name, dsrelday_end_name)])) > 0
),
"Selected patient is not in dataset (either due to filtering or missing values). Consider relaxing filters."
)
)
Expand Down Expand Up @@ -894,13 +896,14 @@ srv_g_patient_timeline <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Patient Profile Timeline Plot")
card$append_text("Patient Profile Timeline Plot", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Patient Profile Timeline Plot",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Plot", "header3")
card$append_plot(plot_r(), dim = pws$dim())
if (!comment == "") {
Expand Down
15 changes: 8 additions & 7 deletions R/tm_g_pp_therapy.R
Original file line number Diff line number Diff line change
Expand Up @@ -696,13 +696,14 @@ srv_g_therapy <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Patient Profile Therapy")
card$append_text("Patient Profile Therapy", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Patient Profile Therapy",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Table", "header3")
card$append_table(teal.code::dev_suppress(all_q()[["therapy_table"]]))
card$append_text("Plot", "header3")
Expand Down
15 changes: 8 additions & 7 deletions R/tm_g_pp_vitals.R
Original file line number Diff line number Diff line change
Expand Up @@ -528,13 +528,14 @@ srv_g_vitals <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Patient Profile Vitals Plot")
card$append_text("Patient Profile Vitals Plot", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Patient Profile Vitals Plot",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Plot", "header3")
card$append_plot(plot_r(), dim = pws$dim())
if (!comment == "") {
Expand Down
15 changes: 8 additions & 7 deletions R/tm_t_abnormality.R
Original file line number Diff line number Diff line change
Expand Up @@ -647,13 +647,14 @@ srv_t_abnormality <- function(id,

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Abnormality Summary Table")
card$append_text("Abnormality Summary Table", "header2")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Abnormality Summary Table",
label = label,
description = NULL,
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Table", "header3")
card$append_table(table_r())
if (!comment == "") {
Expand Down
16 changes: 8 additions & 8 deletions R/tm_t_abnormality_by_worst_grade.R
Original file line number Diff line number Diff line change
Expand Up @@ -664,14 +664,14 @@ srv_t_abnormality_by_worst_grade <- function(id, # nolint

### REPORTER
if (with_reporter) {
card_fun <- function(comment) {
card <- teal::TealReportCard$new()
card$set_name("Laboratory Test Results Table")
card$append_text("Laboratory Test Results Table", "header2")
card$append_text("Laboratory test results with highest grade post-baseline Table", "header3")
if (with_filter) {
card$append_fs(filter_panel_api$get_filter_state())
}
card_fun <- function(comment, label) {
card <- card_template(
title = "Laboratory Test Results Table",
label = label,
description = "Laboratory test results with highest grade post-baseline Table",
with_filter = with_filter,
filter_panel_api = filter_panel_api
)
card$append_text("Table", "header3")
card$append_table(table_r())
if (!comment == "") {
Expand Down
Loading