R/check_ae_aeout_aeendtc_aedthdtc.R
check_ae_aeout_aeendtc_aedthdtc.Rd
This check looks for AEs with outcome of 'FATAL' but AE resolution date is not equal to AE death date. Note that these datapoints are not collected the same way for all trials - some trials leave AEENDTC missing if it was unresolved at death date. Confirm within your team before querying this issue.
check_ae_aeout_aeendtc_aedthdtc(AE, preproc = identity, ...)
boolean value if check failed or passed with 'msg' attribute if the test failed
AE <- data.frame(
USUBJID = 1:10,
DOMAIN = "AE",
AEDTHDTC = c(NA, "NA", rep("2015-03-12",4), NA, NA, "2020-01-01", ""),
AEENDTC = c(NA, "NA", rep("2015-03-12",4), NA, "2020-01-01", NA, ""),
AEOUT = c("", "", "","FATAL","RECOVERED/RESOLVED", rep("FATAL",5)),
AETERM = 1:10,
AESPID = "FORMNAME-R:13/L:13XXXX",
stringsAsFactors = FALSE
)
check_ae_aeout_aeendtc_aedthdtc(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 AE(s) with AEOUT = 'FATAL' but AEDTHDTC and AEENDTC inconsistent. "
#> attr(,"data")
#> USUBJID AETERM AEENDTC AEDTHDTC AEOUT NOTE
#> 1 7 7 <NA> <NA> FATAL **QUERY ONLY IF TEAM AGREES**
#> 2 9 9 <NA> 2020-01-01 FATAL **QUERY ONLY IF TEAM AGREES**
#> 3 10 10 FATAL **QUERY ONLY IF TEAM AGREES**
check_ae_aeout_aeendtc_aedthdtc(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 AE(s) with AEOUT = 'FATAL' but AEDTHDTC and AEENDTC inconsistent. "
#> attr(,"data")
#> USUBJID AETERM AEENDTC AEDTHDTC AEOUT RAVE
#> 1 7 7 <NA> <NA> FATAL FORMNAME-R:13
#> 2 9 9 <NA> 2020-01-01 FATAL FORMNAME-R:13
#> 3 10 10 FATAL FORMNAME-R:13
#> NOTE
#> 1 **QUERY ONLY IF TEAM AGREES**
#> 2 **QUERY ONLY IF TEAM AGREES**
#> 3 **QUERY ONLY IF TEAM AGREES**
AE$AESPID <- NULL
check_ae_aeout_aeendtc_aedthdtc(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 AE(s) with AEOUT = 'FATAL' but AEDTHDTC and AEENDTC inconsistent. "
#> attr(,"data")
#> USUBJID AETERM AEENDTC AEDTHDTC AEOUT NOTE
#> 1 7 7 <NA> <NA> FATAL **QUERY ONLY IF TEAM AGREES**
#> 2 9 9 <NA> 2020-01-01 FATAL **QUERY ONLY IF TEAM AGREES**
#> 3 10 10 FATAL **QUERY ONLY IF TEAM AGREES**
AE$AEDTHDTC <- NULL
AE$AEOUT <- NULL
check_ae_aeout_aeendtc_aedthdtc(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variables: AEDTHDTC, AEOUT"