This checks that when death is indicated in DM with either of DTHFL or DTHDTC then there should be death indicated in either AE or DS.

check_dm_ae_ds_death(DM, DS, AE)

Arguments

DM

Demographics SDTM dataset with variables USUBJID, DTHFL, DTHDTC

DS

Disposition SDTM dataset with variables USUBJID, DSDECOD, DSSTDTC

AE

Adverse Events SDTM dataset with variables USUBJID, AEDTHDTC, AESDTH, AEOUT

Value

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

Author

Sara Bodach

Examples


AE <- data.frame(
 STUDYID = 1,
 USUBJID = 1:3,
 AEDTHDTC = c(NA,1,NA),
 AESDTH = c(NA,"Y",NA),
 AEOUT = c(NA,"FATAL",NA),
 AETOXGR = c(NA,"5",NA)
)

DS <- data.frame(
 STUDYID = 1,
 USUBJID = 1:3,
 DSDECOD = c(NA,"DEATH",NA),
 DSSTDTC = c(NA,"DSDATE",NA)
)

DM <- data.frame(
 STUDYID = 1,
 USUBJID = 1:3,
 DTHFL=c(NA,"Y","Y"),
 DTHDTC = c(NA,"DMDATE","DMDATE")
 )

check_dm_ae_ds_death(DM,DS,AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 patient(s) where DM data indicates death but no record indicating death in DS or AE. "
#> attr(,"data")
#>   USUBJID DTHDTC DTHFL
#> 1       3 DMDATE     Y

DS$DSDECOD = NULL

check_dm_ae_ds_death(DM,DS,AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS is missing the variable: DSDECOD"