Flag if patient has a COVID-19 AE where AE.AEDECOD matches a COVID-19 preferred term event action of Study Discontinuation (AE.AEACNOT* includes "DISCONTINUED FROM STUDY") but missing Study Discontinuation record in DS (DS.DSSCAT includes "STUDY" and "DISCON" and excludes "DRUG" and "TREATMENT")

check_ae_aeacnoth_ds_stddisc_covid(
  AE,
  DS,
  covid_terms = c("COVID-19", "CORONAVIRUS POSITIVE")
)

Arguments

AE

Adverse Events SDTM dataset with variables USUBJID, AEDECOD, AEACNOT* (can be multiple variables)

DS

Disposition SDTM dataset with variables USUBJID, DSSCAT, DSDECOD

covid_terms

A length >=1 vector of AE terms identifying COVID-19 (case does not matter)

Value

boolean value if check failed or passed with 'msg' attribute if the test failed

Author

Natalie Springfield

Examples


AE <- data.frame(
 USUBJID = 1:5,
 AEDECOD = c("This is a covid AE", "covid-19", "covid-19","Some AE", "CORONAVIRUS POSITIVE" ),
 AEACNOTH=c("SUBJECT DISCONTINUED FROM STUDY",
            "NONE",
            "NONE", 
            "SUBJECT DISCONTINUED FROM STUDY",
            "NONE"),
 AEACNOTH1=c("SUBJECT DISCONTINUED FROM STUDY", 
             "NONE",
             "SUBJECT DISCONTINUED FROM STUDY",
             "NONE", 
             "SUBJECT DISCONTINUED FROM STUDY"),
 AEACNOTH2=c("SUBJECT DISCONTINUED FROM STUDY", 
             "NONE",
             "NONE",
             "SUBJECT DISCONTINUED FROM STUDY",
             "NONE")
)

DS <- data.frame(
 USUBJID = 1:3,
 DSSCAT=c("TREATMENT DISCONTINUATION", 
 "STUDY DISCONTINUATION",
 "STUDY DISCONTINUATION"),
 DSDECOD="DISCON REASON"
)

#expect fail
check_ae_aeacnoth_ds_stddisc_covid(AE,DS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Found 1 patient(s) with COVID-related AE(s) leading to Study Discon, but no corresponding Study Discon in DS.  Default terms used for identifying Covid AEs: COVID-19,CORONAVIRUS POSITIVE"
#> attr(,"data")
#>   USUBJID              AEDECOD DSDECOD DSSCAT AEACNOTH
#> 2       5 CORONAVIRUS POSITIVE    <NA>   <NA>     NONE
#>                         AEACNOTH1 AEACNOTH2
#> 2 SUBJECT DISCONTINUED FROM STUDY      NONE

#use custom terms for identifying covid AEs
check_ae_aeacnoth_ds_stddisc_covid(
  AE,
  DS,
  covid_terms=c("COVID-19", "CORONAVIRUS POSITIVE","THIS IS A COVID AE")
  )
#> [1] FALSE
#> attr(,"msg")
#> [1] "Found 2 patient(s) with COVID-related AE(s) leading to Study Discon, but no corresponding Study Discon in DS.  "
#> attr(,"data")
#>   USUBJID              AEDECOD DSDECOD DSSCAT                        AEACNOTH
#> 1       1   This is a covid AE    <NA>   <NA> SUBJECT DISCONTINUED FROM STUDY
#> 3       5 CORONAVIRUS POSITIVE    <NA>   <NA>                            NONE
#>                         AEACNOTH1                       AEACNOTH2
#> 1 SUBJECT DISCONTINUED FROM STUDY SUBJECT DISCONTINUED FROM STUDY
#> 3 SUBJECT DISCONTINUED FROM STUDY                            NONE