If a patient has a record where DS.DSDECOD == DEATH they should also have a Study Discon Record

check_ds_dsdecod_death(DS, preproc = identity, ...)

Arguments

DS

Disposition domain with variables USUBJID, DSDECOD, DSSCAT, and optional variables DSCAT, DSSTDTC, DSSPID

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

Sara Bodach and Will Harris

Examples


DS <- data.frame(
 STUDYID = 1,
 USUBJID = 1:3,
 DSDECOD = c(NA,"DEATH",NA),
 DSSTDTC = c(NA,"DSDATE",NA),
 DSCAT = c('DISPOSITION EVENT', 'DISPOSITION EVENT', 'OTHER'),
 DSSCAT = c('STUDY COMPLETION/EARLY DISCONTINUATION',
            'TREATMENT DISCONTINUATION',
            'STUDY TREATMENT'),
 DSOTH = 1:3,
 DSSPID = "XXX-R:0",
 stringsAsFactors=FALSE
 )

check_ds_dsdecod_death(DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) for 1 unique patient(s) with DSDECOD='DEATH' but no record with DSSCAT indicating STUDY DISCONTINUATION. "
#> attr(,"data")
#>   USUBJID DSDECOD             DSCAT DSSTDTC
#> 1       2   DEATH DISPOSITION EVENT  DSDATE
check_ds_dsdecod_death(DS,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) for 1 unique patient(s) with DSDECOD='DEATH' but no record with DSSCAT indicating STUDY DISCONTINUATION. "
#> attr(,"data")
#>   USUBJID DSDECOD             DSCAT DSSTDTC    RAVE
#> 1       2   DEATH DISPOSITION EVENT  DSDATE XXX-R:0

DS$DSSCAT[2] <- "STUDY COMPLETION/EARLY DISCONTINUATION"
check_ds_dsdecod_death(DS)
#> [1] TRUE

DS$DSDECOD = NULL
check_ds_dsdecod_death(DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "DS is missing the variable: DSDECOD"