From 500b8f1980003cac028a8c1682c91d69c017e06f Mon Sep 17 00:00:00 2001 From: m7pr Date: Wed, 27 Sep 2023 12:59:29 +0200 Subject: [PATCH] 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()) }