This check identifies records where the same date RSDTC occurs across multiple visits. Only applies to assessments by investigator, selected based on uppercased RSEVAL = "INVESTIGATOR" or missing or RSEVAL variable does not exist.

check_rs_rsdtc_across_visit(RS, preproc = identity, ...)

Arguments

RS

Disease Response SDTM dataset with variables USUBJID, RSDTC, VISIT, RSEVAL (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

Author

Will Harris

Examples


# example that will be flagged
RS <- data.frame(
USUBJID = 1,
RSDTC = c(rep("2016-01-01",3), rep("2016-06-01",5), rep("2016-06-24",2)),
VISIT = c(rep("C1D1",3), rep("C1D2",3), rep("C2D1",4)),
RSSPID = "FORMNAME-R:13/L:13XXXX",
stringsAsFactors=FALSE)

check_rs_rsdtc_across_visit(RS)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 records with same date at >1 visit. "
#> attr(,"data")
#>   USUBJID      RSDTC VISIT
#> 1       1 2016-06-01  C1D2
#> 2       1 2016-06-01  C2D1
check_rs_rsdtc_across_visit(RS, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 records with same date at >1 visit. "
#> attr(,"data")
#>   USUBJID      RSDTC VISIT          RAVE
#> 1       1 2016-06-01  C1D2 FORMNAME-R:13
#> 2       1 2016-06-01  C2D1 FORMNAME-R:13

# example that will not be flagged because not Investigator
RS0 <- RS
RS0$RSEVAL <- "INDEPENDENT ASSESSOR"
check_rs_rsdtc_across_visit(RS0)
#> [1] TRUE
check_rs_rsdtc_across_visit(RS0, preproc=roche_derive_rave_row)
#> [1] TRUE

# example with log line differences in Rave form with records flagged
RS1 <- RS
RS1$RSSPID = c(rep("FORMNAME-R:13/L:13XXXX",4), 
rep("FORMNAME-R:13/L:14XXXX",2), 
rep("FORMNAME-R:03/L:13XXXX",2),
 rep("FORMNAME-R:9/L:13XXXX", 2))
 
check_rs_rsdtc_across_visit(RS1)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 records with same date at >1 visit. "
#> attr(,"data")
#>   USUBJID      RSDTC VISIT
#> 1       1 2016-06-01  C1D2
#> 2       1 2016-06-01  C2D1
check_rs_rsdtc_across_visit(RS1, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 records with same date at >1 visit. "
#> attr(,"data")
#>   USUBJID      RSDTC VISIT          RAVE
#> 1       1 2016-06-01  C1D2 FORMNAME-R:13
#> 2       1 2016-06-01  C2D1 FORMNAME-R:03

# example with RSTESTCD with records flagged
RS2 <- RS1
RS2$RSTESTCD = c(rep("OVRLRESP", 2), rep("OTHER", 2), 
   rep("OVRLRESP", 2), rep("OTHER", 2), rep("OVRLRESP", 2))
check_rs_rsdtc_across_visit(RS2)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 records with same date at >1 visit. "
#> attr(,"data")
#>   USUBJID      RSDTC VISIT RSTESTCD
#> 1       1 2016-06-01  C1D2    OTHER
#> 2       1 2016-06-01  C1D2 OVRLRESP
#> 3       1 2016-06-01  C2D1    OTHER
check_rs_rsdtc_across_visit(RS2, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 records with same date at >1 visit. "
#> attr(,"data")
#>   USUBJID      RSDTC VISIT RSTESTCD          RAVE
#> 1       1 2016-06-01  C1D2    OTHER FORMNAME-R:13
#> 2       1 2016-06-01  C1D2 OVRLRESP FORMNAME-R:13
#> 3       1 2016-06-01  C2D1    OTHER FORMNAME-R:03

# example with records flagged without xxSPID
RS3 <- RS
RS3$RSSPID <- NULL
check_rs_rsdtc_across_visit(RS3)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 records with same date at >1 visit. "
#> attr(,"data")
#>   USUBJID      RSDTC VISIT
#> 1       1 2016-06-01  C1D2
#> 2       1 2016-06-01  C2D1
check_rs_rsdtc_across_visit(RS3, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 records with same date at >1 visit. "
#> attr(,"data")
#>   USUBJID      RSDTC VISIT
#> 1       1 2016-06-01  C1D2
#> 2       1 2016-06-01  C2D1

# example without required variable
RS4 <- RS
RS4$VISIT <- NULL
check_rs_rsdtc_across_visit(RS4)
#> [1] FALSE
#> attr(,"msg")
#> [1] "RS is missing the variable: VISIT"
check_rs_rsdtc_across_visit(RS4, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "RS is missing the variable: VISIT"