Check for missing month when conmed start (CMSTDTC) or end dates (CMENDTC) have known year and day

check_cm_missing_month(CM, preproc = identity, ...)

Arguments

CM

Concomitant Medications SDTM dataset with variables USUBJID, CMTRT, CMSTDTC, CMENDTC

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

Chandra Mannem

Examples


CM <- data.frame(
 USUBJID = 1:3,
 CMTRT = c("CM1","CM2","CM3"),
 CMSTDTC = c("2017-01-01","2017---01","2017-01-02"),
 CMENDTC = c("2017-02-01","2017-03-01","2017---01"),
 CMSPID = "/F:XXX-D:12345-R:123",
 stringsAsFactors=FALSE
)

check_cm_missing_month(CM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 patients with a conmed date that has year and day present but missing month. "
#> attr(,"data")
#>   USUBJID CMTRT    CMSTDTC    CMENDTC
#> 1       2   CM2  2017---01 2017-03-01
#> 2       3   CM3 2017-01-02  2017---01
check_cm_missing_month(CM,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 patients with a conmed date that has year and day present but missing month. "
#> attr(,"data")
#>   USUBJID CMTRT    CMSTDTC    CMENDTC    RAVE
#> 1       2   CM2  2017---01 2017-03-01 XXX#123
#> 2       3   CM3 2017-01-02  2017---01 XXX#123

CM$CMSTDTC = NULL

check_cm_missing_month(CM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "CM is missing the variable: CMSTDTC"