This check looks for consistency in AESDTH, AEDTHDTC, and AETOXGR (if applicable) when AEOUT is 'FATAL'. Note, this check expects AE grade/severity variables to be populated for either all records or none. In a case where both AETOXGR and AESEV exist and some records are supposed to have AETOXGR populated while others have AESEV (ie the two variables are mutually exclusive) then this check will likely return false positives.

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

Arguments

AE

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

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

Aldrich Salva

Examples


# AETOXGR, no AESEV

AE <- data.frame(
 USUBJID = 1:5,
 AESTDTC = "01JAN2017",
 AEDECOD = c("AE1","AE2","AE3","AE4","AE5"),
 AEOUT = "FATAL",
 AEDTHDTC = c("01FEB2017",NA,"02FEB2017","03FEB2017",NA),
 AESDTH = c("Y","Y","N","Y",NA),
 AETOXGR = c("5","5","5",NA,NA),
 AESPID = "FORMNAME-R:12/L:2XXXX",
 stringsAsFactors = FALSE
)

check_ae_fatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 4 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH AETOXGR
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y       5
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N       5
#> 3       4 01JAN2017     AE4 FATAL 03FEB2017      Y    <NA>
#> 4       5 01JAN2017     AE5 FATAL      <NA>   <NA>    <NA>
check_ae_fatal(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 4 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH AETOXGR          RAVE
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y       5 FORMNAME-R:12
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N       5 FORMNAME-R:12
#> 3       4 01JAN2017     AE4 FATAL 03FEB2017      Y    <NA> FORMNAME-R:12
#> 4       5 01JAN2017     AE5 FATAL      <NA>   <NA>    <NA> FORMNAME-R:12

AE$AETOXGR <- NULL
check_ae_fatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 3 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N
#> 3       5 01JAN2017     AE5 FATAL      <NA>   <NA>

AE$AEDECOD <- NULL
check_ae_fatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE is missing the variable: AEDECOD"


# AESEV, no AETOXGR

 AE <- data.frame(
 USUBJID = 1:5,
 AESTDTC = "01JAN2017",
 AEDECOD = c("AE1","AE2","AE3","AE4","AE5"),
 AEOUT = "FATAL",
 AEDTHDTC = c("01FEB2017","02FEB2017","03FEB2017","04FEB2017",NA),
 AESDTH = c("Y","Y","N","Y",NA),
 AESEV = c("SEVERE","MILD","SEVERE",NA,NA),
 AESPID = "FORMNAME-R:12/L:2XXXX",
 stringsAsFactors = FALSE
)

check_ae_fatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 3 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH  AESEV
#> 1       2 01JAN2017     AE2 FATAL 02FEB2017      Y   MILD
#> 2       3 01JAN2017     AE3 FATAL 03FEB2017      N SEVERE
#> 3       5 01JAN2017     AE5 FATAL      <NA>   <NA>   <NA>
check_ae_fatal(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 3 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH  AESEV          RAVE
#> 1       2 01JAN2017     AE2 FATAL 02FEB2017      Y   MILD FORMNAME-R:12
#> 2       3 01JAN2017     AE3 FATAL 03FEB2017      N SEVERE FORMNAME-R:12
#> 3       5 01JAN2017     AE5 FATAL      <NA>   <NA>   <NA> FORMNAME-R:12

AE$AESEV <- NULL
check_ae_fatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 2 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH
#> 1       3 01JAN2017     AE3 FATAL 03FEB2017      N
#> 2       5 01JAN2017     AE5 FATAL      <NA>   <NA>

# Both AESEV and AETOXGR have non-missing values

AE <- data.frame(
 USUBJID = 1:7,
 AESTDTC = "01JAN2017",
 AEDECOD = c("AE1","AE2","AE3","AE4","AE5","AE6","AE7"),
 AEOUT = "FATAL",
 AEDTHDTC = c("01FEB2017",NA,"02FEB2017","03FEB2017",NA,"04FEB2017","05FEB2017"),
 AESDTH = c("Y","Y","N","Y",NA,"Y","Y"),
 AESEV = c("SEVERE","MILD","SEVERE",NA,NA,"MILD","SEVERE"),
 AETOXGR = c("5","5","5",NA,NA,"1","5"),
 AESPID = "FORMNAME-R:12/L:2XXXX",
 stringsAsFactors = FALSE
)

check_ae_fatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 5 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH  AESEV AETOXGR
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y   MILD       5
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N SEVERE       5
#> 3       4 01JAN2017     AE4 FATAL 03FEB2017      Y   <NA>    <NA>
#> 4       5 01JAN2017     AE5 FATAL      <NA>   <NA>   <NA>    <NA>
#> 5       6 01JAN2017     AE6 FATAL 04FEB2017      Y   MILD       1
check_ae_fatal(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 5 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH  AESEV AETOXGR          RAVE
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y   MILD       5 FORMNAME-R:12
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N SEVERE       5 FORMNAME-R:12
#> 3       4 01JAN2017     AE4 FATAL 03FEB2017      Y   <NA>    <NA> FORMNAME-R:12
#> 4       5 01JAN2017     AE5 FATAL      <NA>   <NA>   <NA>    <NA> FORMNAME-R:12
#> 5       6 01JAN2017     AE6 FATAL 04FEB2017      Y   MILD       1 FORMNAME-R:12


# Neither AESEV or AETOXGR

AE <- data.frame(
 USUBJID = 1:5,
 AESTDTC = "01JAN2017",
 AEDECOD = c("AE1","AE2","AE3","AE4","AE5"),
 AEOUT = "FATAL",
 AEDTHDTC = c("01FEB2017",NA,"02FEB2017","03FEB2017",NA),
 AESDTH = c("Y","Y","N","Y",NA),
 AESPID = "FORMNAME-R:12/L:2XXXX",
 stringsAsFactors = FALSE
)

check_ae_fatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 3 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N
#> 3       5 01JAN2017     AE5 FATAL      <NA>   <NA>

# AETOXGR exists but unmapped AESEV

 AE <- data.frame(
 USUBJID = 1:5,
 AESTDTC = "01JAN2017",
 AEDECOD = c("AE1","AE2","AE3","AE4","AE5"),
 AEOUT = "FATAL",
 AEDTHDTC = c("01FEB2017",NA,"02FEB2017","03FEB2017",NA),
 AESDTH = c("Y","Y","N","Y",NA),
 AESEV = rep(NA,5),
 AETOXGR = c("5","5","5",NA,NA),
 AESPID = "FORMNAME-R:12/L:2XXXX",
 stringsAsFactors = FALSE
)

check_ae_fatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 4 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH AESEV AETOXGR
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y    NA       5
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N    NA       5
#> 3       4 01JAN2017     AE4 FATAL 03FEB2017      Y    NA    <NA>
#> 4       5 01JAN2017     AE5 FATAL      <NA>   <NA>    NA    <NA>
check_ae_fatal(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 4 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH AESEV AETOXGR          RAVE
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y    NA       5 FORMNAME-R:12
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N    NA       5 FORMNAME-R:12
#> 3       4 01JAN2017     AE4 FATAL 03FEB2017      Y    NA    <NA> FORMNAME-R:12
#> 4       5 01JAN2017     AE5 FATAL      <NA>   <NA>    NA    <NA> FORMNAME-R:12

# AETOXGR and AESEV exist, by both are unmapped

 AE <- data.frame(
 USUBJID = 1:5,
 AESTDTC = "01JAN2017",
 AEDECOD = c("AE1","AE2","AE3","AE4","AE5"),
 AEOUT = "FATAL",
 AEDTHDTC = c("01FEB2017",NA,"02FEB2017","03FEB2017",NA),
 AESDTH = c("Y","Y","N","Y",NA),
 AESEV = NA,
 AETOXGR = NA,
 AESPID = "FORMNAME-R:12/L:2XXXX",
 stringsAsFactors = FALSE
)

check_ae_fatal(AE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 3 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH AESEV AETOXGR
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y    NA      NA
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N    NA      NA
#> 3       5 01JAN2017     AE5 FATAL      <NA>   <NA>    NA      NA
check_ae_fatal(AE,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "AE has 3 patient(s) with AE death variable inconsistencies when outcome marked FATAL. "
#> attr(,"data")
#>   USUBJID   AESTDTC AEDECOD AEOUT  AEDTHDTC AESDTH AESEV AETOXGR          RAVE
#> 1       2 01JAN2017     AE2 FATAL      <NA>      Y    NA      NA FORMNAME-R:12
#> 2       3 01JAN2017     AE3 FATAL 02FEB2017      N    NA      NA FORMNAME-R:12
#> 3       5 01JAN2017     AE5 FATAL      <NA>   <NA>    NA      NA FORMNAME-R:12