R/check_ts_sstdtc_ds_consent.R
check_ts_sstdtc_ds_consent.Rd
This check looks for missing SSTDTC (Study Start Date) in TS; if it's present, check that the date matches the earliest informed consent among any subject enrolled in the study. The FDA Technical Rejection Criteria for Study Data - effective September 15, 2021 requires Study Start Date (https://www.fda.gov/media/100743/download). If missing, no data queries are needed - this would be updating the assignment in the TS domain.
check_ts_sstdtc_ds_consent(DS, TS)
boolean value if check failed or passed with 'msg' attribute if the test failed
TS1 <- data.frame(
STUDYID = 1,
TSPARMCD = "SSTDTC",
TSPARM = "Study Start Date",
TSVAL = "2017-01-01",
TSVAL1 = "",
TSVAL2 = ""
)
TS2 <- data.frame(
STUDYID = 2,
TSPARMCD = "AEDICT",
TSPARM = "Study Start Date",
TSVAL = "MedDRA v23.0",
TSVAL1 = ""
)
TS3 <- data.frame(
STUDYID = 3,
TSPARMCD = "SSTDTC",
TSPARM = "Study Start Date",
TSVAL = ""
)
TS4 <- data.frame(
STUDYID = 1,
TSPARMCD = "SSTDTC",
TSPARM = "Study Start Date",
TSVAL = "2020-01-02",
TSVAL1 = "",
TSVAL2 = ""
)
TS5 = rbind(TS1, TS4)
TS6 <- data.frame(
STUDYID = 1,
TSPARMCD = "SSTDTC",
TSPARM = "Study Start Date",
TSVAL = "2020-01",
TSVAL1 = "",
TSVAL2 = ""
)
DS1 <- data.frame(
USUBJID = c(1,1,2,3,4),
DSCAT = rep("PROTOCOL MILESTONE", 5),
DSSCAT = rep("PROTOCOL MILESTONE", 5),
DSDECOD = c("INFORMED CONSENT OBTAINED", "OTHER", "PHYSICIAN DECISION",
"OTHER", "INFORMED CONSENT OBTAINED"),
DSSTDTC = c("2021-01-01", "2021-01-02", "2021-01-02", "2021-01-02", "2020-01-02"),
stringsAsFactors = FALSE
)
check_ts_sstdtc_ds_consent(DS=DS1, TS=TS1)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TS.TSPARMCD = 'SSTDTC' (Study Start Date) has TS.TSVAL that does not match earliest informed consent date based on DS. TS with Study Start Date required for FDA submissions. "
#> attr(,"data")
#> TSPARMCD TSPARM TSVAL DS_FIRST_ICDATE
#> 1 SSTDTC Study Start Date 2017-01-01 2020-01-02
check_ts_sstdtc_ds_consent(DS=DS1, TS=TS2)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TS.TSPARMCD = 'SSTDTC' (Study Start Date), which is required for FDA submissions, not found. Date in TSVAL should correspond with earliest informed consent date of enrolled patient. "
check_ts_sstdtc_ds_consent(DS=DS1, TS=TS3)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TS.TSPARMCD = 'SSTDTC' (Study Start Date) has missing TS.TSVAL (yyyy-mm-dd) character date. TS with Study Start Date required for FDA submissions. "
#> attr(,"data")
#> TSPARMCD TSPARM TSVAL DS_FIRST_ICDATE
#> 1 SSTDTC Study Start Date 2020-01-02
check_ts_sstdtc_ds_consent(DS=DS1, TS=TS4)
#> [1] TRUE
check_ts_sstdtc_ds_consent(DS=DS1, TS=TS5)
#> [1] FALSE
#> attr(,"msg")
#> [1] "Multiple records with TS.TSPARMCD = 'SSTDTC' (Study Start Date) found when only one expected. TS with Study Start Date required for FDA submissions. "
#> attr(,"data")
#> TSPARMCD TSPARM TSVAL DS_FIRST_ICDATE
#> 1 SSTDTC Study Start Date 2017-01-01 2020-01-02
#> 2 SSTDTC Study Start Date 2020-01-02 2020-01-02
check_ts_sstdtc_ds_consent(DS=DS1, TS=TS6)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TS.TSPARMCD = 'SSTDTC' (Study Start Date) is missing complete TS.TSVAL (yyyy-mm-dd) character date. TS with Study Start Date required for FDA submissions. "
#> attr(,"data")
#> TSPARMCD TSPARM TSVAL DS_FIRST_ICDATE
#> 1 SSTDTC Study Start Date 2020-01 2020-01-02