Check for missing month when clinical events dates (CESTDTC, CEENDTC, CEDTC) have a known year and day

check_ce_missing_month(CE, preproc = identity, ...)

Arguments

CE

Clinical Events SDTM dataset with variables USUBJID, CETERM, and at least one of the following date variables: CESTDTC, CEENDTC, CEDTC

preproc

An optional company specific preprocessing script

...

Other arguments passed to methods

Value

boolean value if check failed or passed with 'msg' attribute if the test failed

Author

Ryan Marinelli

Examples


CE <- data.frame(
 USUBJID = c(1, 2, 3, 4),
 CETERM = c("Headache", "Nausea", "Dizziness", "Fever"),
 CESTDTC = c("2023---01", "2023-01-15", "2023-02-01", "2023-02-10"),
 CEENDTC = c("2023-01-02", "2023---01", "2023-02-02", "2023-02-12"),
 CEDTC = c("2023--01", "", "", ""),
 CESEV = c("Mild", "Moderate", "Mild", "Severe"),
 CESPID = "FORMNAME-R:13/L:13XXXX",
 stringsAsFactors=FALSE
 )

check_ce_missing_month(CE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) with a clinical events date that has year and day present but missing month. "
#> attr(,"data")
#>   USUBJID   CETERM    CESTDTC    CEENDTC    CEDTC
#> 1       1 Headache  2023---01 2023-01-02 2023--01
#> 2       2   Nausea 2023-01-15  2023---01         
check_ce_missing_month(CE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) with a clinical events date that has year and day present but missing month. "
#> attr(,"data")
#>   USUBJID   CETERM    CESTDTC    CEENDTC    CEDTC          RAVE
#> 1       1 Headache  2023---01 2023-01-02 2023--01 FORMNAME-R:13
#> 2       2   Nausea 2023-01-15  2023---01          FORMNAME-R:13

CE <- data.frame(
 USUBJID = c(1, 2, 3, 4),
 CETERM = c("Headache", "Nausea", "Dizziness", "Fever"),
 CESTDTC = c("2023-01-01", "2023-01-15", "2023-02-01", "2023-02-10"),
 CEENDTC = c("2023-01-02", "2023-01-16", "2023-02-02", "2023-02-12"),
 CEENDTC = "",
 CESEV = c("Mild", "Moderate", "Mild", "Severe"),
 CESPID = "FORMNAME-R:13/L:13XXXX",
 stringsAsFactors=FALSE
 )

check_ce_missing_month(CE)
#> [1] TRUE

CE$CETERM = NULL

check_ce_missing_month(CE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "CE is missing the variable: CETERM"