R/check_dd_death_date.R
check_dd_death_date.Rd
Flag if patient has a Death in AE (i.e. AE record with non-missing AE.AEDTHDTC) but no Death in DS (i.e. record where DS.DSDECOD=DEATH and DS.DSTERM contains 'DEATH' and does not contain 'PROGRESSIVE DISEASE' or 'DISEASE RELAPSE' (so we can pick up records where DSTERM in 'DEATH','DEATH DUE TO ...' and exclude 'DEATH DUE TO PROGRESSIVE DISEASE', 'DEATH DUE TO DISEASE RELAPSE')
check_dd_death_date(AE, DS, preproc = identity, ...)
Adverse Events SDTM dataset with USUBJID, AEDTHDTC, AESPID (optional)
Disposition SDTM dataset with USUBJID, DSDECOD, DSTERM
An optional company specific preprocessing script
Other arguments passed to methods
AE <- data.frame(
USUBJID = 1:5,
AEDTHDTC = c("2018-01-01", "2018-01-02", "2018-01-03","2018-01-04", ""),
AESPID="FORMNAME-R:13/L:13XXXX",
stringsAsFactors = FALSE
)
DS <- data.frame(
USUBJID = c(1,1,2,3,3,4),
DSTERM=c("DEATH","RANDOM THING","ADVERSE EVENT",
"DEATH DUE TO PROGRESSIVE DISEASE","ADVERSE EVENT",
"DEATH DUE TO ABC"),
DSDECOD=c("DEATH","ADVERSE EVENT","DEATH", "DEATH","OTHER", "DEATH"),
stringsAsFactors=FALSE
)
check_dd_death_date(AE,DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) with a death date in AE but death not reflected properly in DS. "
#> attr(,"data")
#> USUBJID AEDTHDTC DSTERM DSDECOD
#> 2 2 2018-01-02 <NA> <NA>
#> 3 3 2018-01-03 <NA> <NA>
check_dd_death_date(AE,DS,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) with a death date in AE but death not reflected properly in DS. "
#> attr(,"data")
#> USUBJID AEDTHDTC RAVE DSTERM DSDECOD
#> 2 2 2018-01-02 FORMNAME-R:13 <NA> <NA>
#> 3 3 2018-01-03 FORMNAME-R:13 <NA> <NA>