R/check_ae_death_ds_discon.R
check_ae_death_ds_discon.Rd
This checks that if death is indicated in AE via AEDTHDTC/AESDTH/AEOUT (as well as grade 5 AE if AETOXGR exists) then there should be a study discontinuation record indicated by DS.DSSCAT
check_ae_death_ds_discon(AE, DS, preproc = identity, ...)
boolean value if check failed or passed with 'msg' attribute if the test failed
AE <- data.frame(
STUDYID = rep(1,6),
USUBJID = 1:6,
AEDTHDTC = c(NA,"2020-01-01",NA,NA,NA,NA),
AESDTH = c(NA,NA,"Y",NA,NA,NA),
AEOUT = c(NA,NA,NA,"FATAL",NA,NA),
AETOXGR = c(NA,NA,NA,NA,"5",NA),
AESPID="FORMNAME-R:2/L:2XXXX"
)
DS <- data.frame(
STUDYID = 1,
USUBJID = 1:3,
DSCAT="DISPOSITION EVENT",
DSSCAT=c("STUDY DISCON",
"STUDY DISCON",
"STUDY COMPLETION/EARLY DISCONTINUATION")
)
check_ae_death_ds_discon(AE,DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) where AE data indicates death but no study discontinuation record in DS. "
#> attr(,"data")
#> USUBJID DSSCAT DSCAT AEDTHDTC AETOXGR AESDTH AEOUT
#> 1 4 <NA> <NA> <NA> <NA> <NA> FATAL
#> 2 5 <NA> <NA> <NA> 5 <NA> <NA>
check_ae_death_ds_discon(AE,DS,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) where AE data indicates death but no study discontinuation record in DS. "
#> attr(,"data")
#> USUBJID DSSCAT DSCAT AEDTHDTC AETOXGR AESDTH AEOUT RAVE
#> 1 4 <NA> <NA> <NA> <NA> <NA> FATAL FORMNAME-R:2
#> 2 5 <NA> <NA> <NA> 5 <NA> <NA> FORMNAME-R:2
DS$DSSCAT = NULL
check_ae_death_ds_discon(AE,DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS is missing the variable: DSSCAT"