R/check_ae_aeacnoth_ds_stddisc_covid.R
check_ae_aeacnoth_ds_stddisc_covid.Rd
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")
)
boolean value if check failed or passed with 'msg' attribute if the test failed
Other COVID:
check_ae_aeacn_ds_disctx_covid()
,
check_dv_ae_aedecod_covid()
,
check_dv_covid()
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