Check for inconsistency between AE outcome (AEOUT) and AE end date (AEENDTC) for non-fatal AEs (based on AEOUT). AE flagged if AEENDTC not populated when AEOUT is "RECOVERED/RESOLVED", "RECOVERED/RESOLVED WITH SEQUELAE". AE also flagged if AEENDTC is populated when AEOUT is "UNKNOWN", "NOT RECOVERED/NOT RESOLVED", "RECOVERING/RESOLVING".

check_ae_aeout_aeendtc_nonfatal(AE, preproc = identity, ...)

Arguments

AE

Adverse Events SDTM dataset with variables USUBJID, AETERM, AESTDTC, AEENDTC, AEOUT

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

Jennifer Lomax

Examples


AE <- data.frame(
USUBJID = 1:10,
AETERM  = "AE",
AESTDTC = c(NA, "NA", "2015-03-09", "2010-10", "2017-01-20",   "1999-11-02",
        "",     NA,                   "2017-08-20",          "2014-12-01"),
AEENDTC = c(NA, "NA", "2015-03-12", "2010-10", "2017-01-22",   "1999-11-07",
        "",     NA,                   "2017-09-01",          "2015-01-01"),
AEOUT   = c("", "",   "",           "",        "NOT RECOVERED",
"RECOVERED/RESOLVED","FATAL","RECOVERED/RESOLVED", "RECOVERING/RESOLVING","UNKNOWN"),
AESPID  = "FORMNAME-R:13/L:13XXXX",
stringsAsFactors = FALSE
)

check_ae_aeout_aeendtc_nonfatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 non-fatal AE(s) with inconsistent AEENDTC and AEOUT found. "
#> attr(,"data")
#>   USUBJID AETERM    AESTDTC    AEENDTC                AEOUT
#> 1       8     AE       <NA>       <NA>   RECOVERED/RESOLVED
#> 2       9     AE 2017-08-20 2017-09-01 RECOVERING/RESOLVING
#> 3      10     AE 2014-12-01 2015-01-01              UNKNOWN
check_ae_aeout_aeendtc_nonfatal(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 non-fatal AE(s) with inconsistent AEENDTC and AEOUT found. "
#> attr(,"data")
#>   USUBJID AETERM    AESTDTC    AEENDTC                AEOUT          RAVE
#> 1       8     AE       <NA>       <NA>   RECOVERED/RESOLVED FORMNAME-R:13
#> 2       9     AE 2017-08-20 2017-09-01 RECOVERING/RESOLVING FORMNAME-R:13
#> 3      10     AE 2014-12-01 2015-01-01              UNKNOWN FORMNAME-R:13

AE$AEENDTC <- NULL
check_ae_aeout_aeendtc_nonfatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variable: AEENDTC"

AE$AEOUT <- NULL
check_ae_aeout_aeendtc_nonfatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variables: AEENDTC, AEOUT"