From 5833c6c7f52aecac8da09b16da31e73fe5dffe07 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 26 Sep 2023 14:58:53 +0200 Subject: [PATCH 01/17] allow to pass reporter's "Add Card"'s label to the content of the ReportCard in srv_g_ci --- R/tm_g_ci.R | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/R/tm_g_ci.R b/R/tm_g_ci.R index 3fc44aaaf3..a07713157a 100644 --- a/R/tm_g_ci.R +++ b/R/tm_g_ci.R @@ -483,10 +483,11 @@ srv_g_ci <- function(id, # nolint ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("CI Plot") - card$append_text("CI Plot", "header2") + title <- ifelse(label == "", "CI Plot", label) + card$set_name(title) + card$append_text(title, "header2") card$append_text("Confidence Interval Plot", "header3") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) From ab9531346760cd893eb6a98eea722a34607a1d2d Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 26 Sep 2023 15:15:48 +0200 Subject: [PATCH 02/17] allow to pass a label to reporter cards content --- R/tm_a_gee.R | 8 +++++--- R/tm_a_mmrm.R | 8 +++++--- R/tm_g_barchart_simple.R | 8 +++++--- R/tm_g_ci.R | 3 ++- R/tm_g_forest_rsp.R | 8 +++++--- R/tm_g_forest_tte.R | 8 +++++--- R/tm_g_ipp.R | 8 +++++--- R/tm_g_km.R | 8 +++++--- R/tm_g_lineplot.R | 8 +++++--- R/tm_g_pp_adverse_events.R | 8 +++++--- 10 files changed, 47 insertions(+), 28 deletions(-) diff --git a/R/tm_a_gee.R b/R/tm_a_gee.R index 8d1784418c..bf06745ee4 100644 --- a/R/tm_a_gee.R +++ b/R/tm_a_gee.R @@ -548,10 +548,12 @@ srv_gee <- function(id, ) if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Generalized Estimating Equations (GEE) Analysis Table") - card$append_text("Generalized Estimating Equations (GEE) Analysis Table", "header2") + title <- "Generalized Estimating Equations (GEE) Analysis Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_a_mmrm.R b/R/tm_a_mmrm.R index a174338f0e..0056a9eb9e 100644 --- a/R/tm_a_mmrm.R +++ b/R/tm_a_mmrm.R @@ -1432,10 +1432,12 @@ srv_mmrm <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("MMRM") - card$append_text("Mixed Model Repeated Measurements (MMRM) Analysis", "header2") + title <- "Mixed Model Repeated Measurements (MMRM) Analysis" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") card$append_text( paste( "Mixed Models procedure analyzes results from repeated measures designs", diff --git a/R/tm_g_barchart_simple.R b/R/tm_g_barchart_simple.R index f3279ebd8d..2aff61a1cd 100644 --- a/R/tm_g_barchart_simple.R +++ b/R/tm_g_barchart_simple.R @@ -538,10 +538,12 @@ srv_g_barchart_simple <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Barchart Plot") - card$append_text("Barchart Plot", "header2") + title <- "Barchart Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_g_ci.R b/R/tm_g_ci.R index a07713157a..7a6bfdec81 100644 --- a/R/tm_g_ci.R +++ b/R/tm_g_ci.R @@ -485,7 +485,8 @@ srv_g_ci <- function(id, # nolint if (with_reporter) { card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - title <- ifelse(label == "", "CI Plot", label) + title <- "CI Plot" + title <- ifelse(label == "", title, label) card$set_name(title) card$append_text(title, "header2") card$append_text("Confidence Interval Plot", "header3") diff --git a/R/tm_g_forest_rsp.R b/R/tm_g_forest_rsp.R index 4f5b9b5747..94d36b0049 100644 --- a/R/tm_g_forest_rsp.R +++ b/R/tm_g_forest_rsp.R @@ -718,10 +718,12 @@ srv_g_forest_rsp <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Forest Response Plot") - card$append_text("Forest Response Plot", "header2") + title <- "Forest Response Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_g_forest_tte.R b/R/tm_g_forest_tte.R index 89b366a91d..0d2277639d 100644 --- a/R/tm_g_forest_tte.R +++ b/R/tm_g_forest_tte.R @@ -652,10 +652,12 @@ srv_g_forest_tte <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Forest Survival Plot") - card$append_text("Forest Survival Plot", "header2") + title <- "Forest Survival Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_g_ipp.R b/R/tm_g_ipp.R index 4a9918c829..11e9f07ff4 100644 --- a/R/tm_g_ipp.R +++ b/R/tm_g_ipp.R @@ -611,10 +611,12 @@ srv_g_ipp <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Individual Patient Plot") - card$append_text("Individual Patient Plot", "header2") + title <- "Individual Patient Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_g_km.R b/R/tm_g_km.R index fd544eacf2..c6e6d07fae 100644 --- a/R/tm_g_km.R +++ b/R/tm_g_km.R @@ -773,10 +773,12 @@ srv_g_km <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Kaplan Meier Plot") - card$append_text("Kaplan Meier Plot", "header2") + title <- "Kaplan Meier Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "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()) diff --git a/R/tm_g_lineplot.R b/R/tm_g_lineplot.R index 4d7bbbebc9..a8383bc932 100644 --- a/R/tm_g_lineplot.R +++ b/R/tm_g_lineplot.R @@ -648,10 +648,12 @@ srv_g_lineplot <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Line Plot") - card$append_text("Line Plot", "header2") + title <- "Line Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_g_pp_adverse_events.R b/R/tm_g_pp_adverse_events.R index 59d3cd1b43..8f717262f3 100644 --- a/R/tm_g_pp_adverse_events.R +++ b/R/tm_g_pp_adverse_events.R @@ -558,10 +558,12 @@ srv_g_adverse_events <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Patient Profile Adverse Events Plot") - card$append_text("Patient Profile Adverse Events Plot", "header2") + title <- "Patient Profile Adverse Events Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } From 500b8f1980003cac028a8c1682c91d69c017e06f Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 27 Sep 2023 12:59:29 +0200 Subject: [PATCH 03/17] allow to specify label in modules content by the end user --- R/tm_g_pp_patient_timeline.R | 8 +++++--- R/tm_g_pp_therapy.R | 8 +++++--- R/tm_g_pp_vitals.R | 8 +++++--- R/tm_t_abnormality.R | 8 +++++--- R/tm_t_abnormality_by_worst_grade.R | 8 +++++--- R/tm_t_ancova.R | 8 +++++--- R/tm_t_binary_outcome.R | 8 +++++--- R/tm_t_events.R | 8 +++++--- R/tm_t_events_by_grade.R | 8 +++++--- R/tm_t_events_patyear.R | 8 +++++--- R/tm_t_events_summary.R | 8 +++++--- R/tm_t_exposure.R | 8 +++++--- R/tm_t_logistic.R | 8 +++++--- R/tm_t_mult_events.R | 8 +++++--- R/tm_t_pp_basic_info.R | 8 +++++--- R/tm_t_pp_laboratory.R | 8 +++++--- R/tm_t_pp_medical_history.R | 8 +++++--- R/tm_t_pp_prior_medication.R | 8 +++++--- R/tm_t_shift_by_arm.R | 8 +++++--- R/tm_t_shift_by_arm_by_worst.R | 8 +++++--- R/tm_t_shift_by_grade.R | 8 +++++--- R/tm_t_smq.R | 8 +++++--- R/tm_t_summary.R | 8 +++++--- R/tm_t_summary_by.R | 8 +++++--- R/tm_t_tte.R | 8 +++++--- 25 files changed, 125 insertions(+), 75 deletions(-) diff --git a/R/tm_g_pp_patient_timeline.R b/R/tm_g_pp_patient_timeline.R index 19c558204a..93f16a862a 100644 --- a/R/tm_g_pp_patient_timeline.R +++ b/R/tm_g_pp_patient_timeline.R @@ -894,10 +894,12 @@ srv_g_patient_timeline <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Patient Profile Timeline Plot") - card$append_text("Patient Profile Timeline Plot", "header2") + title <- "Patient Profile Timeline Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_g_pp_therapy.R b/R/tm_g_pp_therapy.R index c5356c8be4..856ef49803 100644 --- a/R/tm_g_pp_therapy.R +++ b/R/tm_g_pp_therapy.R @@ -682,10 +682,12 @@ srv_g_therapy <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Patient Profile Therapy Plot") - card$append_text("Patient Profile Therapy Plot", "header2") + title <- "Patient Profile Therapy Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_g_pp_vitals.R b/R/tm_g_pp_vitals.R index 1b91b4b3b8..f5b029568d 100644 --- a/R/tm_g_pp_vitals.R +++ b/R/tm_g_pp_vitals.R @@ -528,10 +528,12 @@ srv_g_vitals <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Patient Profile Vitals Plot") - card$append_text("Patient Profile Vitals Plot", "header2") + title <- "Patient Profile Vitals Plot" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_abnormality.R b/R/tm_t_abnormality.R index 8f789993fa..b37435214c 100644 --- a/R/tm_t_abnormality.R +++ b/R/tm_t_abnormality.R @@ -647,10 +647,12 @@ srv_t_abnormality <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Abnormality Summary Table") - card$append_text("Abnormality Summary Table", "header2") + title <- "Abnormality Summary Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_abnormality_by_worst_grade.R b/R/tm_t_abnormality_by_worst_grade.R index 65cffd439e..e2b4ff0b9b 100644 --- a/R/tm_t_abnormality_by_worst_grade.R +++ b/R/tm_t_abnormality_by_worst_grade.R @@ -664,10 +664,12 @@ srv_t_abnormality_by_worst_grade <- function(id, # nolint ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Laboratory Test Results Table") - card$append_text("Laboratory Test Results Table", "header2") + title <- "Laboratory Test Results Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "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()) diff --git a/R/tm_t_ancova.R b/R/tm_t_ancova.R index 11ef31b14d..b1b0257e9b 100644 --- a/R/tm_t_ancova.R +++ b/R/tm_t_ancova.R @@ -945,10 +945,12 @@ srv_ancova <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("ANCOVA") - card$append_text("ANCOVA", "header2") + title <- "ANCOVA" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") card$append_text("Analysis of Covariance", "header3") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) diff --git a/R/tm_t_binary_outcome.R b/R/tm_t_binary_outcome.R index 6de0b8ab18..b0bba79e06 100644 --- a/R/tm_t_binary_outcome.R +++ b/R/tm_t_binary_outcome.R @@ -1008,10 +1008,12 @@ srv_t_binary_outcome <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Binary Outcome Table") - card$append_text("Binary Outcome Table", "header2") + title <- "Binary Outcome Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_events.R b/R/tm_t_events.R index e89ace16a8..c67416235a 100644 --- a/R/tm_t_events.R +++ b/R/tm_t_events.R @@ -793,10 +793,12 @@ srv_t_events_byterm <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Events by Term Table") - card$append_text("Events by Term Table", "header2") + title <- "Events by Term Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_events_by_grade.R b/R/tm_t_events_by_grade.R index 7bf74176fb..12db75862d 100644 --- a/R/tm_t_events_by_grade.R +++ b/R/tm_t_events_by_grade.R @@ -1193,10 +1193,12 @@ srv_t_events_by_grade <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Events by Grade Table") - card$append_text("Events by Grade Table", "header2") + title <- "Events by Grade Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_events_patyear.R b/R/tm_t_events_patyear.R index 1dfa6b9809..9c632225c5 100644 --- a/R/tm_t_events_patyear.R +++ b/R/tm_t_events_patyear.R @@ -555,10 +555,12 @@ srv_events_patyear <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Event Rates Adjusted For Patient-Years Table") - card$append_text("Event Rates Adjusted For Patient-Years Table", "header2") + title <- "Event Rates Adjusted For Patient-Years Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_events_summary.R b/R/tm_t_events_summary.R index 901652efc1..cb88ad733e 100644 --- a/R/tm_t_events_summary.R +++ b/R/tm_t_events_summary.R @@ -965,10 +965,12 @@ srv_t_events_summary <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Adverse Events Summary Table") - card$append_text("Adverse Events Summary Table", "header2") + title <- "Adverse Events Summary Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_exposure.R b/R/tm_t_exposure.R index 60e118e255..d0b64a3873 100644 --- a/R/tm_t_exposure.R +++ b/R/tm_t_exposure.R @@ -645,10 +645,12 @@ srv_t_exposure <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Exposure for Risk Management Plan Table") - card$append_text("Exposure for Risk Management Plan Table", "header2") + title <- "Exposure for Risk Management Plan Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_logistic.R b/R/tm_t_logistic.R index 89cf28802a..a4190aa91e 100644 --- a/R/tm_t_logistic.R +++ b/R/tm_t_logistic.R @@ -713,10 +713,12 @@ srv_t_logistic <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Logistic Regression Table") - card$append_text("Logistic Regression Table", "header2") + title <- "Logistic Regression Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_mult_events.R b/R/tm_t_mult_events.R index 24adfd1869..234f0d37b2 100644 --- a/R/tm_t_mult_events.R +++ b/R/tm_t_mult_events.R @@ -591,10 +591,12 @@ srv_t_mult_events_byterm <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Multiple Events by Term Table") - card$append_text("Multiple Events by Term Table", "header2") + title <- "Multiple Events by Term Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_pp_basic_info.R b/R/tm_t_pp_basic_info.R index f535393aea..11282e75a4 100644 --- a/R/tm_t_pp_basic_info.R +++ b/R/tm_t_pp_basic_info.R @@ -262,10 +262,12 @@ srv_t_basic_info <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Patient Profile Basic Info Table") - card$append_text("Patient Profile Basic Info Table", "header2") + title <- "Patient Profile Basic Info Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_pp_laboratory.R b/R/tm_t_pp_laboratory.R index 84b961e776..45be9a5442 100644 --- a/R/tm_t_pp_laboratory.R +++ b/R/tm_t_pp_laboratory.R @@ -435,10 +435,12 @@ srv_g_laboratory <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Patient Profile Laboratory Table") - card$append_text("Patient Profile Laboratory Table", "header2") + title <- "Patient Profile Laboratory Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_pp_medical_history.R b/R/tm_t_pp_medical_history.R index f77bd6f17e..7d8cd121ba 100644 --- a/R/tm_t_pp_medical_history.R +++ b/R/tm_t_pp_medical_history.R @@ -336,10 +336,12 @@ srv_t_medical_history <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Patient Medical History Table") - card$append_text("Patient Medical History Table", "header2") + title <- "Patient Medical History Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_pp_prior_medication.R b/R/tm_t_pp_prior_medication.R index 4d3c2ab862..253d1ef8f2 100644 --- a/R/tm_t_pp_prior_medication.R +++ b/R/tm_t_pp_prior_medication.R @@ -344,10 +344,12 @@ srv_t_prior_medication <- function(id, ) if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Patient Prior Medication Table") - card$append_text("Patient Prior Medication Table", "header2") + title <- "Patient Prior Medication Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_shift_by_arm.R b/R/tm_t_shift_by_arm.R index 810fc93c5d..124ec69ec2 100644 --- a/R/tm_t_shift_by_arm.R +++ b/R/tm_t_shift_by_arm.R @@ -528,10 +528,12 @@ srv_shift_by_arm <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Shift by Arm Table") - card$append_text("Shift by Arm Table", "header2") + title <- "Shift by Arm Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_shift_by_arm_by_worst.R b/R/tm_t_shift_by_arm_by_worst.R index de3ed6f797..2766ed9b4c 100644 --- a/R/tm_t_shift_by_arm_by_worst.R +++ b/R/tm_t_shift_by_arm_by_worst.R @@ -566,10 +566,12 @@ srv_shift_by_arm_by_worst <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Shift by Arm by Worst Table") - card$append_text("Shift by Arm by Worst Table", "header2") + title <- "Shift by Arm by Worst Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_shift_by_grade.R b/R/tm_t_shift_by_grade.R index d5b2a0fab2..9e62180b64 100644 --- a/R/tm_t_shift_by_grade.R +++ b/R/tm_t_shift_by_grade.R @@ -886,10 +886,12 @@ srv_t_shift_by_grade <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Grade Summary Table") - card$append_text("Grade Summary Table", "header2") + title <- "Grade Summary Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_smq.R b/R/tm_t_smq.R index c8c90533bc..e221467644 100644 --- a/R/tm_t_smq.R +++ b/R/tm_t_smq.R @@ -658,10 +658,12 @@ srv_t_smq <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("SMQ Table") - card$append_text("Adverse Events Table by Standardized `MedDRA` Query (SMQ)", "header2") + title <- "Adverse Events Table by Standardized `MedDRA` Query (SMQ)" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_summary.R b/R/tm_t_summary.R index 191a9a57aa..af27ae3528 100644 --- a/R/tm_t_summary.R +++ b/R/tm_t_summary.R @@ -576,10 +576,12 @@ srv_summary <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Summary Table") - card$append_text("Summary Table", "header2") + title <- "Summary Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_summary_by.R b/R/tm_t_summary_by.R index c4dbbeaba7..d19246519b 100644 --- a/R/tm_t_summary_by.R +++ b/R/tm_t_summary_by.R @@ -733,10 +733,12 @@ srv_summary_by <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Summarize Variables by Row Groups Table") - card$append_text("Summarize Variables by Row Groups Table", "header2") + title <- "Summarize Variables by Row Groups Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } diff --git a/R/tm_t_tte.R b/R/tm_t_tte.R index be82cec62b..3926983458 100644 --- a/R/tm_t_tte.R +++ b/R/tm_t_tte.R @@ -926,10 +926,12 @@ srv_t_tte <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { + card_fun <- function(comment, label) { card <- teal::TealReportCard$new() - card$set_name("Time To Event Table") - card$append_text("Time To Event Table", "header2") + title <- "Time To Event Table" + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") if (with_filter) { card$append_fs(filter_panel_api$get_filter_state()) } From 75e908646c3b4377f17a3a792df3539f9c2d0b13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Sep 2023 17:55:40 +0200 Subject: [PATCH 04/17] feat: use card template to remove repeated code --- R/tm_a_gee.R | 15 +++++++-------- R/tm_a_mmrm.R | 16 +++++----------- R/tm_g_barchart_simple.R | 14 ++++++-------- R/tm_g_ci.R | 15 ++++++--------- R/tm_g_forest_rsp.R | 14 ++++++-------- R/tm_g_forest_tte.R | 14 ++++++-------- R/tm_g_ipp.R | 14 ++++++-------- R/tm_g_km.R | 15 ++++++--------- R/tm_g_lineplot.R | 14 ++++++-------- R/tm_g_pp_adverse_events.R | 14 ++++++-------- R/tm_g_pp_patient_timeline.R | 14 ++++++-------- R/tm_g_pp_therapy.R | 14 ++++++-------- R/tm_g_pp_vitals.R | 14 ++++++-------- R/tm_t_abnormality.R | 14 ++++++-------- R/tm_t_abnormality_by_worst_grade.R | 15 ++++++--------- R/tm_t_ancova.R | 15 ++++++--------- R/tm_t_binary_outcome.R | 14 ++++++-------- R/tm_t_coxreg.R | 14 +++++++------- R/tm_t_events.R | 14 ++++++-------- R/tm_t_events_by_grade.R | 14 ++++++-------- R/tm_t_events_patyear.R | 14 ++++++-------- R/tm_t_events_summary.R | 14 ++++++-------- R/tm_t_exposure.R | 14 ++++++-------- R/tm_t_logistic.R | 14 ++++++-------- R/tm_t_mult_events.R | 14 ++++++-------- R/tm_t_pp_basic_info.R | 14 ++++++-------- R/tm_t_pp_laboratory.R | 14 ++++++-------- R/tm_t_pp_medical_history.R | 14 ++++++-------- R/tm_t_pp_prior_medication.R | 14 ++++++-------- R/tm_t_shift_by_arm_by_worst.R | 14 ++++++-------- R/tm_t_shift_by_grade.R | 14 ++++++-------- R/tm_t_smq.R | 14 ++++++-------- R/tm_t_summary.R | 14 ++++++-------- R/tm_t_summary_by.R | 14 ++++++-------- R/tm_t_tte.R | 14 ++++++-------- R/utils.R | 21 +++++++++++++++++++++ 36 files changed, 232 insertions(+), 286 deletions(-) diff --git a/R/tm_a_gee.R b/R/tm_a_gee.R index bf06745ee4..7f1bd2aca1 100644 --- a/R/tm_a_gee.R +++ b/R/tm_a_gee.R @@ -547,16 +547,15 @@ srv_gee <- function(id, title = label ) + ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Generalized Estimating Equations (GEE) Analysis Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Generalized Estimating Equations (GEE) Analysis Table", + label = label, + description = NULL, + with_filter = with_filter + ) table_type <- switch(input$output_table, "t_gee_cov" = "Residual Covariance Matrix Estimate", "t_gee_coef" = "Model Coefficients", diff --git a/R/tm_a_mmrm.R b/R/tm_a_mmrm.R index 0056a9eb9e..49aae7bb3d 100644 --- a/R/tm_a_mmrm.R +++ b/R/tm_a_mmrm.R @@ -1433,21 +1433,15 @@ srv_mmrm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Mixed Model Repeated Measurements (MMRM) Analysis" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - card$append_text( - paste( + 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 ) - 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()) diff --git a/R/tm_g_barchart_simple.R b/R/tm_g_barchart_simple.R index 2aff61a1cd..ffa5e8ef74 100644 --- a/R/tm_g_barchart_simple.R +++ b/R/tm_g_barchart_simple.R @@ -539,14 +539,12 @@ srv_g_barchart_simple <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Barchart Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Barchart Plot", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_ci.R b/R/tm_g_ci.R index 7a6bfdec81..e38d9a371f 100644 --- a/R/tm_g_ci.R +++ b/R/tm_g_ci.R @@ -484,15 +484,12 @@ srv_g_ci <- function(id, # nolint ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "CI Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - card$append_text("Confidence Interval Plot", "header3") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "CI Plot", + label = label, + description = "Confidence Interval Plot", + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_forest_rsp.R b/R/tm_g_forest_rsp.R index 94d36b0049..75d0fbc46e 100644 --- a/R/tm_g_forest_rsp.R +++ b/R/tm_g_forest_rsp.R @@ -719,14 +719,12 @@ srv_g_forest_rsp <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Forest Response Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Forest Response Plot", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_forest_tte.R b/R/tm_g_forest_tte.R index 0d2277639d..0ae63244bf 100644 --- a/R/tm_g_forest_tte.R +++ b/R/tm_g_forest_tte.R @@ -653,14 +653,12 @@ srv_g_forest_tte <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Forest Survival Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Forest Survival Plot", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_ipp.R b/R/tm_g_ipp.R index 11e9f07ff4..c042f4072b 100644 --- a/R/tm_g_ipp.R +++ b/R/tm_g_ipp.R @@ -612,14 +612,12 @@ srv_g_ipp <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Individual Patient Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Individual Patient Plot", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_km.R b/R/tm_g_km.R index c6e6d07fae..b6ca08dc17 100644 --- a/R/tm_g_km.R +++ b/R/tm_g_km.R @@ -774,15 +774,12 @@ srv_g_km <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Kaplan Meier Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "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 <- 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 + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_lineplot.R b/R/tm_g_lineplot.R index a8383bc932..c3145147b9 100644 --- a/R/tm_g_lineplot.R +++ b/R/tm_g_lineplot.R @@ -649,14 +649,12 @@ srv_g_lineplot <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Line Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Line Plot", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_pp_adverse_events.R b/R/tm_g_pp_adverse_events.R index 8f717262f3..de15394ab2 100644 --- a/R/tm_g_pp_adverse_events.R +++ b/R/tm_g_pp_adverse_events.R @@ -559,14 +559,12 @@ srv_g_adverse_events <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Patient Profile Adverse Events Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Patient Profile Adverse Events Plot", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_pp_patient_timeline.R b/R/tm_g_pp_patient_timeline.R index 93f16a862a..7f86c4fa49 100644 --- a/R/tm_g_pp_patient_timeline.R +++ b/R/tm_g_pp_patient_timeline.R @@ -895,14 +895,12 @@ srv_g_patient_timeline <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Patient Profile Timeline Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Patient Profile Timeline Plot", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_pp_therapy.R b/R/tm_g_pp_therapy.R index 856ef49803..e7bc0ea48e 100644 --- a/R/tm_g_pp_therapy.R +++ b/R/tm_g_pp_therapy.R @@ -683,14 +683,12 @@ srv_g_therapy <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Patient Profile Therapy Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Patient Profile Therapy Plot", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_g_pp_vitals.R b/R/tm_g_pp_vitals.R index f5b029568d..a17c902861 100644 --- a/R/tm_g_pp_vitals.R +++ b/R/tm_g_pp_vitals.R @@ -529,14 +529,12 @@ srv_g_vitals <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Patient Profile Vitals Plot" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Patient Profile Vitals Plot", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) if (!comment == "") { diff --git a/R/tm_t_abnormality.R b/R/tm_t_abnormality.R index b37435214c..cc26ffe285 100644 --- a/R/tm_t_abnormality.R +++ b/R/tm_t_abnormality.R @@ -648,14 +648,12 @@ srv_t_abnormality <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Abnormality Summary Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Abnormality Summary Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_abnormality_by_worst_grade.R b/R/tm_t_abnormality_by_worst_grade.R index e2b4ff0b9b..b5620308b8 100644 --- a/R/tm_t_abnormality_by_worst_grade.R +++ b/R/tm_t_abnormality_by_worst_grade.R @@ -665,15 +665,12 @@ srv_t_abnormality_by_worst_grade <- function(id, # nolint ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Laboratory Test Results Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "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 <- card_template( + title = "Laboratory Test Results Table", + label = label, + description = "Laboratory test results with highest grade post-baseline Table", + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_ancova.R b/R/tm_t_ancova.R index b1b0257e9b..b153a3b69f 100644 --- a/R/tm_t_ancova.R +++ b/R/tm_t_ancova.R @@ -946,15 +946,12 @@ srv_ancova <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "ANCOVA" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - card$append_text("Analysis of Covariance", "header3") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "ANCOVA", + label = label, + description = "Analysis of Covariance", + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_binary_outcome.R b/R/tm_t_binary_outcome.R index b0bba79e06..d5fa1a84a6 100644 --- a/R/tm_t_binary_outcome.R +++ b/R/tm_t_binary_outcome.R @@ -1009,14 +1009,12 @@ srv_t_binary_outcome <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Binary Outcome Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Binary Outcome Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_coxreg.R b/R/tm_t_coxreg.R index f1b9b96f2c..675ed7a0df 100644 --- a/R/tm_t_coxreg.R +++ b/R/tm_t_coxreg.R @@ -1046,13 +1046,13 @@ srv_t_coxreg <- function(id, ### REPORTER if (with_reporter) { - card_fun <- function(comment) { - card <- teal::TealReportCard$new() - card$set_name("Cox Regression Table") - card$append_text("Cox Regression Table", "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card_fun <- function(comment, label) { + card <- card_template( + title = "Cox Regression Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_events.R b/R/tm_t_events.R index c67416235a..36340ba113 100644 --- a/R/tm_t_events.R +++ b/R/tm_t_events.R @@ -794,14 +794,12 @@ srv_t_events_byterm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Events by Term Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Events by Term Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_events_by_grade.R b/R/tm_t_events_by_grade.R index 12db75862d..d378626d77 100644 --- a/R/tm_t_events_by_grade.R +++ b/R/tm_t_events_by_grade.R @@ -1194,14 +1194,12 @@ srv_t_events_by_grade <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Events by Grade Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Events by Grade Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_events_patyear.R b/R/tm_t_events_patyear.R index 9c632225c5..76c6300f93 100644 --- a/R/tm_t_events_patyear.R +++ b/R/tm_t_events_patyear.R @@ -556,14 +556,12 @@ srv_events_patyear <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Event Rates Adjusted For Patient-Years Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Event Rates Adjusted For Patient-Years Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_events_summary.R b/R/tm_t_events_summary.R index cb88ad733e..cc1465b068 100644 --- a/R/tm_t_events_summary.R +++ b/R/tm_t_events_summary.R @@ -966,14 +966,12 @@ srv_t_events_summary <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Adverse Events Summary Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Adverse Events Summary Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_exposure.R b/R/tm_t_exposure.R index d0b64a3873..39cc2f3663 100644 --- a/R/tm_t_exposure.R +++ b/R/tm_t_exposure.R @@ -646,14 +646,12 @@ srv_t_exposure <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Exposure for Risk Management Plan Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Exposure for Risk Management Plan Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_logistic.R b/R/tm_t_logistic.R index a4190aa91e..6032e7310e 100644 --- a/R/tm_t_logistic.R +++ b/R/tm_t_logistic.R @@ -714,14 +714,12 @@ srv_t_logistic <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Logistic Regression Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Logistic Regression Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_mult_events.R b/R/tm_t_mult_events.R index 234f0d37b2..809e344e6d 100644 --- a/R/tm_t_mult_events.R +++ b/R/tm_t_mult_events.R @@ -592,14 +592,12 @@ srv_t_mult_events_byterm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Multiple Events by Term Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Multiple Events by Term Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_pp_basic_info.R b/R/tm_t_pp_basic_info.R index 11282e75a4..e8d8063a1b 100644 --- a/R/tm_t_pp_basic_info.R +++ b/R/tm_t_pp_basic_info.R @@ -263,14 +263,12 @@ srv_t_basic_info <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Patient Profile Basic Info Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Patient Profile Basic Info Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_pp_laboratory.R b/R/tm_t_pp_laboratory.R index 45be9a5442..5d78a96001 100644 --- a/R/tm_t_pp_laboratory.R +++ b/R/tm_t_pp_laboratory.R @@ -436,14 +436,12 @@ srv_g_laboratory <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Patient Profile Laboratory Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Patient Profile Laboratory Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()$raw) if (!comment == "") { diff --git a/R/tm_t_pp_medical_history.R b/R/tm_t_pp_medical_history.R index 7d8cd121ba..a343f9ff14 100644 --- a/R/tm_t_pp_medical_history.R +++ b/R/tm_t_pp_medical_history.R @@ -337,14 +337,12 @@ srv_t_medical_history <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Patient Medical History Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Patient Medical History Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_pp_prior_medication.R b/R/tm_t_pp_prior_medication.R index 253d1ef8f2..8348b1de4c 100644 --- a/R/tm_t_pp_prior_medication.R +++ b/R/tm_t_pp_prior_medication.R @@ -345,14 +345,12 @@ srv_t_prior_medication <- function(id, if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Patient Prior Medication Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Patient Prior Medication Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_shift_by_arm_by_worst.R b/R/tm_t_shift_by_arm_by_worst.R index 2766ed9b4c..5fedb941cc 100644 --- a/R/tm_t_shift_by_arm_by_worst.R +++ b/R/tm_t_shift_by_arm_by_worst.R @@ -567,14 +567,12 @@ srv_shift_by_arm_by_worst <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Shift by Arm by Worst Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Shift by Arm by Worst Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_shift_by_grade.R b/R/tm_t_shift_by_grade.R index 9e62180b64..5e114c4e54 100644 --- a/R/tm_t_shift_by_grade.R +++ b/R/tm_t_shift_by_grade.R @@ -887,14 +887,12 @@ srv_t_shift_by_grade <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Grade Summary Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Grade Summary Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_smq.R b/R/tm_t_smq.R index e221467644..29bca8f6a4 100644 --- a/R/tm_t_smq.R +++ b/R/tm_t_smq.R @@ -659,14 +659,12 @@ srv_t_smq <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Adverse Events Table by Standardized `MedDRA` Query (SMQ)" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Adverse Events Table by Standardized `MedDRA` Query (SMQ)", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_summary.R b/R/tm_t_summary.R index af27ae3528..e474c09494 100644 --- a/R/tm_t_summary.R +++ b/R/tm_t_summary.R @@ -577,14 +577,12 @@ srv_summary <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Summary Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Summary Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_summary_by.R b/R/tm_t_summary_by.R index d19246519b..3ec4a86fbf 100644 --- a/R/tm_t_summary_by.R +++ b/R/tm_t_summary_by.R @@ -734,14 +734,12 @@ srv_summary_by <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Summarize Variables by Row Groups Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Summarize Variables by Row Groups Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/tm_t_tte.R b/R/tm_t_tte.R index 3926983458..ac8784bbf6 100644 --- a/R/tm_t_tte.R +++ b/R/tm_t_tte.R @@ -927,14 +927,12 @@ srv_t_tte <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Time To Event Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Time To Event Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { diff --git a/R/utils.R b/R/utils.R index 2b9cd61d0a..24e84a4d6d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -821,6 +821,27 @@ clean_description <- function(x) { x } +#' Template function to generate reporter card for `teal.modules.clinical` +#' @param title (`character(1)`) title of the card (unless overwritten by label) +#' @param label (`character(1)`) label provided by the user when adding the card +#' @param description (`character(1)`) optional additional description +#' +#' @return (`TealReportCard`) populated with a title, description and filter state +#' +#' @keywords internal +card_template <- function(title, label, description = NULL, with_filter) { + card <- teal::TealReportCard$new() + title <- ifelse(label == "", title, label) + card$set_name(title) + card$append_text(title, "header2") + if (!is.null(description)) { + card$append_text(description, "header3") + } + if (with_filter) { + card$append_fs(filter_panel_api$get_filter_state()) + } + card +} #' Utility function for extracting `paramcd` for forest plots #' From f34e342eaf1ed5cf2d32420edba4fb94f4177655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Sep 2023 18:03:39 +0200 Subject: [PATCH 05/17] feat: use card template to remove repeated code --- R/tm_t_shift_by_arm.R | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/R/tm_t_shift_by_arm.R b/R/tm_t_shift_by_arm.R index 124ec69ec2..7892b4292b 100644 --- a/R/tm_t_shift_by_arm.R +++ b/R/tm_t_shift_by_arm.R @@ -529,14 +529,12 @@ srv_shift_by_arm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::TealReportCard$new() - title <- "Shift by Arm Table" - title <- ifelse(label == "", title, label) - card$set_name(title) - card$append_text(title, "header2") - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } + card <- card_template( + title = "Shift by Arm Table", + label = label, + description = NULL, + with_filter = with_filter + ) card$append_text("Table", "header3") card$append_table(table_r()) if (!comment == "") { From 163a7e661dd2baf723eb8316df4230ef4fec00b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Sep 2023 18:09:12 +0200 Subject: [PATCH 06/17] docs: add documentation for new function --- man/card_template.Rd | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 man/card_template.Rd diff --git a/man/card_template.Rd b/man/card_template.Rd new file mode 100644 index 0000000000..8561d822db --- /dev/null +++ b/man/card_template.Rd @@ -0,0 +1,22 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/utils.R +\name{card_template} +\alias{card_template} +\title{Template function to generate reporter card for \code{teal.modules.clinical}} +\usage{ +card_template(title, label, description = NULL, with_filter) +} +\arguments{ +\item{title}{(\code{character(1)}) title of the card (unless overwritten by label)} + +\item{label}{(\code{character(1)}) label provided by the user when adding the card} + +\item{description}{(\code{character(1)}) optional additional description} +} +\value{ +(\code{TealReportCard}) populated with a title, description and filter state +} +\description{ +Template function to generate reporter card for \code{teal.modules.clinical} +} +\keyword{internal} From 9255f11c8f9901f6375c9f165ba772ebd91ffa9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Sep 2023 18:31:14 +0200 Subject: [PATCH 07/17] fix: adds missing parameter --- R/tm_a_gee.R | 3 ++- R/tm_a_mmrm.R | 3 ++- R/tm_g_barchart_simple.R | 3 ++- R/tm_g_ci.R | 3 ++- R/tm_g_forest_rsp.R | 3 ++- R/tm_g_forest_tte.R | 3 ++- R/tm_g_ipp.R | 3 ++- R/tm_g_km.R | 3 ++- R/tm_g_lineplot.R | 3 ++- R/tm_g_pp_adverse_events.R | 3 ++- R/tm_g_pp_patient_timeline.R | 3 ++- R/tm_g_pp_therapy.R | 3 ++- R/tm_g_pp_vitals.R | 3 ++- R/tm_t_abnormality.R | 3 ++- R/tm_t_abnormality_by_worst_grade.R | 3 ++- R/tm_t_ancova.R | 3 ++- R/tm_t_binary_outcome.R | 3 ++- R/tm_t_coxreg.R | 3 ++- R/tm_t_events.R | 3 ++- R/tm_t_events_by_grade.R | 3 ++- R/tm_t_events_patyear.R | 3 ++- R/tm_t_events_summary.R | 3 ++- R/tm_t_exposure.R | 3 ++- R/tm_t_logistic.R | 3 ++- R/tm_t_mult_events.R | 3 ++- R/tm_t_pp_basic_info.R | 3 ++- R/tm_t_pp_laboratory.R | 3 ++- R/tm_t_pp_medical_history.R | 3 ++- R/tm_t_pp_prior_medication.R | 3 ++- R/tm_t_shift_by_arm.R | 3 ++- R/tm_t_shift_by_arm_by_worst.R | 3 ++- R/tm_t_shift_by_grade.R | 3 ++- R/tm_t_smq.R | 3 ++- R/tm_t_summary.R | 3 ++- R/tm_t_summary_by.R | 3 ++- R/tm_t_tte.R | 3 ++- 36 files changed, 72 insertions(+), 36 deletions(-) diff --git a/R/tm_a_gee.R b/R/tm_a_gee.R index 7f1bd2aca1..af26990321 100644 --- a/R/tm_a_gee.R +++ b/R/tm_a_gee.R @@ -554,7 +554,8 @@ srv_gee <- function(id, title = "Generalized Estimating Equations (GEE) Analysis Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) table_type <- switch(input$output_table, "t_gee_cov" = "Residual Covariance Matrix Estimate", diff --git a/R/tm_a_mmrm.R b/R/tm_a_mmrm.R index 49aae7bb3d..ff441ad89d 100644 --- a/R/tm_a_mmrm.R +++ b/R/tm_a_mmrm.R @@ -1440,7 +1440,8 @@ srv_mmrm <- function(id, "Mixed Models procedure analyzes results from repeated measures designs", "in which the outcome is continuous and measured at fixed time points" ), - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) if (!is.null(table_r())) { card$append_text("Table", "header3") diff --git a/R/tm_g_barchart_simple.R b/R/tm_g_barchart_simple.R index ffa5e8ef74..1f361ecef6 100644 --- a/R/tm_g_barchart_simple.R +++ b/R/tm_g_barchart_simple.R @@ -543,7 +543,8 @@ srv_g_barchart_simple <- function(id, title = "Barchart Plot", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_ci.R b/R/tm_g_ci.R index e38d9a371f..6623722e6a 100644 --- a/R/tm_g_ci.R +++ b/R/tm_g_ci.R @@ -488,7 +488,8 @@ srv_g_ci <- function(id, # nolint title = "CI Plot", label = label, description = "Confidence Interval Plot", - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_forest_rsp.R b/R/tm_g_forest_rsp.R index 75d0fbc46e..d45d54b405 100644 --- a/R/tm_g_forest_rsp.R +++ b/R/tm_g_forest_rsp.R @@ -723,7 +723,8 @@ srv_g_forest_rsp <- function(id, title = "Forest Response Plot", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_forest_tte.R b/R/tm_g_forest_tte.R index 0ae63244bf..39ac754e11 100644 --- a/R/tm_g_forest_tte.R +++ b/R/tm_g_forest_tte.R @@ -657,7 +657,8 @@ srv_g_forest_tte <- function(id, title = "Forest Survival Plot", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_ipp.R b/R/tm_g_ipp.R index c042f4072b..5afa6052ba 100644 --- a/R/tm_g_ipp.R +++ b/R/tm_g_ipp.R @@ -616,7 +616,8 @@ srv_g_ipp <- function(id, title = "Individual Patient Plot", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_km.R b/R/tm_g_km.R index b6ca08dc17..3c90d9d6ea 100644 --- a/R/tm_g_km.R +++ b/R/tm_g_km.R @@ -778,7 +778,8 @@ srv_g_km <- function(id, title = "Kaplan Meier Plot", label = label, description = "Non-parametric method used to estimate the survival function from lifetime data", - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_lineplot.R b/R/tm_g_lineplot.R index c3145147b9..7cd897e335 100644 --- a/R/tm_g_lineplot.R +++ b/R/tm_g_lineplot.R @@ -653,7 +653,8 @@ srv_g_lineplot <- function(id, title = "Line Plot", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_pp_adverse_events.R b/R/tm_g_pp_adverse_events.R index de15394ab2..088dfc3763 100644 --- a/R/tm_g_pp_adverse_events.R +++ b/R/tm_g_pp_adverse_events.R @@ -563,7 +563,8 @@ srv_g_adverse_events <- function(id, title = "Patient Profile Adverse Events Plot", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_pp_patient_timeline.R b/R/tm_g_pp_patient_timeline.R index 7f86c4fa49..bf6c0918e6 100644 --- a/R/tm_g_pp_patient_timeline.R +++ b/R/tm_g_pp_patient_timeline.R @@ -899,7 +899,8 @@ srv_g_patient_timeline <- function(id, title = "Patient Profile Timeline Plot", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_pp_therapy.R b/R/tm_g_pp_therapy.R index e7bc0ea48e..60df963e65 100644 --- a/R/tm_g_pp_therapy.R +++ b/R/tm_g_pp_therapy.R @@ -687,7 +687,8 @@ srv_g_therapy <- function(id, title = "Patient Profile Therapy Plot", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_g_pp_vitals.R b/R/tm_g_pp_vitals.R index a17c902861..a2c37cd3cb 100644 --- a/R/tm_g_pp_vitals.R +++ b/R/tm_g_pp_vitals.R @@ -533,7 +533,8 @@ srv_g_vitals <- function(id, title = "Patient Profile Vitals Plot", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Plot", "header3") card$append_plot(plot_r(), dim = pws$dim()) diff --git a/R/tm_t_abnormality.R b/R/tm_t_abnormality.R index cc26ffe285..0ef30d8537 100644 --- a/R/tm_t_abnormality.R +++ b/R/tm_t_abnormality.R @@ -652,7 +652,8 @@ srv_t_abnormality <- function(id, title = "Abnormality Summary Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_abnormality_by_worst_grade.R b/R/tm_t_abnormality_by_worst_grade.R index b5620308b8..9821197013 100644 --- a/R/tm_t_abnormality_by_worst_grade.R +++ b/R/tm_t_abnormality_by_worst_grade.R @@ -669,7 +669,8 @@ srv_t_abnormality_by_worst_grade <- function(id, # nolint title = "Laboratory Test Results Table", label = label, description = "Laboratory test results with highest grade post-baseline Table", - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_ancova.R b/R/tm_t_ancova.R index b153a3b69f..9db4774c07 100644 --- a/R/tm_t_ancova.R +++ b/R/tm_t_ancova.R @@ -950,7 +950,8 @@ srv_ancova <- function(id, title = "ANCOVA", label = label, description = "Analysis of Covariance", - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_binary_outcome.R b/R/tm_t_binary_outcome.R index d5fa1a84a6..746ccced78 100644 --- a/R/tm_t_binary_outcome.R +++ b/R/tm_t_binary_outcome.R @@ -1013,7 +1013,8 @@ srv_t_binary_outcome <- function(id, title = "Binary Outcome Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_coxreg.R b/R/tm_t_coxreg.R index 675ed7a0df..5937b93d91 100644 --- a/R/tm_t_coxreg.R +++ b/R/tm_t_coxreg.R @@ -1051,7 +1051,8 @@ srv_t_coxreg <- function(id, title = "Cox Regression Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_events.R b/R/tm_t_events.R index 36340ba113..68bde9fce1 100644 --- a/R/tm_t_events.R +++ b/R/tm_t_events.R @@ -798,7 +798,8 @@ srv_t_events_byterm <- function(id, title = "Events by Term Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_events_by_grade.R b/R/tm_t_events_by_grade.R index d378626d77..18ef343eab 100644 --- a/R/tm_t_events_by_grade.R +++ b/R/tm_t_events_by_grade.R @@ -1198,7 +1198,8 @@ srv_t_events_by_grade <- function(id, title = "Events by Grade Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_events_patyear.R b/R/tm_t_events_patyear.R index 76c6300f93..cf2c362377 100644 --- a/R/tm_t_events_patyear.R +++ b/R/tm_t_events_patyear.R @@ -560,7 +560,8 @@ srv_events_patyear <- function(id, title = "Event Rates Adjusted For Patient-Years Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_events_summary.R b/R/tm_t_events_summary.R index cc1465b068..0d5747ad8d 100644 --- a/R/tm_t_events_summary.R +++ b/R/tm_t_events_summary.R @@ -970,7 +970,8 @@ srv_t_events_summary <- function(id, title = "Adverse Events Summary Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_exposure.R b/R/tm_t_exposure.R index 39cc2f3663..e0c95a5ee0 100644 --- a/R/tm_t_exposure.R +++ b/R/tm_t_exposure.R @@ -650,7 +650,8 @@ srv_t_exposure <- function(id, title = "Exposure for Risk Management Plan Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_logistic.R b/R/tm_t_logistic.R index 6032e7310e..d9989b8145 100644 --- a/R/tm_t_logistic.R +++ b/R/tm_t_logistic.R @@ -718,7 +718,8 @@ srv_t_logistic <- function(id, title = "Logistic Regression Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_mult_events.R b/R/tm_t_mult_events.R index 809e344e6d..368f470c0a 100644 --- a/R/tm_t_mult_events.R +++ b/R/tm_t_mult_events.R @@ -596,7 +596,8 @@ srv_t_mult_events_byterm <- function(id, title = "Multiple Events by Term Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_pp_basic_info.R b/R/tm_t_pp_basic_info.R index e8d8063a1b..e222642289 100644 --- a/R/tm_t_pp_basic_info.R +++ b/R/tm_t_pp_basic_info.R @@ -267,7 +267,8 @@ srv_t_basic_info <- function(id, title = "Patient Profile Basic Info Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_pp_laboratory.R b/R/tm_t_pp_laboratory.R index 5d78a96001..674a3bf028 100644 --- a/R/tm_t_pp_laboratory.R +++ b/R/tm_t_pp_laboratory.R @@ -440,7 +440,8 @@ srv_g_laboratory <- function(id, title = "Patient Profile Laboratory Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()$raw) diff --git a/R/tm_t_pp_medical_history.R b/R/tm_t_pp_medical_history.R index a343f9ff14..3f72f6ece2 100644 --- a/R/tm_t_pp_medical_history.R +++ b/R/tm_t_pp_medical_history.R @@ -341,7 +341,8 @@ srv_t_medical_history <- function(id, title = "Patient Medical History Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_pp_prior_medication.R b/R/tm_t_pp_prior_medication.R index 8348b1de4c..60710fe13f 100644 --- a/R/tm_t_pp_prior_medication.R +++ b/R/tm_t_pp_prior_medication.R @@ -349,7 +349,8 @@ srv_t_prior_medication <- function(id, title = "Patient Prior Medication Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_shift_by_arm.R b/R/tm_t_shift_by_arm.R index 7892b4292b..89e3000006 100644 --- a/R/tm_t_shift_by_arm.R +++ b/R/tm_t_shift_by_arm.R @@ -533,7 +533,8 @@ srv_shift_by_arm <- function(id, title = "Shift by Arm Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_shift_by_arm_by_worst.R b/R/tm_t_shift_by_arm_by_worst.R index 5fedb941cc..907c464850 100644 --- a/R/tm_t_shift_by_arm_by_worst.R +++ b/R/tm_t_shift_by_arm_by_worst.R @@ -571,7 +571,8 @@ srv_shift_by_arm_by_worst <- function(id, title = "Shift by Arm by Worst Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_shift_by_grade.R b/R/tm_t_shift_by_grade.R index 5e114c4e54..22b3ca9caf 100644 --- a/R/tm_t_shift_by_grade.R +++ b/R/tm_t_shift_by_grade.R @@ -891,7 +891,8 @@ srv_t_shift_by_grade <- function(id, title = "Grade Summary Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_smq.R b/R/tm_t_smq.R index 29bca8f6a4..d668209b95 100644 --- a/R/tm_t_smq.R +++ b/R/tm_t_smq.R @@ -663,7 +663,8 @@ srv_t_smq <- function(id, title = "Adverse Events Table by Standardized `MedDRA` Query (SMQ)", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_summary.R b/R/tm_t_summary.R index e474c09494..c68a5896e5 100644 --- a/R/tm_t_summary.R +++ b/R/tm_t_summary.R @@ -581,7 +581,8 @@ srv_summary <- function(id, title = "Summary Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_summary_by.R b/R/tm_t_summary_by.R index 3ec4a86fbf..20d976a2e0 100644 --- a/R/tm_t_summary_by.R +++ b/R/tm_t_summary_by.R @@ -738,7 +738,8 @@ srv_summary_by <- function(id, title = "Summarize Variables by Row Groups Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) diff --git a/R/tm_t_tte.R b/R/tm_t_tte.R index ac8784bbf6..45c41468cf 100644 --- a/R/tm_t_tte.R +++ b/R/tm_t_tte.R @@ -931,7 +931,8 @@ srv_t_tte <- function(id, title = "Time To Event Table", label = label, description = NULL, - with_filter = with_filter + with_filter = with_filter, + filter_panel_api = filter_panel_api ) card$append_text("Table", "header3") card$append_table(table_r()) From 9280b963133b8ea7e94a5075425ecca9578b684a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:22:24 +0200 Subject: [PATCH 08/17] docs: fix parameters --- R/utils.R | 4 +++- man/card_template.Rd | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index 24e84a4d6d..e1ecbb093c 100644 --- a/R/utils.R +++ b/R/utils.R @@ -825,11 +825,13 @@ clean_description <- function(x) { #' @param title (`character(1)`) title of the card (unless overwritten by label) #' @param label (`character(1)`) label provided by the user when adding the card #' @param description (`character(1)`) optional additional description +#' @param with_filter (`logical(1)`) flag indicating to add filter state +#' @param filter_panel_api (`FilterPanelAPI`) filter panel api instance #' #' @return (`TealReportCard`) populated with a title, description and filter state #' #' @keywords internal -card_template <- function(title, label, description = NULL, with_filter) { +card_template <- function(title, label, description = NULL, with_filter, filter_panel_api) { card <- teal::TealReportCard$new() title <- ifelse(label == "", title, label) card$set_name(title) diff --git a/man/card_template.Rd b/man/card_template.Rd index 8561d822db..6cabb0e473 100644 --- a/man/card_template.Rd +++ b/man/card_template.Rd @@ -4,7 +4,7 @@ \alias{card_template} \title{Template function to generate reporter card for \code{teal.modules.clinical}} \usage{ -card_template(title, label, description = NULL, with_filter) +card_template(title, label, description = NULL, with_filter, filter_panel_api) } \arguments{ \item{title}{(\code{character(1)}) title of the card (unless overwritten by label)} @@ -12,6 +12,10 @@ card_template(title, label, description = NULL, with_filter) \item{label}{(\code{character(1)}) label provided by the user when adding the card} \item{description}{(\code{character(1)}) optional additional description} + +\item{with_filter}{(\code{logical(1)}) flag indicating to add filter state} + +\item{filter_panel_api}{(\code{FilterPanelAPI}) filter panel api instance} } \value{ (\code{TealReportCard}) populated with a title, description and filter state From 19e8a0f2ec56b68b2cf72941bf2b9384a54a49b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Thu, 28 Sep 2023 19:33:25 +0200 Subject: [PATCH 09/17] docs: improve description of parameter --- R/utils.R | 3 ++- man/card_template.Rd | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/R/utils.R b/R/utils.R index e1ecbb093c..4138005d27 100644 --- a/R/utils.R +++ b/R/utils.R @@ -826,7 +826,8 @@ clean_description <- function(x) { #' @param label (`character(1)`) label provided by the user when adding the card #' @param description (`character(1)`) optional additional description #' @param with_filter (`logical(1)`) flag indicating to add filter state -#' @param filter_panel_api (`FilterPanelAPI`) filter panel api instance +#' @param filter_panel_api (`FilterPanelAPI`) object with API that allows the generation +#' of the filter state in the report #' #' @return (`TealReportCard`) populated with a title, description and filter state #' diff --git a/man/card_template.Rd b/man/card_template.Rd index 6cabb0e473..f88b5ef17b 100644 --- a/man/card_template.Rd +++ b/man/card_template.Rd @@ -15,7 +15,8 @@ card_template(title, label, description = NULL, with_filter, filter_panel_api) \item{with_filter}{(\code{logical(1)}) flag indicating to add filter state} -\item{filter_panel_api}{(\code{FilterPanelAPI}) filter panel api instance} +\item{filter_panel_api}{(\code{FilterPanelAPI}) object with API that allows the generation +of the filter state in the report} } \value{ (\code{TealReportCard}) populated with a title, description and filter state From 74ccd11e778196eca53f249eaba6e6093c8ed1b4 Mon Sep 17 00:00:00 2001 From: m7pr Date: Fri, 29 Sep 2023 11:48:56 +0200 Subject: [PATCH 10/17] change ifelse to if --- R/utils.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 4138005d27..58354355ba 100644 --- a/R/utils.R +++ b/R/utils.R @@ -834,7 +834,7 @@ clean_description <- function(x) { #' @keywords internal card_template <- function(title, label, description = NULL, with_filter, filter_panel_api) { card <- teal::TealReportCard$new() - title <- ifelse(label == "", title, label) + title <- if (label == "") title else label card$set_name(title) card$append_text(title, "header2") if (!is.null(description)) { From 6d0a9638f7ff75b006fba5dbbbbf9dbafab04bf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Ver=C3=ADssimo?= <211358+averissimo@users.noreply.github.com> Date: Fri, 29 Sep 2023 13:08:34 +0200 Subject: [PATCH 11/17] Corrects linter errors detected on `198_card_labels@main` (#836) Corrects SuperLinter errors that were already in `main` and unrelated to #835 They were caught by SuperLinter because we changed the files. --------- Co-authored-by: m7pr --- R/tm_a_mmrm.R | 9 ++++----- R/tm_g_pp_patient_timeline.R | 8 +++++--- R/tm_t_events.R | 37 ++++++++++++++++++------------------ R/tm_t_logistic.R | 6 ++++-- R/tm_t_mult_events.R | 28 +++++++++++++-------------- R/tm_t_tte.R | 30 +++++++++++++++-------------- 6 files changed, 60 insertions(+), 58 deletions(-) diff --git a/R/tm_a_mmrm.R b/R/tm_a_mmrm.R index ff441ad89d..858a0428fe 100644 --- a/R/tm_a_mmrm.R +++ b/R/tm_a_mmrm.R @@ -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, diff --git a/R/tm_g_pp_patient_timeline.R b/R/tm_g_pp_patient_timeline.R index bf6c0918e6..5f78c684c2 100644 --- a/R/tm_g_pp_patient_timeline.R +++ b/R/tm_g_pp_patient_timeline.R @@ -797,7 +797,7 @@ srv_g_patient_timeline <- function(id, shiny::need( input$relday_x_axis || (sum(stats::complete.cases(p_time_data_pat[, c(aetime_start, aetime_end)])) > 0 || - sum(stats::complete.cases(p_time_data_pat[, c(dstime_start, dstime_end)])) > 0), + sum(stats::complete.cases(p_time_data_pat[, c(dstime_start, dstime_end)])) > 0), "Selected patient is not in dataset (either due to filtering or missing values). Consider relaxing filters." ) ) @@ -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." ) ) diff --git a/R/tm_t_events.R b/R/tm_t_events.R index 68bde9fce1..7a5f177bcd 100644 --- a/R/tm_t_events.R +++ b/R/tm_t_events.R @@ -228,26 +228,25 @@ template_events <- function(dataname, layout_list <- add_expr( layout_list, substitute( - expr = - rtables::split_rows_by( - hlt, - child_labels = "visible", - nested = FALSE, - indent_mod = -1L, - split_fun = split_fun, - label_pos = "topleft", - split_label = formatters::var_labels(dataname[hlt]) + expr = rtables::split_rows_by( + hlt, + child_labels = "visible", + nested = FALSE, + indent_mod = -1L, + split_fun = split_fun, + label_pos = "topleft", + split_label = formatters::var_labels(dataname[hlt]) + ) %>% + summarize_num_patients( + var = "USUBJID", + .stats = c("unique", "nonunique"), + .labels = c( + unique = unique_label, + nonunique = nonunique_label + ) ) %>% - summarize_num_patients( - var = "USUBJID", - .stats = c("unique", "nonunique"), - .labels = c( - unique = unique_label, - nonunique = nonunique_label - ) - ) %>% - count_occurrences(vars = llt, .indent_mods = c(count_fraction = 1L)) %>% - append_varlabels(dataname, llt, indent = 1L), + count_occurrences(vars = llt, .indent_mods = c(count_fraction = 1L)) %>% + append_varlabels(dataname, llt, indent = 1L), env = list( dataname = as.name(dataname), hlt = hlt, diff --git a/R/tm_t_logistic.R b/R/tm_t_logistic.R index d9989b8145..e9a8795a72 100644 --- a/R/tm_t_logistic.R +++ b/R/tm_t_logistic.R @@ -492,8 +492,10 @@ srv_t_logistic <- function(id, iv$add_validator(iv_arco) # Conditional validator for interaction values. iv_int <- shinyvalidate::InputValidator$new() - iv_int$condition(~ length(input$interaction_var) > 0L && - is.numeric(merged$anl_q()[["ANL"]][[input$interaction_var]])) + iv_int$condition( + ~ length(input$interaction_var) > 0L && + is.numeric(merged$anl_q()[["ANL"]][[input$interaction_var]]) + ) iv_int$add_rule("interaction_values", shinyvalidate::sv_required( "If interaction is specified the level should be entered." )) diff --git a/R/tm_t_mult_events.R b/R/tm_t_mult_events.R index 368f470c0a..21d7f7a936 100644 --- a/R/tm_t_mult_events.R +++ b/R/tm_t_mult_events.R @@ -148,9 +148,8 @@ template_mult_events <- function(dataname, layout_list <- add_expr( layout_list, substitute( - expr = - count_occurrences(vars = llt, .indent_mods = -1L) %>% - append_varlabels(dataname, llt, indent = 0L), + expr = count_occurrences(vars = llt, .indent_mods = -1L) %>% + append_varlabels(dataname, llt, indent = 0L), env = list( dataname = as.name(dataname), llt = llt ) @@ -203,18 +202,17 @@ template_mult_events <- function(dataname, layout_list <- add_expr( layout_list, substitute( - expr = - summarize_num_patients( - var = "USUBJID", - count_by = seq_var, - .stats = c("unique", "nonunique"), - .labels = c( - unique = unique_label, - nonunique = nonunique_label - ) - ) %>% - count_occurrences(vars = llt, .indent_mods = -1L) %>% - append_varlabels(dataname, llt, indent = indent_space), + expr = summarize_num_patients( + var = "USUBJID", + count_by = seq_var, + .stats = c("unique", "nonunique"), + .labels = c( + unique = unique_label, + nonunique = nonunique_label + ) + ) %>% + count_occurrences(vars = llt, .indent_mods = -1L) %>% + append_varlabels(dataname, llt, indent = indent_space), env = list( dataname = as.name(dataname), llt = llt, unique_label = unique_label, nonunique_label = nonunique_label, diff --git a/R/tm_t_tte.R b/R/tm_t_tte.R index 45c41468cf..dd7a25374f 100644 --- a/R/tm_t_tte.R +++ b/R/tm_t_tte.R @@ -10,20 +10,22 @@ #' parameters for comparison, specified using [tern::control_surv_timepoint()]. #' @keywords internal #' -control_tte <- function(surv_time = list( - conf_level = 0.95, - conf_type = "plain", - quantiles = c(0.25, 0.75) - ), - coxph = list( - pval_method = "log-rank", - ties = "efron", - conf_level = 0.95 - ), - surv_timepoint = control_surv_timepoint( - conf_level = 0.95, - conf_type = c("plain", "none", "log", "log-log") - )) { +control_tte <- function( + surv_time = list( + conf_level = 0.95, + conf_type = "plain", + quantiles = c(0.25, 0.75) + ), + coxph = list( + pval_method = "log-rank", + ties = "efron", + conf_level = 0.95 + ), + surv_timepoint = control_surv_timepoint( + conf_level = 0.95, + conf_type = c("plain", "none", "log", "log-log") + ) + ) { list( surv_time = do.call("control_surv_time", surv_time), coxph = do.call("control_coxph", coxph), From 3b2041405fbb5acbe29b96480122bd0c9d743d9c Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Oct 2023 14:29:31 +0530 Subject: [PATCH 12/17] fixing lintr issue and adding unit-test --- .lintr | 3 ++- R/utils.R | 6 ++++++ tests/testthat/test-utils.R | 22 ++++++++++++++++++++++ 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.lintr b/.lintr index 34473d2738..0a0bb22f32 100644 --- a/.lintr +++ b/.lintr @@ -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 ) diff --git a/R/utils.R b/R/utils.R index 58354355ba..f734808639 100644 --- a/R/utils.R +++ b/R/utils.R @@ -833,6 +833,12 @@ clean_description <- function(x) { #' #' @keywords internal card_template <- function(title, label, description = NULL, with_filter, filter_panel_api) { + checkmate::assert_string(title) + checkmate::assert_string(label) + checkmate::assert_string(description, null.ok = TRUE) + checkmate::assert_flag(with_filter) + checkmate::assert_class(filter_panel_api, classes = "FilterPanelAPI") + card <- teal::TealReportCard$new() title <- if (label == "") title else label card$set_name(title) diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index d65759ba6e..b0c9bfb09e 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -203,6 +203,28 @@ testthat::test_that("clean_description", { testthat::expect_identical(clean_description(vals2), as.character(vals2)) }) +testthat::test_that("card_template function returns TealReportCard object with appropriate content and labels", { + fd <- teal.slice::init_filtered_data(list(iris = list(dataset = iris))) + filter_panel_api <- teal.slice::FilterPanelAPI$new(fd) + + card <- shiny::isolate(card_template(title = "Card title", + label ="Card label", + description = "Sample description", + with_filter = TRUE, + filter_panel_api = filter_panel_api)) + testthat::expect_s3_class(card, c("TealReportCard")) + testthat::expect_equal(card$get_name(), "Card label") + testthat::expect_length(card$get_content(), 4) + + card <- shiny::isolate(card_template(title = "Card title", + label = "", + with_filter = FALSE, + filter_panel_api = filter_panel_api)) + testthat::expect_s3_class(card, c("TealReportCard")) + testthat::expect_equal(card$get_name(), "Card title") + testthat::expect_length(card$get_content(), 1) +}) + testthat::test_that("get_g_forest_obj_var_name", { paramcd <- teal.transform::data_extract_spec( dataname = "ADSL", From 142f9fef9e6a1aeb2d289f0c26b9cd879f534c98 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Oct 2023 17:45:29 +0530 Subject: [PATCH 13/17] fixing styling changes --- R/tm_g_pp_patient_timeline.R | 2 +- R/tm_t_tte.R | 3 +-- tests/testthat/test-utils.R | 22 +++++++++++++--------- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/R/tm_g_pp_patient_timeline.R b/R/tm_g_pp_patient_timeline.R index 5f78c684c2..fbd19f0b2b 100644 --- a/R/tm_g_pp_patient_timeline.R +++ b/R/tm_g_pp_patient_timeline.R @@ -797,7 +797,7 @@ srv_g_patient_timeline <- function(id, shiny::need( input$relday_x_axis || (sum(stats::complete.cases(p_time_data_pat[, c(aetime_start, aetime_end)])) > 0 || - sum(stats::complete.cases(p_time_data_pat[, c(dstime_start, dstime_end)])) > 0), + sum(stats::complete.cases(p_time_data_pat[, c(dstime_start, dstime_end)])) > 0), "Selected patient is not in dataset (either due to filtering or missing values). Consider relaxing filters." ) ) diff --git a/R/tm_t_tte.R b/R/tm_t_tte.R index dd7a25374f..427a36c044 100644 --- a/R/tm_t_tte.R +++ b/R/tm_t_tte.R @@ -24,8 +24,7 @@ control_tte <- function( surv_timepoint = control_surv_timepoint( conf_level = 0.95, conf_type = c("plain", "none", "log", "log-log") - ) - ) { + )) { list( surv_time = do.call("control_surv_time", surv_time), coxph = do.call("control_coxph", coxph), diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index b0c9bfb09e..baf4ced184 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -207,19 +207,23 @@ testthat::test_that("card_template function returns TealReportCard object with a fd <- teal.slice::init_filtered_data(list(iris = list(dataset = iris))) filter_panel_api <- teal.slice::FilterPanelAPI$new(fd) - card <- shiny::isolate(card_template(title = "Card title", - label ="Card label", - description = "Sample description", - with_filter = TRUE, - filter_panel_api = filter_panel_api)) + card <- shiny::isolate(card_template( + title = "Card title", + label = "Card label", + description = "Sample description", + with_filter = TRUE, + filter_panel_api = filter_panel_api + )) testthat::expect_s3_class(card, c("TealReportCard")) testthat::expect_equal(card$get_name(), "Card label") testthat::expect_length(card$get_content(), 4) - card <- shiny::isolate(card_template(title = "Card title", - label = "", - with_filter = FALSE, - filter_panel_api = filter_panel_api)) + card <- shiny::isolate(card_template( + title = "Card title", + label = "", + with_filter = FALSE, + filter_panel_api = filter_panel_api + )) testthat::expect_s3_class(card, c("TealReportCard")) testthat::expect_equal(card$get_name(), "Card title") testthat::expect_length(card$get_content(), 1) From 8c8799cd9924d959e43e33f5b9a53366c527a11c Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Oct 2023 16:32:16 +0530 Subject: [PATCH 14/17] removing card_template function. --- R/tm_a_gee.R | 3 +-- R/tm_a_mmrm.R | 2 +- R/tm_g_barchart_simple.R | 3 +-- R/tm_g_ci.R | 2 +- R/tm_g_forest_rsp.R | 3 +-- R/tm_g_forest_tte.R | 3 +-- R/tm_g_ipp.R | 3 +-- R/tm_g_km.R | 2 +- R/tm_g_lineplot.R | 3 +-- R/tm_g_pp_adverse_events.R | 3 +-- R/tm_g_pp_patient_timeline.R | 3 +-- R/tm_g_pp_therapy.R | 3 +-- R/tm_g_pp_vitals.R | 3 +-- R/tm_t_abnormality.R | 3 +-- R/tm_t_abnormality_by_worst_grade.R | 2 +- R/tm_t_ancova.R | 2 +- R/tm_t_binary_outcome.R | 3 +-- R/tm_t_coxreg.R | 3 +-- R/tm_t_events.R | 3 +-- R/tm_t_events_by_grade.R | 3 +-- R/tm_t_events_patyear.R | 3 +-- R/tm_t_events_summary.R | 3 +-- R/tm_t_exposure.R | 3 +-- R/tm_t_logistic.R | 3 +-- R/tm_t_mult_events.R | 3 +-- R/tm_t_pp_basic_info.R | 3 +-- R/tm_t_pp_laboratory.R | 3 +-- R/tm_t_pp_medical_history.R | 3 +-- R/tm_t_pp_prior_medication.R | 3 +-- R/tm_t_shift_by_arm.R | 3 +-- R/tm_t_shift_by_arm_by_worst.R | 3 +-- R/tm_t_shift_by_grade.R | 3 +-- R/tm_t_smq.R | 3 +-- R/tm_t_summary.R | 3 +-- R/tm_t_summary_by.R | 3 +-- R/tm_t_tte.R | 3 +-- R/utils.R | 31 ----------------------------- man/card_template.Rd | 27 ------------------------- 38 files changed, 36 insertions(+), 125 deletions(-) delete mode 100644 man/card_template.Rd diff --git a/R/tm_a_gee.R b/R/tm_a_gee.R index af26990321..290f6c522e 100644 --- a/R/tm_a_gee.R +++ b/R/tm_a_gee.R @@ -550,10 +550,9 @@ srv_gee <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Generalized Estimating Equations (GEE) Analysis Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_a_mmrm.R b/R/tm_a_mmrm.R index 858a0428fe..2e37b4bcb9 100644 --- a/R/tm_a_mmrm.R +++ b/R/tm_a_mmrm.R @@ -1432,7 +1432,7 @@ srv_mmrm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Mixed Model Repeated Measurements (MMRM) Analysis", label = label, description = paste( diff --git a/R/tm_g_barchart_simple.R b/R/tm_g_barchart_simple.R index 1f361ecef6..ea5fc6fdb6 100644 --- a/R/tm_g_barchart_simple.R +++ b/R/tm_g_barchart_simple.R @@ -539,10 +539,9 @@ srv_g_barchart_simple <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Barchart Plot", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_g_ci.R b/R/tm_g_ci.R index 6623722e6a..bb0304965d 100644 --- a/R/tm_g_ci.R +++ b/R/tm_g_ci.R @@ -484,7 +484,7 @@ srv_g_ci <- function(id, # nolint ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "CI Plot", label = label, description = "Confidence Interval Plot", diff --git a/R/tm_g_forest_rsp.R b/R/tm_g_forest_rsp.R index d45d54b405..2bff2b4fa1 100644 --- a/R/tm_g_forest_rsp.R +++ b/R/tm_g_forest_rsp.R @@ -719,10 +719,9 @@ srv_g_forest_rsp <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Forest Response Plot", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_g_forest_tte.R b/R/tm_g_forest_tte.R index 39ac754e11..57e2ac8605 100644 --- a/R/tm_g_forest_tte.R +++ b/R/tm_g_forest_tte.R @@ -653,10 +653,9 @@ srv_g_forest_tte <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Forest Survival Plot", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_g_ipp.R b/R/tm_g_ipp.R index 5afa6052ba..407a26cae1 100644 --- a/R/tm_g_ipp.R +++ b/R/tm_g_ipp.R @@ -612,10 +612,9 @@ srv_g_ipp <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Individual Patient Plot", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_g_km.R b/R/tm_g_km.R index 3c90d9d6ea..ab5ccbc858 100644 --- a/R/tm_g_km.R +++ b/R/tm_g_km.R @@ -774,7 +774,7 @@ srv_g_km <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Kaplan Meier Plot", label = label, description = "Non-parametric method used to estimate the survival function from lifetime data", diff --git a/R/tm_g_lineplot.R b/R/tm_g_lineplot.R index 7cd897e335..fff1cc7318 100644 --- a/R/tm_g_lineplot.R +++ b/R/tm_g_lineplot.R @@ -649,10 +649,9 @@ srv_g_lineplot <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Line Plot", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_g_pp_adverse_events.R b/R/tm_g_pp_adverse_events.R index 42577659db..bc6aed558a 100644 --- a/R/tm_g_pp_adverse_events.R +++ b/R/tm_g_pp_adverse_events.R @@ -576,10 +576,9 @@ srv_g_adverse_events <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Patient Profile Adverse Events Plot", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_g_pp_patient_timeline.R b/R/tm_g_pp_patient_timeline.R index fbd19f0b2b..5ee99fc02d 100644 --- a/R/tm_g_pp_patient_timeline.R +++ b/R/tm_g_pp_patient_timeline.R @@ -897,10 +897,9 @@ srv_g_patient_timeline <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Patient Profile Timeline Plot", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_g_pp_therapy.R b/R/tm_g_pp_therapy.R index e5be9795f0..c9a278a96c 100644 --- a/R/tm_g_pp_therapy.R +++ b/R/tm_g_pp_therapy.R @@ -697,10 +697,9 @@ srv_g_therapy <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Patient Profile Therapy", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_g_pp_vitals.R b/R/tm_g_pp_vitals.R index a2c37cd3cb..668707d81f 100644 --- a/R/tm_g_pp_vitals.R +++ b/R/tm_g_pp_vitals.R @@ -529,10 +529,9 @@ srv_g_vitals <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Patient Profile Vitals Plot", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_abnormality.R b/R/tm_t_abnormality.R index 0ef30d8537..709fd0afe9 100644 --- a/R/tm_t_abnormality.R +++ b/R/tm_t_abnormality.R @@ -648,10 +648,9 @@ srv_t_abnormality <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Abnormality Summary Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_abnormality_by_worst_grade.R b/R/tm_t_abnormality_by_worst_grade.R index 9821197013..1c509cbc5f 100644 --- a/R/tm_t_abnormality_by_worst_grade.R +++ b/R/tm_t_abnormality_by_worst_grade.R @@ -665,7 +665,7 @@ srv_t_abnormality_by_worst_grade <- function(id, # nolint ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Laboratory Test Results Table", label = label, description = "Laboratory test results with highest grade post-baseline Table", diff --git a/R/tm_t_ancova.R b/R/tm_t_ancova.R index 9db4774c07..f1a5ed51ee 100644 --- a/R/tm_t_ancova.R +++ b/R/tm_t_ancova.R @@ -946,7 +946,7 @@ srv_ancova <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "ANCOVA", label = label, description = "Analysis of Covariance", diff --git a/R/tm_t_binary_outcome.R b/R/tm_t_binary_outcome.R index 746ccced78..e84b95d3e5 100644 --- a/R/tm_t_binary_outcome.R +++ b/R/tm_t_binary_outcome.R @@ -1009,10 +1009,9 @@ srv_t_binary_outcome <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Binary Outcome Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_coxreg.R b/R/tm_t_coxreg.R index 432ed29105..01736a4bf2 100644 --- a/R/tm_t_coxreg.R +++ b/R/tm_t_coxreg.R @@ -1063,10 +1063,9 @@ srv_t_coxreg <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Cox Regression Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_events.R b/R/tm_t_events.R index 7a5f177bcd..b9f76d9ad7 100644 --- a/R/tm_t_events.R +++ b/R/tm_t_events.R @@ -793,10 +793,9 @@ srv_t_events_byterm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Events by Term Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_events_by_grade.R b/R/tm_t_events_by_grade.R index 18ef343eab..bed2c71047 100644 --- a/R/tm_t_events_by_grade.R +++ b/R/tm_t_events_by_grade.R @@ -1194,10 +1194,9 @@ srv_t_events_by_grade <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Events by Grade Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_events_patyear.R b/R/tm_t_events_patyear.R index cf2c362377..d8f584f442 100644 --- a/R/tm_t_events_patyear.R +++ b/R/tm_t_events_patyear.R @@ -556,10 +556,9 @@ srv_events_patyear <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Event Rates Adjusted For Patient-Years Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_events_summary.R b/R/tm_t_events_summary.R index 0d5747ad8d..ec14585a0d 100644 --- a/R/tm_t_events_summary.R +++ b/R/tm_t_events_summary.R @@ -966,10 +966,9 @@ srv_t_events_summary <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Adverse Events Summary Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_exposure.R b/R/tm_t_exposure.R index e0c95a5ee0..06d7fbcfe8 100644 --- a/R/tm_t_exposure.R +++ b/R/tm_t_exposure.R @@ -646,10 +646,9 @@ srv_t_exposure <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Exposure for Risk Management Plan Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_logistic.R b/R/tm_t_logistic.R index e9a8795a72..dd15ef5c37 100644 --- a/R/tm_t_logistic.R +++ b/R/tm_t_logistic.R @@ -716,10 +716,9 @@ srv_t_logistic <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Logistic Regression Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_mult_events.R b/R/tm_t_mult_events.R index 21d7f7a936..551020d844 100644 --- a/R/tm_t_mult_events.R +++ b/R/tm_t_mult_events.R @@ -590,10 +590,9 @@ srv_t_mult_events_byterm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Multiple Events by Term Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_pp_basic_info.R b/R/tm_t_pp_basic_info.R index 3449f9ac55..961cc2b115 100644 --- a/R/tm_t_pp_basic_info.R +++ b/R/tm_t_pp_basic_info.R @@ -280,10 +280,9 @@ srv_t_basic_info <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Patient Profile Basic Info Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_pp_laboratory.R b/R/tm_t_pp_laboratory.R index 64c8e734a7..1e7d722cb4 100644 --- a/R/tm_t_pp_laboratory.R +++ b/R/tm_t_pp_laboratory.R @@ -453,10 +453,9 @@ srv_g_laboratory <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Patient Profile Laboratory Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_pp_medical_history.R b/R/tm_t_pp_medical_history.R index 54a3b19ca4..043a2d8cd5 100644 --- a/R/tm_t_pp_medical_history.R +++ b/R/tm_t_pp_medical_history.R @@ -343,10 +343,9 @@ srv_t_medical_history <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Patient Medical History Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_pp_prior_medication.R b/R/tm_t_pp_prior_medication.R index 60710fe13f..cafb7bcf0e 100644 --- a/R/tm_t_pp_prior_medication.R +++ b/R/tm_t_pp_prior_medication.R @@ -345,10 +345,9 @@ srv_t_prior_medication <- function(id, if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Patient Prior Medication Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_shift_by_arm.R b/R/tm_t_shift_by_arm.R index 89e3000006..dba0320108 100644 --- a/R/tm_t_shift_by_arm.R +++ b/R/tm_t_shift_by_arm.R @@ -529,10 +529,9 @@ srv_shift_by_arm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Shift by Arm Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_shift_by_arm_by_worst.R b/R/tm_t_shift_by_arm_by_worst.R index 907c464850..97ffba84b3 100644 --- a/R/tm_t_shift_by_arm_by_worst.R +++ b/R/tm_t_shift_by_arm_by_worst.R @@ -567,10 +567,9 @@ srv_shift_by_arm_by_worst <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Shift by Arm by Worst Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_shift_by_grade.R b/R/tm_t_shift_by_grade.R index 22b3ca9caf..a732c46e46 100644 --- a/R/tm_t_shift_by_grade.R +++ b/R/tm_t_shift_by_grade.R @@ -887,10 +887,9 @@ srv_t_shift_by_grade <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Grade Summary Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_smq.R b/R/tm_t_smq.R index d668209b95..04a080164f 100644 --- a/R/tm_t_smq.R +++ b/R/tm_t_smq.R @@ -659,10 +659,9 @@ srv_t_smq <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Adverse Events Table by Standardized `MedDRA` Query (SMQ)", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_summary.R b/R/tm_t_summary.R index c68a5896e5..415c51cd34 100644 --- a/R/tm_t_summary.R +++ b/R/tm_t_summary.R @@ -577,10 +577,9 @@ srv_summary <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Summary Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_summary_by.R b/R/tm_t_summary_by.R index 20d976a2e0..4db6fab7a2 100644 --- a/R/tm_t_summary_by.R +++ b/R/tm_t_summary_by.R @@ -734,10 +734,9 @@ srv_summary_by <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Summarize Variables by Row Groups Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/tm_t_tte.R b/R/tm_t_tte.R index 427a36c044..a0659f06e2 100644 --- a/R/tm_t_tte.R +++ b/R/tm_t_tte.R @@ -928,10 +928,9 @@ srv_t_tte <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- card_template( + card <- teal.reporter::card_template( title = "Time To Event Table", label = label, - description = NULL, with_filter = with_filter, filter_panel_api = filter_panel_api ) diff --git a/R/utils.R b/R/utils.R index f734808639..130b97c1c4 100644 --- a/R/utils.R +++ b/R/utils.R @@ -821,37 +821,6 @@ clean_description <- function(x) { x } -#' Template function to generate reporter card for `teal.modules.clinical` -#' @param title (`character(1)`) title of the card (unless overwritten by label) -#' @param label (`character(1)`) label provided by the user when adding the card -#' @param description (`character(1)`) optional additional description -#' @param with_filter (`logical(1)`) flag indicating to add filter state -#' @param filter_panel_api (`FilterPanelAPI`) object with API that allows the generation -#' of the filter state in the report -#' -#' @return (`TealReportCard`) populated with a title, description and filter state -#' -#' @keywords internal -card_template <- function(title, label, description = NULL, with_filter, filter_panel_api) { - checkmate::assert_string(title) - checkmate::assert_string(label) - checkmate::assert_string(description, null.ok = TRUE) - checkmate::assert_flag(with_filter) - checkmate::assert_class(filter_panel_api, classes = "FilterPanelAPI") - - card <- teal::TealReportCard$new() - title <- if (label == "") title else label - card$set_name(title) - card$append_text(title, "header2") - if (!is.null(description)) { - card$append_text(description, "header3") - } - if (with_filter) { - card$append_fs(filter_panel_api$get_filter_state()) - } - card -} - #' Utility function for extracting `paramcd` for forest plots #' #' Utility function for extracting `paramcd` for forest plots diff --git a/man/card_template.Rd b/man/card_template.Rd deleted file mode 100644 index f88b5ef17b..0000000000 --- a/man/card_template.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{card_template} -\alias{card_template} -\title{Template function to generate reporter card for \code{teal.modules.clinical}} -\usage{ -card_template(title, label, description = NULL, with_filter, filter_panel_api) -} -\arguments{ -\item{title}{(\code{character(1)}) title of the card (unless overwritten by label)} - -\item{label}{(\code{character(1)}) label provided by the user when adding the card} - -\item{description}{(\code{character(1)}) optional additional description} - -\item{with_filter}{(\code{logical(1)}) flag indicating to add filter state} - -\item{filter_panel_api}{(\code{FilterPanelAPI}) object with API that allows the generation -of the filter state in the report} -} -\value{ -(\code{TealReportCard}) populated with a title, description and filter state -} -\description{ -Template function to generate reporter card for \code{teal.modules.clinical} -} -\keyword{internal} From a095580e4c71c62bde0067283f48a8dd1c7aa98a Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 11 Oct 2023 17:07:04 +0530 Subject: [PATCH 15/17] removing card-template unit-test. --- tests/testthat/test-utils.R | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index baf4ced184..d65759ba6e 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -203,32 +203,6 @@ testthat::test_that("clean_description", { testthat::expect_identical(clean_description(vals2), as.character(vals2)) }) -testthat::test_that("card_template function returns TealReportCard object with appropriate content and labels", { - fd <- teal.slice::init_filtered_data(list(iris = list(dataset = iris))) - filter_panel_api <- teal.slice::FilterPanelAPI$new(fd) - - card <- shiny::isolate(card_template( - title = "Card title", - label = "Card label", - description = "Sample description", - with_filter = TRUE, - filter_panel_api = filter_panel_api - )) - testthat::expect_s3_class(card, c("TealReportCard")) - testthat::expect_equal(card$get_name(), "Card label") - testthat::expect_length(card$get_content(), 4) - - card <- shiny::isolate(card_template( - title = "Card title", - label = "", - with_filter = FALSE, - filter_panel_api = filter_panel_api - )) - testthat::expect_s3_class(card, c("TealReportCard")) - testthat::expect_equal(card$get_name(), "Card title") - testthat::expect_length(card$get_content(), 1) -}) - testthat::test_that("get_g_forest_obj_var_name", { paramcd <- teal.transform::data_extract_spec( dataname = "ADSL", From 74140f0383a398721178fa2ae992c624f65f8c55 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Oct 2023 14:09:28 +0530 Subject: [PATCH 16/17] change namespace call from teal.reporter to teal for card_template --- R/tm_a_gee.R | 2 +- R/tm_a_mmrm.R | 2 +- R/tm_g_barchart_simple.R | 2 +- R/tm_g_ci.R | 2 +- R/tm_g_forest_rsp.R | 2 +- R/tm_g_forest_tte.R | 2 +- R/tm_g_ipp.R | 2 +- R/tm_g_km.R | 2 +- R/tm_g_lineplot.R | 2 +- R/tm_g_pp_adverse_events.R | 2 +- R/tm_g_pp_patient_timeline.R | 2 +- R/tm_g_pp_therapy.R | 2 +- R/tm_g_pp_vitals.R | 2 +- R/tm_t_abnormality.R | 2 +- R/tm_t_abnormality_by_worst_grade.R | 2 +- R/tm_t_ancova.R | 2 +- R/tm_t_binary_outcome.R | 2 +- R/tm_t_coxreg.R | 2 +- R/tm_t_events.R | 2 +- R/tm_t_events_by_grade.R | 2 +- R/tm_t_events_patyear.R | 2 +- R/tm_t_events_summary.R | 2 +- R/tm_t_exposure.R | 2 +- R/tm_t_logistic.R | 2 +- R/tm_t_mult_events.R | 2 +- R/tm_t_pp_basic_info.R | 2 +- R/tm_t_pp_laboratory.R | 2 +- R/tm_t_pp_medical_history.R | 2 +- R/tm_t_pp_prior_medication.R | 2 +- R/tm_t_shift_by_arm.R | 2 +- R/tm_t_shift_by_arm_by_worst.R | 2 +- R/tm_t_shift_by_grade.R | 2 +- R/tm_t_smq.R | 2 +- R/tm_t_summary.R | 2 +- R/tm_t_summary_by.R | 2 +- R/tm_t_tte.R | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/R/tm_a_gee.R b/R/tm_a_gee.R index 290f6c522e..6eb01c6369 100644 --- a/R/tm_a_gee.R +++ b/R/tm_a_gee.R @@ -550,7 +550,7 @@ srv_gee <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Generalized Estimating Equations (GEE) Analysis Table", label = label, with_filter = with_filter, diff --git a/R/tm_a_mmrm.R b/R/tm_a_mmrm.R index 2e37b4bcb9..d9233c77af 100644 --- a/R/tm_a_mmrm.R +++ b/R/tm_a_mmrm.R @@ -1432,7 +1432,7 @@ srv_mmrm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Mixed Model Repeated Measurements (MMRM) Analysis", label = label, description = paste( diff --git a/R/tm_g_barchart_simple.R b/R/tm_g_barchart_simple.R index ea5fc6fdb6..694dea558e 100644 --- a/R/tm_g_barchart_simple.R +++ b/R/tm_g_barchart_simple.R @@ -539,7 +539,7 @@ srv_g_barchart_simple <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Barchart Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_ci.R b/R/tm_g_ci.R index bb0304965d..cb57deb980 100644 --- a/R/tm_g_ci.R +++ b/R/tm_g_ci.R @@ -484,7 +484,7 @@ srv_g_ci <- function(id, # nolint ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "CI Plot", label = label, description = "Confidence Interval Plot", diff --git a/R/tm_g_forest_rsp.R b/R/tm_g_forest_rsp.R index 2bff2b4fa1..dfeef940db 100644 --- a/R/tm_g_forest_rsp.R +++ b/R/tm_g_forest_rsp.R @@ -719,7 +719,7 @@ srv_g_forest_rsp <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Forest Response Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_forest_tte.R b/R/tm_g_forest_tte.R index 57e2ac8605..8431e9ef84 100644 --- a/R/tm_g_forest_tte.R +++ b/R/tm_g_forest_tte.R @@ -653,7 +653,7 @@ srv_g_forest_tte <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Forest Survival Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_ipp.R b/R/tm_g_ipp.R index 407a26cae1..2574428a0b 100644 --- a/R/tm_g_ipp.R +++ b/R/tm_g_ipp.R @@ -612,7 +612,7 @@ srv_g_ipp <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Individual Patient Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_km.R b/R/tm_g_km.R index ab5ccbc858..ca63aa616a 100644 --- a/R/tm_g_km.R +++ b/R/tm_g_km.R @@ -774,7 +774,7 @@ srv_g_km <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Kaplan Meier Plot", label = label, description = "Non-parametric method used to estimate the survival function from lifetime data", diff --git a/R/tm_g_lineplot.R b/R/tm_g_lineplot.R index fff1cc7318..412fad84da 100644 --- a/R/tm_g_lineplot.R +++ b/R/tm_g_lineplot.R @@ -649,7 +649,7 @@ srv_g_lineplot <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Line Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_pp_adverse_events.R b/R/tm_g_pp_adverse_events.R index bc6aed558a..d9cddf552e 100644 --- a/R/tm_g_pp_adverse_events.R +++ b/R/tm_g_pp_adverse_events.R @@ -576,7 +576,7 @@ srv_g_adverse_events <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Patient Profile Adverse Events Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_pp_patient_timeline.R b/R/tm_g_pp_patient_timeline.R index 5ee99fc02d..e5ea5aef86 100644 --- a/R/tm_g_pp_patient_timeline.R +++ b/R/tm_g_pp_patient_timeline.R @@ -897,7 +897,7 @@ srv_g_patient_timeline <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Patient Profile Timeline Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_pp_therapy.R b/R/tm_g_pp_therapy.R index c9a278a96c..a2e0bd9538 100644 --- a/R/tm_g_pp_therapy.R +++ b/R/tm_g_pp_therapy.R @@ -697,7 +697,7 @@ srv_g_therapy <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Patient Profile Therapy", label = label, with_filter = with_filter, diff --git a/R/tm_g_pp_vitals.R b/R/tm_g_pp_vitals.R index 668707d81f..1e9f9e8b16 100644 --- a/R/tm_g_pp_vitals.R +++ b/R/tm_g_pp_vitals.R @@ -529,7 +529,7 @@ srv_g_vitals <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Patient Profile Vitals Plot", label = label, with_filter = with_filter, diff --git a/R/tm_t_abnormality.R b/R/tm_t_abnormality.R index 709fd0afe9..29621bcc37 100644 --- a/R/tm_t_abnormality.R +++ b/R/tm_t_abnormality.R @@ -648,7 +648,7 @@ srv_t_abnormality <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Abnormality Summary Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_abnormality_by_worst_grade.R b/R/tm_t_abnormality_by_worst_grade.R index 1c509cbc5f..60614a994d 100644 --- a/R/tm_t_abnormality_by_worst_grade.R +++ b/R/tm_t_abnormality_by_worst_grade.R @@ -665,7 +665,7 @@ srv_t_abnormality_by_worst_grade <- function(id, # nolint ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Laboratory Test Results Table", label = label, description = "Laboratory test results with highest grade post-baseline Table", diff --git a/R/tm_t_ancova.R b/R/tm_t_ancova.R index f1a5ed51ee..5145e99874 100644 --- a/R/tm_t_ancova.R +++ b/R/tm_t_ancova.R @@ -946,7 +946,7 @@ srv_ancova <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "ANCOVA", label = label, description = "Analysis of Covariance", diff --git a/R/tm_t_binary_outcome.R b/R/tm_t_binary_outcome.R index e84b95d3e5..655be7b2d8 100644 --- a/R/tm_t_binary_outcome.R +++ b/R/tm_t_binary_outcome.R @@ -1009,7 +1009,7 @@ srv_t_binary_outcome <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Binary Outcome Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_coxreg.R b/R/tm_t_coxreg.R index 01736a4bf2..829c7cde56 100644 --- a/R/tm_t_coxreg.R +++ b/R/tm_t_coxreg.R @@ -1063,7 +1063,7 @@ srv_t_coxreg <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Cox Regression Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_events.R b/R/tm_t_events.R index b9f76d9ad7..100806ede9 100644 --- a/R/tm_t_events.R +++ b/R/tm_t_events.R @@ -793,7 +793,7 @@ srv_t_events_byterm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Events by Term Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_events_by_grade.R b/R/tm_t_events_by_grade.R index bed2c71047..1f8e9f088a 100644 --- a/R/tm_t_events_by_grade.R +++ b/R/tm_t_events_by_grade.R @@ -1194,7 +1194,7 @@ srv_t_events_by_grade <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Events by Grade Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_events_patyear.R b/R/tm_t_events_patyear.R index d8f584f442..afbc66196c 100644 --- a/R/tm_t_events_patyear.R +++ b/R/tm_t_events_patyear.R @@ -556,7 +556,7 @@ srv_events_patyear <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Event Rates Adjusted For Patient-Years Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_events_summary.R b/R/tm_t_events_summary.R index ec14585a0d..e22e04ee48 100644 --- a/R/tm_t_events_summary.R +++ b/R/tm_t_events_summary.R @@ -966,7 +966,7 @@ srv_t_events_summary <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Adverse Events Summary Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_exposure.R b/R/tm_t_exposure.R index 06d7fbcfe8..8521f47f1e 100644 --- a/R/tm_t_exposure.R +++ b/R/tm_t_exposure.R @@ -646,7 +646,7 @@ srv_t_exposure <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Exposure for Risk Management Plan Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_logistic.R b/R/tm_t_logistic.R index dd15ef5c37..4379cf1b0d 100644 --- a/R/tm_t_logistic.R +++ b/R/tm_t_logistic.R @@ -716,7 +716,7 @@ srv_t_logistic <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Logistic Regression Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_mult_events.R b/R/tm_t_mult_events.R index 551020d844..1246f271b4 100644 --- a/R/tm_t_mult_events.R +++ b/R/tm_t_mult_events.R @@ -590,7 +590,7 @@ srv_t_mult_events_byterm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Multiple Events by Term Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_pp_basic_info.R b/R/tm_t_pp_basic_info.R index 961cc2b115..f9b8a2c43f 100644 --- a/R/tm_t_pp_basic_info.R +++ b/R/tm_t_pp_basic_info.R @@ -280,7 +280,7 @@ srv_t_basic_info <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Patient Profile Basic Info Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_pp_laboratory.R b/R/tm_t_pp_laboratory.R index 1e7d722cb4..6d62c29651 100644 --- a/R/tm_t_pp_laboratory.R +++ b/R/tm_t_pp_laboratory.R @@ -453,7 +453,7 @@ srv_g_laboratory <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Patient Profile Laboratory Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_pp_medical_history.R b/R/tm_t_pp_medical_history.R index 043a2d8cd5..d342ec1935 100644 --- a/R/tm_t_pp_medical_history.R +++ b/R/tm_t_pp_medical_history.R @@ -343,7 +343,7 @@ srv_t_medical_history <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Patient Medical History Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_pp_prior_medication.R b/R/tm_t_pp_prior_medication.R index cafb7bcf0e..c89730b902 100644 --- a/R/tm_t_pp_prior_medication.R +++ b/R/tm_t_pp_prior_medication.R @@ -345,7 +345,7 @@ srv_t_prior_medication <- function(id, if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Patient Prior Medication Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_shift_by_arm.R b/R/tm_t_shift_by_arm.R index dba0320108..7e66d33f72 100644 --- a/R/tm_t_shift_by_arm.R +++ b/R/tm_t_shift_by_arm.R @@ -529,7 +529,7 @@ srv_shift_by_arm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Shift by Arm Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_shift_by_arm_by_worst.R b/R/tm_t_shift_by_arm_by_worst.R index 97ffba84b3..9365d3a7f0 100644 --- a/R/tm_t_shift_by_arm_by_worst.R +++ b/R/tm_t_shift_by_arm_by_worst.R @@ -567,7 +567,7 @@ srv_shift_by_arm_by_worst <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Shift by Arm by Worst Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_shift_by_grade.R b/R/tm_t_shift_by_grade.R index a732c46e46..be503098b5 100644 --- a/R/tm_t_shift_by_grade.R +++ b/R/tm_t_shift_by_grade.R @@ -887,7 +887,7 @@ srv_t_shift_by_grade <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Grade Summary Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_smq.R b/R/tm_t_smq.R index 04a080164f..0ea6a6d6d0 100644 --- a/R/tm_t_smq.R +++ b/R/tm_t_smq.R @@ -659,7 +659,7 @@ srv_t_smq <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Adverse Events Table by Standardized `MedDRA` Query (SMQ)", label = label, with_filter = with_filter, diff --git a/R/tm_t_summary.R b/R/tm_t_summary.R index 415c51cd34..d26b5c46e0 100644 --- a/R/tm_t_summary.R +++ b/R/tm_t_summary.R @@ -577,7 +577,7 @@ srv_summary <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Summary Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_summary_by.R b/R/tm_t_summary_by.R index 4db6fab7a2..20ebadeb6b 100644 --- a/R/tm_t_summary_by.R +++ b/R/tm_t_summary_by.R @@ -734,7 +734,7 @@ srv_summary_by <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Summarize Variables by Row Groups Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_tte.R b/R/tm_t_tte.R index a0659f06e2..a07e61680b 100644 --- a/R/tm_t_tte.R +++ b/R/tm_t_tte.R @@ -928,7 +928,7 @@ srv_t_tte <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal.reporter::card_template( + card <- teal::card_template( title = "Time To Event Table", label = label, with_filter = with_filter, From 4a7e3618f39a4dc9d6a402b837376ff87de21398 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 12 Oct 2023 15:17:14 +0530 Subject: [PATCH 17/17] renaming to report_card_template --- R/tm_a_gee.R | 2 +- R/tm_a_mmrm.R | 2 +- R/tm_g_barchart_simple.R | 2 +- R/tm_g_ci.R | 2 +- R/tm_g_forest_rsp.R | 2 +- R/tm_g_forest_tte.R | 2 +- R/tm_g_ipp.R | 2 +- R/tm_g_km.R | 2 +- R/tm_g_lineplot.R | 2 +- R/tm_g_pp_adverse_events.R | 2 +- R/tm_g_pp_patient_timeline.R | 2 +- R/tm_g_pp_therapy.R | 2 +- R/tm_g_pp_vitals.R | 2 +- R/tm_t_abnormality.R | 2 +- R/tm_t_abnormality_by_worst_grade.R | 2 +- R/tm_t_ancova.R | 2 +- R/tm_t_binary_outcome.R | 2 +- R/tm_t_coxreg.R | 2 +- R/tm_t_events.R | 2 +- R/tm_t_events_by_grade.R | 2 +- R/tm_t_events_patyear.R | 2 +- R/tm_t_events_summary.R | 2 +- R/tm_t_exposure.R | 2 +- R/tm_t_logistic.R | 2 +- R/tm_t_mult_events.R | 2 +- R/tm_t_pp_basic_info.R | 2 +- R/tm_t_pp_laboratory.R | 2 +- R/tm_t_pp_medical_history.R | 2 +- R/tm_t_pp_prior_medication.R | 2 +- R/tm_t_shift_by_arm.R | 2 +- R/tm_t_shift_by_arm_by_worst.R | 2 +- R/tm_t_shift_by_grade.R | 2 +- R/tm_t_smq.R | 2 +- R/tm_t_summary.R | 2 +- R/tm_t_summary_by.R | 2 +- R/tm_t_tte.R | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/R/tm_a_gee.R b/R/tm_a_gee.R index 6eb01c6369..838da724b4 100644 --- a/R/tm_a_gee.R +++ b/R/tm_a_gee.R @@ -550,7 +550,7 @@ srv_gee <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Generalized Estimating Equations (GEE) Analysis Table", label = label, with_filter = with_filter, diff --git a/R/tm_a_mmrm.R b/R/tm_a_mmrm.R index d9233c77af..d6dc606fc1 100644 --- a/R/tm_a_mmrm.R +++ b/R/tm_a_mmrm.R @@ -1432,7 +1432,7 @@ srv_mmrm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Mixed Model Repeated Measurements (MMRM) Analysis", label = label, description = paste( diff --git a/R/tm_g_barchart_simple.R b/R/tm_g_barchart_simple.R index 694dea558e..5419e8a4fa 100644 --- a/R/tm_g_barchart_simple.R +++ b/R/tm_g_barchart_simple.R @@ -539,7 +539,7 @@ srv_g_barchart_simple <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Barchart Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_ci.R b/R/tm_g_ci.R index cb57deb980..17f69b5d00 100644 --- a/R/tm_g_ci.R +++ b/R/tm_g_ci.R @@ -484,7 +484,7 @@ srv_g_ci <- function(id, # nolint ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "CI Plot", label = label, description = "Confidence Interval Plot", diff --git a/R/tm_g_forest_rsp.R b/R/tm_g_forest_rsp.R index dfeef940db..24f2a5b899 100644 --- a/R/tm_g_forest_rsp.R +++ b/R/tm_g_forest_rsp.R @@ -719,7 +719,7 @@ srv_g_forest_rsp <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Forest Response Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_forest_tte.R b/R/tm_g_forest_tte.R index 8431e9ef84..e87bb051f2 100644 --- a/R/tm_g_forest_tte.R +++ b/R/tm_g_forest_tte.R @@ -653,7 +653,7 @@ srv_g_forest_tte <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Forest Survival Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_ipp.R b/R/tm_g_ipp.R index 2574428a0b..c8e51e2935 100644 --- a/R/tm_g_ipp.R +++ b/R/tm_g_ipp.R @@ -612,7 +612,7 @@ srv_g_ipp <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Individual Patient Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_km.R b/R/tm_g_km.R index ca63aa616a..874f361ced 100644 --- a/R/tm_g_km.R +++ b/R/tm_g_km.R @@ -774,7 +774,7 @@ srv_g_km <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Kaplan Meier Plot", label = label, description = "Non-parametric method used to estimate the survival function from lifetime data", diff --git a/R/tm_g_lineplot.R b/R/tm_g_lineplot.R index 412fad84da..fced62f2a1 100644 --- a/R/tm_g_lineplot.R +++ b/R/tm_g_lineplot.R @@ -649,7 +649,7 @@ srv_g_lineplot <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Line Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_pp_adverse_events.R b/R/tm_g_pp_adverse_events.R index d9cddf552e..bd2243b965 100644 --- a/R/tm_g_pp_adverse_events.R +++ b/R/tm_g_pp_adverse_events.R @@ -576,7 +576,7 @@ srv_g_adverse_events <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Patient Profile Adverse Events Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_pp_patient_timeline.R b/R/tm_g_pp_patient_timeline.R index e5ea5aef86..5655454b56 100644 --- a/R/tm_g_pp_patient_timeline.R +++ b/R/tm_g_pp_patient_timeline.R @@ -897,7 +897,7 @@ srv_g_patient_timeline <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Patient Profile Timeline Plot", label = label, with_filter = with_filter, diff --git a/R/tm_g_pp_therapy.R b/R/tm_g_pp_therapy.R index a2e0bd9538..9617eca52d 100644 --- a/R/tm_g_pp_therapy.R +++ b/R/tm_g_pp_therapy.R @@ -697,7 +697,7 @@ srv_g_therapy <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Patient Profile Therapy", label = label, with_filter = with_filter, diff --git a/R/tm_g_pp_vitals.R b/R/tm_g_pp_vitals.R index 1e9f9e8b16..e092a57afc 100644 --- a/R/tm_g_pp_vitals.R +++ b/R/tm_g_pp_vitals.R @@ -529,7 +529,7 @@ srv_g_vitals <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Patient Profile Vitals Plot", label = label, with_filter = with_filter, diff --git a/R/tm_t_abnormality.R b/R/tm_t_abnormality.R index 29621bcc37..ba732508a4 100644 --- a/R/tm_t_abnormality.R +++ b/R/tm_t_abnormality.R @@ -648,7 +648,7 @@ srv_t_abnormality <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Abnormality Summary Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_abnormality_by_worst_grade.R b/R/tm_t_abnormality_by_worst_grade.R index 60614a994d..e0b4512ee2 100644 --- a/R/tm_t_abnormality_by_worst_grade.R +++ b/R/tm_t_abnormality_by_worst_grade.R @@ -665,7 +665,7 @@ srv_t_abnormality_by_worst_grade <- function(id, # nolint ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Laboratory Test Results Table", label = label, description = "Laboratory test results with highest grade post-baseline Table", diff --git a/R/tm_t_ancova.R b/R/tm_t_ancova.R index 5145e99874..dcc31fb95a 100644 --- a/R/tm_t_ancova.R +++ b/R/tm_t_ancova.R @@ -946,7 +946,7 @@ srv_ancova <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "ANCOVA", label = label, description = "Analysis of Covariance", diff --git a/R/tm_t_binary_outcome.R b/R/tm_t_binary_outcome.R index 655be7b2d8..2ce52bab7d 100644 --- a/R/tm_t_binary_outcome.R +++ b/R/tm_t_binary_outcome.R @@ -1009,7 +1009,7 @@ srv_t_binary_outcome <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Binary Outcome Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_coxreg.R b/R/tm_t_coxreg.R index 829c7cde56..518b1d9654 100644 --- a/R/tm_t_coxreg.R +++ b/R/tm_t_coxreg.R @@ -1063,7 +1063,7 @@ srv_t_coxreg <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Cox Regression Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_events.R b/R/tm_t_events.R index 100806ede9..0eb62ab54e 100644 --- a/R/tm_t_events.R +++ b/R/tm_t_events.R @@ -793,7 +793,7 @@ srv_t_events_byterm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Events by Term Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_events_by_grade.R b/R/tm_t_events_by_grade.R index 1f8e9f088a..bf3e1a6c94 100644 --- a/R/tm_t_events_by_grade.R +++ b/R/tm_t_events_by_grade.R @@ -1194,7 +1194,7 @@ srv_t_events_by_grade <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Events by Grade Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_events_patyear.R b/R/tm_t_events_patyear.R index afbc66196c..1c5c6661ac 100644 --- a/R/tm_t_events_patyear.R +++ b/R/tm_t_events_patyear.R @@ -556,7 +556,7 @@ srv_events_patyear <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Event Rates Adjusted For Patient-Years Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_events_summary.R b/R/tm_t_events_summary.R index e22e04ee48..2a86d6c01a 100644 --- a/R/tm_t_events_summary.R +++ b/R/tm_t_events_summary.R @@ -966,7 +966,7 @@ srv_t_events_summary <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Adverse Events Summary Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_exposure.R b/R/tm_t_exposure.R index 8521f47f1e..ef2b2a3b98 100644 --- a/R/tm_t_exposure.R +++ b/R/tm_t_exposure.R @@ -646,7 +646,7 @@ srv_t_exposure <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Exposure for Risk Management Plan Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_logistic.R b/R/tm_t_logistic.R index 4379cf1b0d..8afbde897e 100644 --- a/R/tm_t_logistic.R +++ b/R/tm_t_logistic.R @@ -716,7 +716,7 @@ srv_t_logistic <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Logistic Regression Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_mult_events.R b/R/tm_t_mult_events.R index 1246f271b4..809a0b7d50 100644 --- a/R/tm_t_mult_events.R +++ b/R/tm_t_mult_events.R @@ -590,7 +590,7 @@ srv_t_mult_events_byterm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Multiple Events by Term Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_pp_basic_info.R b/R/tm_t_pp_basic_info.R index f9b8a2c43f..d9e45950cb 100644 --- a/R/tm_t_pp_basic_info.R +++ b/R/tm_t_pp_basic_info.R @@ -280,7 +280,7 @@ srv_t_basic_info <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Patient Profile Basic Info Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_pp_laboratory.R b/R/tm_t_pp_laboratory.R index 6d62c29651..1773bd1d72 100644 --- a/R/tm_t_pp_laboratory.R +++ b/R/tm_t_pp_laboratory.R @@ -453,7 +453,7 @@ srv_g_laboratory <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Patient Profile Laboratory Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_pp_medical_history.R b/R/tm_t_pp_medical_history.R index d342ec1935..2fa4ca639f 100644 --- a/R/tm_t_pp_medical_history.R +++ b/R/tm_t_pp_medical_history.R @@ -343,7 +343,7 @@ srv_t_medical_history <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Patient Medical History Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_pp_prior_medication.R b/R/tm_t_pp_prior_medication.R index c89730b902..8e009acbfc 100644 --- a/R/tm_t_pp_prior_medication.R +++ b/R/tm_t_pp_prior_medication.R @@ -345,7 +345,7 @@ srv_t_prior_medication <- function(id, if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Patient Prior Medication Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_shift_by_arm.R b/R/tm_t_shift_by_arm.R index 7e66d33f72..ab78b47ea2 100644 --- a/R/tm_t_shift_by_arm.R +++ b/R/tm_t_shift_by_arm.R @@ -529,7 +529,7 @@ srv_shift_by_arm <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Shift by Arm Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_shift_by_arm_by_worst.R b/R/tm_t_shift_by_arm_by_worst.R index 9365d3a7f0..403a13b22e 100644 --- a/R/tm_t_shift_by_arm_by_worst.R +++ b/R/tm_t_shift_by_arm_by_worst.R @@ -567,7 +567,7 @@ srv_shift_by_arm_by_worst <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Shift by Arm by Worst Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_shift_by_grade.R b/R/tm_t_shift_by_grade.R index be503098b5..79bc855906 100644 --- a/R/tm_t_shift_by_grade.R +++ b/R/tm_t_shift_by_grade.R @@ -887,7 +887,7 @@ srv_t_shift_by_grade <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Grade Summary Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_smq.R b/R/tm_t_smq.R index 0ea6a6d6d0..6f787dc92f 100644 --- a/R/tm_t_smq.R +++ b/R/tm_t_smq.R @@ -659,7 +659,7 @@ srv_t_smq <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Adverse Events Table by Standardized `MedDRA` Query (SMQ)", label = label, with_filter = with_filter, diff --git a/R/tm_t_summary.R b/R/tm_t_summary.R index d26b5c46e0..37a9fabc45 100644 --- a/R/tm_t_summary.R +++ b/R/tm_t_summary.R @@ -577,7 +577,7 @@ srv_summary <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Summary Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_summary_by.R b/R/tm_t_summary_by.R index 20ebadeb6b..88c4a7ad96 100644 --- a/R/tm_t_summary_by.R +++ b/R/tm_t_summary_by.R @@ -734,7 +734,7 @@ srv_summary_by <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Summarize Variables by Row Groups Table", label = label, with_filter = with_filter, diff --git a/R/tm_t_tte.R b/R/tm_t_tte.R index a07e61680b..40d8bd0dc7 100644 --- a/R/tm_t_tte.R +++ b/R/tm_t_tte.R @@ -928,7 +928,7 @@ srv_t_tte <- function(id, ### REPORTER if (with_reporter) { card_fun <- function(comment, label) { - card <- teal::card_template( + card <- teal::report_card_template( title = "Time To Event Table", label = label, with_filter = with_filter,