This check compares death date in AE AEDTHDT with death date in DS DSSTDTC. It is expected that they are the same.

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

Arguments

AE

Adverse Events SDTM dataset with variables USUBJID and AEDTHDTC

DS

Disposition SDTM dataset with variables USUBJID, DSDECOD, DSSTDTC

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

Hiral Raval

Examples


AE <- data.frame(
 STUDYID = rep(1, 3),
 USUBJID = 1:3,
 AEDTHDTC = c("2020-01-01","2020-01-02","2020-01-03"),
 AESPID = "FORMNAME-R:19/L:19XXXX"
)

DS <- data.frame(
 STUDYID = rep(1, 3),
 USUBJID = 1:3,
 DSDECOD = rep("DEATH", 3),
 DSSTDTC = c("2020-01-01","2020-01-02","2020-01-03"),
 DSSPID = "XXX-R:0",
 stringsAsFactors = FALSE
)

# no case
check_dd_ae_aedthdtc_ds_dsstdtc(AE, DS)
#> [1] TRUE

# 1 case
DS[3, "DSSTDTC"] <- "2000-01-01"
check_dd_ae_aedthdtc_ds_dsstdtc(AE, DS, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 1 patients with a death date different in DS and AE. "
#> attr(,"data")
#>   USUBJID    DSSTDTC   AEDTHDTC RAVE.DS       RAVE.AE
#> 3       3 2000-01-01 2020-01-03 XXX-R:0 FORMNAME-R:19

# check for non existence of vars
DS$DSDECOD <- NULL
DS$DSSTDTC <- NULL
check_dd_ae_aedthdtc_ds_dsstdtc(AE, DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS is missing the variables: DSDECOD, DSSTDTC"