This check looks for AE dates that occur after death date

check_ae_aestdtc_after_dd(AE, DS, preproc = identity, ...)

Arguments

AE

Adverse Event SDTM dataset with variables USUBJID, AEDTHDTC, AESTDTC, AEDECOD, AETERM, AESPID (optional)

DS

Disposition SDTM dataset with variables USUBJID, DSSTDTC, DSDECOD, DSTERM, DSSPID (optional)

preproc

An optional company specific preprocessing script

...

Other arguments passed to methods

Value

Boolean value for whether the check passed or failed, with 'msg' attribute if the check failed

Author

Nina Ting Qi

Examples


AE <- data.frame(STUDYID = 1:5, USUBJID = LETTERS[1:5],
                 AEDTHDTC = c(rep("", 4), "2016-01-01"),
                 AESTDTC = rep("2016-01-01", 5),
                 AEDECOD = c("","", rep("Myocarditis",3)),
                 AETERM = c("INJURY", rep("MYOCARDITIS", 4)),
                 AESPID = "FORMNAME-R:19/L:19XXXX",
                 stringsAsFactors = FALSE)

DS <- data.frame(STUDYID = 1:5, USUBJID = LETTERS[1:5],
                 DSSTDTC = rep("2016-01-02", 5),
                 DSDECOD = c(LETTERS[1:4], "death"),
                 DSSPID = "XXX-R:0",
                 DSTERM = letters[1:5],
                 stringsAsFactors = FALSE)

check_ae_aestdtc_after_dd(AE,DS)
#> [1] TRUE

AE$AESTDTC[1] <- "2016-01-03"
AE$USUBJID[1] <- AE$USUBJID[5]

check_ae_aestdtc_after_dd(AE, DS,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 patient(s) with AE occurring after death date. "
#> attr(,"data")
#>   USUBJID AETERM    AESTDTC   AEDTHDTC       RAVE.AE RAVE.DS    DSSTDTC
#> 1       E INJURY 2016-01-03 2016-01-01 FORMNAME-R:19 XXX-R:0 2016-01-02
#>   EARLIEST_DTHDTC
#> 1      2016-01-01

AE$AESPID <- NULL
check_ae_aestdtc_after_dd(AE, DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 patient(s) with AE occurring after death date. "
#> attr(,"data")
#>   USUBJID AETERM    AESTDTC   AEDTHDTC    DSSTDTC EARLIEST_DTHDTC
#> 1       E INJURY 2016-01-03 2016-01-01 2016-01-02      2016-01-01

DS$DSSPID <- NULL
check_ae_aestdtc_after_dd(AE, DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 patient(s) with AE occurring after death date. "
#> attr(,"data")
#>   USUBJID AETERM    AESTDTC   AEDTHDTC    DSSTDTC EARLIEST_DTHDTC
#> 1       E INJURY 2016-01-03 2016-01-01 2016-01-02      2016-01-01

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