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

check_tu_tudtc_across_visit(TU, preproc = identity, ...)

Arguments

TU

Tumor Identification SDTM dataset with variables USUBJID, TUDTC, VISIT, TUEVAL (optional), TUTESTCD (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


# records flagged 
TU <- data.frame(USUBJID = 1,
                 TUDTC = 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)),
                 TUSPID = "FORMNAME-R:13/L:13XXXX",
                 stringsAsFactors=FALSE)

check_tu_tudtc_across_visit(TU)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 TU records where the same date occurs accross multiple visits. "
#> attr(,"data")
#>   USUBJID      TUDTC VISIT
#> 1       1 2016-06-01  C1D2
#> 2       1 2016-06-01  C2D1
check_tu_tudtc_across_visit(TU, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 TU records where the same date occurs accross multiple visits. "
#> attr(,"data")
#>   USUBJID      TUDTC VISIT          RAVE
#> 1       1 2016-06-01  C1D2 FORMNAME-R:13
#> 2       1 2016-06-01  C2D1 FORMNAME-R:13

# no records flagged because non-Investigator results
TU2 <- TU
TU2$TUEVAL <- "INDEPENDENT ASSESSOR"

check_tu_tudtc_across_visit(TU2)
#> [1] TRUE
check_tu_tudtc_across_visit(TU2, preproc=roche_derive_rave_row)
#> [1] TRUE

# example with TUTESTCD and with records flagged
TU3 <- TU
TU3$TUTESTCD = c(rep("TUMIDENT", 2), rep("OTHER", 2), 
   rep("TUMIDENT", 2), rep("OTHER", 2), rep("TUMIDENT", 2))
check_tu_tudtc_across_visit(TU3)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 3 TU records where the same date occurs accross multiple visits. "
#> attr(,"data")
#>   USUBJID      TUDTC VISIT TUTESTCD
#> 1       1 2016-06-01  C1D2    OTHER
#> 2       1 2016-06-01  C1D2 TUMIDENT
#> 3       1 2016-06-01  C2D1    OTHER
check_tu_tudtc_across_visit(TU3, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 3 TU records where the same date occurs accross multiple visits. "
#> attr(,"data")
#>   USUBJID      TUDTC VISIT TUTESTCD          RAVE
#> 1       1 2016-06-01  C1D2    OTHER FORMNAME-R:13
#> 2       1 2016-06-01  C1D2 TUMIDENT FORMNAME-R:13
#> 3       1 2016-06-01  C2D1    OTHER FORMNAME-R:13


# example without TUSPID and with records flagged
TU4 <- TU
TU4$TUSPID <- NULL

check_tu_tudtc_across_visit(TU4)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 TU records where the same date occurs accross multiple visits. "
#> attr(,"data")
#>   USUBJID      TUDTC VISIT
#> 1       1 2016-06-01  C1D2
#> 2       1 2016-06-01  C2D1
check_tu_tudtc_across_visit(TU4, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "There are 2 TU records where the same date occurs accross multiple visits. "
#> attr(,"data")
#>   USUBJID      TUDTC VISIT
#> 1       1 2016-06-01  C1D2
#> 2       1 2016-06-01  C2D1

# example with required variable missing
TU5 <- TU
TU5$VISIT <- NULL

check_tu_tudtc_across_visit(TU5)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TU is missing the variable: VISIT"
check_tu_tudtc_across_visit(TU5, preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TU is missing the variable: VISIT"