Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

758 improve null report #759

Merged
merged 8 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ LazyData: true
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Collate:
'report_null.R'
'utils.R'
'chevron_tlg-S4class.R'
'ael01_nollt.R'
Expand Down
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ export(mng01)
export(mng01_main)
export(mng01_pre)
export(nocoding)
export(null_listing)
export(null_report)
export(outcome_rule)
export(pdt01)
Expand Down Expand Up @@ -210,6 +209,7 @@ export(rspt01_pre)
export(run)
export(script_funs)
export(set_section_div)
export(std_postprocessing)
export(ttet01)
export(ttet01_main)
export(ttet01_post)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

* Add `AEL02`, `AEL03` templates.
* Modify the post processing of `MHT01` to allow multiple `row_split_var`.
* Improve the `report_null` method to facilitate the creation of null reports
* Export the `std_postprocessing` function to simplify post processing logic.

# chevron 0.2.6

Expand Down
18 changes: 1 addition & 17 deletions R/ael01_nollt.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,6 @@ ael01_nollt_pre <- function(adam_db,
adam_db
}

#' @describeIn ael01_nollt Postprocessing
#'
#' @inheritParams gen_args
#' @returns the postprocessing function returns an `rlistings` object or an `ElementaryTable` (null report).
#'
ael01_nollt_post <- function(tlg, ...) {
if (is(tlg, "list")) {
if (length(tlg) == 0) tlg <- null_report
} else {
if (nrow(tlg) == 0) tlg <- null_report
}

tlg
}

#' `AEL01_NOLLT` Listing 1 (Default) Glossary of Preferred Terms and Investigator-Specified Terms.
#'
#' @include chevron_tlg-S4class.R
Expand All @@ -69,6 +54,5 @@ ael01_nollt_post <- function(tlg, ...) {
#' run(ael01_nollt, syn_data)
ael01_nollt <- chevron_l(
main = ael01_nollt_main,
preprocess = ael01_nollt_pre,
postprocess = ael01_nollt_post
preprocess = ael01_nollt_pre
)
2 changes: 1 addition & 1 deletion R/aet01.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ aet01_post <- function(tlg, prune_0 = FALSE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `AET01` Table 1 (Default) Overview of Deaths and Adverse Events Summary Table 1.
Expand Down
2 changes: 1 addition & 1 deletion R/aet01_aesi.R
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ aet01_aesi_post <- function(tlg, prune_0 = FALSE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `AET01_AESI` Table 1 (Default) Adverse Event of Special Interest Summary Table.
Expand Down
2 changes: 1 addition & 1 deletion R/aet02.R
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ aet02_post <- function(tlg, row_split_var = "AEBODSYS", prune_0 = TRUE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `AET02` Table 1 (Default) Adverse Events by System Organ Class and Preferred Term Table 1.
Expand Down
2 changes: 1 addition & 1 deletion R/aet03.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ aet03_post <- function(tlg, prune_0 = TRUE, ...) {
scorefun = cont_n_allcols
)
if (prune_0) tlg <- trim_rows(tlg)
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `AET03` Table 1 (Default) Advert Events by Greatest Intensity Table 1.
Expand Down
2 changes: 1 addition & 1 deletion R/aet04.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ aet04_post <- function(tlg, prune_0 = TRUE, ...) {
tlg <- tlg %>%
tlg_sort_by_vars(c("AEBODSYS", "AEDECOD"), score_all_sum, decreasing = TRUE)
if (prune_0) tlg <- trim_rows(tlg)
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `AET04` Table 1 (Default) Adverse Events by Highest `NCI` `CTACAE` `AE` Grade Table 1.
Expand Down
2 changes: 1 addition & 1 deletion R/aet05.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ aet05_post <- function(tlg, prune_0 = FALSE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `AET05` Table 1 (Default) Adverse Event Rate Adjusted for Patient-Years at Risk - First Occurrence.
Expand Down
2 changes: 1 addition & 1 deletion R/aet10.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ aet10_post <- function(tlg, atleast = 0.05, ...) {
)
)

std_postprocess(tlg_prune)
std_postprocessing(tlg_prune)
}

#' `AET10` Table 1 (Default) Most Common (xx%) Adverse Events Preferred Terms Table 1.
Expand Down
2 changes: 1 addition & 1 deletion R/cfbt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ cfbt01_post <- function(tlg, prune_0 = TRUE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `CFBT01` Change from Baseline By Visit Table.
Expand Down
7 changes: 4 additions & 3 deletions R/chevron_tlg-S4class.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#' @include utils.R
#' @include report_null.R

# Chevron_tlg ----

Expand Down Expand Up @@ -141,7 +142,7 @@ methods::setValidity("chevron_simple", function(object) {
#'
chevron_t <- function(main = function(adam_db, ...) build_table(basic_table(), adam_db[[1]]),
preprocess = function(adam_db, ...) adam_db,
postprocess = report_null,
postprocess = std_postprocessing,
...) {
res <- .chevron_t(
main = main,
Expand All @@ -166,7 +167,7 @@ chevron_t <- function(main = function(adam_db, ...) build_table(basic_table(), a
#'
chevron_l <- function(main = function(adam_db, ...) data.frame(),
preprocess = function(adam_db, ...) adam_db,
postprocess = function(tlg, ...) tlg,
postprocess = std_postprocessing,
...) {
res <- .chevron_l(
main = main,
Expand Down Expand Up @@ -195,7 +196,7 @@ chevron_l <- function(main = function(adam_db, ...) data.frame(),
#'
chevron_g <- function(main = function(adam_db, ...) ggplot2::ggplot(),
preprocess = function(adam_db, ...) adam_db,
postprocess = function(tlg, ...) tlg,
postprocess = std_postprocessing,
...) {
res <- .chevron_g(
main = main,
Expand Down
2 changes: 1 addition & 1 deletion R/cmt01a.R
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ cmt01a_post <- function(
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `CMT01A` Concomitant Medication by Medication Class and Preferred Name.
Expand Down
2 changes: 1 addition & 1 deletion R/coxt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ coxt01_post <- function(tlg, prune_0 = FALSE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `COXT01` (Default) Cox Regression Model Table.
Expand Down
2 changes: 1 addition & 1 deletion R/dmt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ dmt01_post <- function(tlg, prune_0 = TRUE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `DMT01` Table 1 (Default) Demographics and Baseline Characteristics Table 1.
Expand Down
2 changes: 1 addition & 1 deletion R/dst01.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ dst01_post <- function(tlg, prune_0 = TRUE, ...) {
tlg <- tlg %>%
smart_prune()
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' DST01 Table 1 (Default) Patient Disposition Table 1.
Expand Down
2 changes: 1 addition & 1 deletion R/dtht01.R
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ dtht01_post <- function(tlg, prune_0 = TRUE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `DTHT01` Table 1 (Default) Death Table.
Expand Down
2 changes: 1 addition & 1 deletion R/egt02.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ egt02_pre <- function(adam_db, ...) {
#' @export
#'
egt02_post <- function(tlg, ...) {
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `EGT02` ECG Abnormalities Table.
Expand Down
2 changes: 1 addition & 1 deletion R/egt03.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ egt03_pre <- function(adam_db, ...) {
egt03_post <- function(tlg, prune_0 = FALSE, ...) {
if (prune_0) tlg <- smart_prune(tlg)

std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `EGT03` Shift Table of ECG Interval Data - Baseline versus Minimum or Maximum Post-Baseline.
Expand Down
2 changes: 1 addition & 1 deletion R/egt05_qtcat.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ egt05_qtcat_pre <- function(adam_db, ...) {
#'
egt05_qtcat_post <- function(tlg, prune_0 = TRUE, ...) {
if (prune_0) tlg <- smart_prune(tlg)
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `EGT05_QTCAT` ECG Actual Values and Changes from Baseline by Visit Table.
Expand Down
2 changes: 1 addition & 1 deletion R/ext01.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ ext01_pre <- function(adam_db,
#'
ext01_post <- function(tlg, prune_0 = TRUE, ...) {
if (prune_0) tlg <- smart_prune(tlg)
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `EXT01` Exposure Summary Table.
Expand Down
2 changes: 1 addition & 1 deletion R/lbt04.R
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ lbt04_pre <- function(adam_db, ...) {
#' @export
#'
lbt04_post <- function(tlg, ...) {
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `LBT04` Laboratory Abnormalities Not Present at Baseline Table.
Expand Down
2 changes: 1 addition & 1 deletion R/lbt05.R
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ lbt05_post <- function(tlg, prune_0 = FALSE, ...) {
}
}

std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `LBT05` Table 1 (Default) Laboratory Abnormalities with Single and Replicated Marked.
Expand Down
2 changes: 1 addition & 1 deletion R/lbt06.R
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ lbt06_post <- function(tlg, prune_0 = FALSE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `LBT06` Table 1 (Default) Laboratory Abnormalities by Visit and Baseline Status Table 1.
Expand Down
2 changes: 1 addition & 1 deletion R/lbt07.R
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ lbt07_post <- function(tlg, prune_0 = TRUE, ...) {
if (prune_0) {
tlg <- smart_prune(tlg)
}
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `LBT07` Table 1 (Default) Laboratory Test Results and Change from Baseline by Visit.
Expand Down
2 changes: 1 addition & 1 deletion R/lbt14.R
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ lbt14_pre <- function(adam_db,
#'
lbt14_post <- function(tlg, prune_0 = TRUE, ...) {
if (prune_0) tlg <- tlg %>% trim_rows()
std_postprocess(tlg)
std_postprocessing(tlg)
}

#' `LBT14` Laboratory Test Results Shift Table – Highest `NCI-CTCAE` Grade Post-Baseline by
Expand Down
2 changes: 1 addition & 1 deletion R/mht01.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ mht01_post <- function(tlg, row_split_var = "MHBODSYS", prune_0 = TRUE, ...) {
scorefun = score_occurrences
)

std_postprocess(tbl_sorted)
std_postprocessing(tbl_sorted)
}

#' `MHT01` Medical History Table.
Expand Down
2 changes: 1 addition & 1 deletion R/pdt01.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pdt01_post <- function(tlg, prune_0 = TRUE, dvcode_var = "DVDECOD", dvterm_var =
scorefun = score_occurrences
)

std_postprocess(tbl_sorted)
std_postprocessing(tbl_sorted)
}

#' `pdt01` Major Protocol Deviations Table.
Expand Down
2 changes: 1 addition & 1 deletion R/pdt02.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pdt02_post <- function(tlg, prune_0 = TRUE, dvreas_var = "DVREAS", dvterm_var =
scorefun = score_occurrences
)

std_postprocess(tbl_sorted)
std_postprocessing(tbl_sorted)
}

#' `pdt02` Major Protocol Deviations Related to Epidemic/Pandemic Table.
Expand Down
Loading
Loading