This check looks for AE death dates if AEOUT='FATAL' and for the reverse, i.e if there is an AE death date, then AEOUT should have the value "FATAL".

check_dd_ae_aeout_aedthdtc(AE, preproc = identity, ...)

Arguments

AE

Adverse Events SDTM dataset with variables USUBJID, AEDTHDTC, AEDECOD, AESTDTC and AEOUT

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

Joel Laxamana

Examples


AE <- data.frame(
 USUBJID = 1:3,
 AEDTHDTC = c("2020-01-01","2020-01-02","2020-01-03"),
 AEDECOD = 1:3,
 AESTDTC = 1:3,
 AEOUT = rep("FATAL", 3),
 AESPID = "FORMNAME-R:19/L:19XXXX",
 stringsAsFactors = FALSE
)

# pass
check_dd_ae_aeout_aedthdtc(AE)
#> [1] TRUE

# fail - 1 case (AEDTHDTC not populated but AEOUT == FATAL)
AE1 <- AE
AE1[3, "AEDTHDTC"] <- NA
check_dd_ae_aeout_aedthdtc(AE1)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC AEDTHDTC AEOUT
#> 3       3       3       3     <NA> FATAL
check_dd_ae_aeout_aedthdtc(AE1,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC AEDTHDTC AEOUT          RAVE
#> 3       3       3       3     <NA> FATAL FORMNAME-R:19

# pass -- even though AEDTHDTC populated 
AE2 <- AE
AE2[1, "AEOUT"] <- NA
check_dd_ae_aeout_aedthdtc(AE2)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC   AEDTHDTC AEOUT
#> 1       1       1       1 2020-01-01  <NA>
check_dd_ae_aeout_aedthdtc(AE2,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC   AEDTHDTC AEOUT          RAVE
#> 1       1       1       1 2020-01-01  <NA> FORMNAME-R:19

# 2 cases 
AE[3, "AEDTHDTC"] <- NA
AE[1, "AEOUT"] <- NA
check_dd_ae_aeout_aedthdtc(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC   AEDTHDTC AEOUT
#> 1       1       1       1 2020-01-01  <NA>
#> 3       3       3       3       <NA> FATAL
check_dd_ae_aeout_aedthdtc(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC   AEDTHDTC AEOUT          RAVE
#> 1       1       1       1 2020-01-01  <NA> FORMNAME-R:19
#> 3       3       3       3       <NA> FATAL FORMNAME-R:19

# 2 cases 
AE[1, "AEOUT"] <- 'NOT RECOVERED/NOT RESOLVED'
check_dd_ae_aeout_aedthdtc(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC   AEDTHDTC                      AEOUT
#> 1       1       1       1 2020-01-01 NOT RECOVERED/NOT RESOLVED
#> 3       3       3       3       <NA>                      FATAL
check_dd_ae_aeout_aedthdtc(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC   AEDTHDTC                      AEOUT          RAVE
#> 1       1       1       1 2020-01-01 NOT RECOVERED/NOT RESOLVED FORMNAME-R:19
#> 3       3       3       3       <NA>                      FATAL FORMNAME-R:19

# non-critical variable missing
AE$AESPID <- NULL
check_dd_ae_aeout_aedthdtc(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC   AEDTHDTC                      AEOUT
#> 1       1       1       1 2020-01-01 NOT RECOVERED/NOT RESOLVED
#> 3       3       3       3       <NA>                      FATAL
check_dd_ae_aeout_aedthdtc(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with a discrepant AE outcome and AE death date. "
#> attr(,"data")
#>   USUBJID AEDECOD AESTDTC   AEDTHDTC                      AEOUT
#> 1       1       1       1 2020-01-01 NOT RECOVERED/NOT RESOLVED
#> 3       3       3       3       <NA>                      FATAL

# critical variables are missing
AE$AEDTHDTC <- NULL
AE$USUBJID <- NULL
check_dd_ae_aeout_aedthdtc(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variables: USUBJID, AEDTHDTC"
check_dd_ae_aeout_aedthdtc(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variables: USUBJID, AEDTHDTC"