If a patient has a DV record indicating COVID-19 then they should also have COVID-related AE where AE.AEDECOD matches covid.REFTERM.

check_dv_ae_aedecod_covid(
  AE,
  DV,
  covid_terms = c("COVID-19", "CORONAVIRUS POSITIVE")
)

Arguments

AE

Adverse Events SDTM dataset with variables USUBJID, AEDECOD

DV

Protocol Deviation SDTM dataset with variables USUBJID, DVREAS

covid_terms

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

Value

boolean value if check returns 0 obs, otherwise return subset dataframe.

Author

Natalie Springfield

Examples


AE <- data.frame(
 USUBJID = 1:6,
 AEDECOD = c("pandemic", "covid-19","some AE","some AE","CORONAVIRUS POSITIVE","UNMAPPED")
)

DV <- data.frame(
 USUBJID = 1:6,
 DVREAS=c("SUSPECTED EPIDEMIC/PANDEMIC INFECTION",
          "UNKNOWN",
          "SUSPECTED EPIDEMIC/PANDEMIC INFECTION",
          "OTHER",
          "SUSPECTED EPIDEMIC/PANDEMIC INFECTION",
          "SUSPECTED EPIDEMIC/PANDEMIC INFECTION")
)

check_dv_ae_aedecod_covid(AE,DV)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Found 3 patient(s) with COVID-related Protocol Deviation, but no AE record with COVID terms.  Default terms used for identifying Covid AEs: COVID-19,CORONAVIRUS POSITIVE"
#> attr(,"data")
#>   USUBJID                                DVREAS AEDECOD
#> 1       1 SUSPECTED EPIDEMIC/PANDEMIC INFECTION    <NA>
#> 2       3 SUSPECTED EPIDEMIC/PANDEMIC INFECTION    <NA>
#> 4       6 SUSPECTED EPIDEMIC/PANDEMIC INFECTION    <NA>


# Pass specific covid terms

check_dv_ae_aedecod_covid(AE,DV,covid_terms=c("COVID-19", "CORONAVIRUS POSITIVE","PANDEMIC"))
#> [1] FALSE
#> attr(,"msg")
#> [1] "Found 2 patient(s) with COVID-related Protocol Deviation, but no AE record with COVID terms.  "
#> attr(,"data")
#>   USUBJID                                DVREAS AEDECOD
#> 2       3 SUSPECTED EPIDEMIC/PANDEMIC INFECTION    <NA>
#> 4       6 SUSPECTED EPIDEMIC/PANDEMIC INFECTION    <NA>