This check looks for partial missing dates in PR Procedures start date and end date, if end date exists. If the day of the month is known, the month should be known.

check_pr_missing_month(PR, preproc = identity, ...)

Arguments

PR

Procedures SDTM dataset with variables USUBJID, PRTRT, PRSTDTC, PRENDTC (optional), PRSPID (optional)

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

Examples


PR <- data.frame(
 USUBJID = 1:3,
 PRTRT = c("Surgery Name","Procedure Name","Procedure"),
 PRSTDTC = c("2017-01-01","2017---01","2017-01-02"),
 PRENDTC = c("2017-02-01","2017-03-01","2017---01"),
 PRSPID = "/F:SURG-D:12345-R:1",
 PRCAT = "Form 1",
 stringsAsFactors=FALSE
)

check_pr_missing_month(PR)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) with a PR procedure date with known year and day but unknown month. "
#> attr(,"data")
#>   USUBJID          PRTRT    PRSTDTC    PRENDTC
#> 1       2 Procedure Name  2017---01 2017-03-01
#> 2       3      Procedure 2017-01-02  2017---01

check_pr_missing_month(PR,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 patient(s) with a PR procedure date with known year and day but unknown month. "
#> attr(,"data")
#>   USUBJID          PRTRT    PRSTDTC    PRENDTC   RAVE
#> 1       2 Procedure Name  2017---01 2017-03-01 SURG#1
#> 2       3      Procedure 2017-01-02  2017---01 SURG#1

PR$PRENDTC = NULL
check_pr_missing_month(PR)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 patient(s) with a PR procedure date with known year and day but unknown month. "
#> attr(,"data")
#>   USUBJID          PRTRT   PRSTDTC
#> 1       2 Procedure Name 2017---01