This checks for patients with new lesions in TU (TUSTRESC=='NEW') but no Overall Response assessment of PD (Disease Progression) or PMD (Progressive Metabolic Disease) in RS (i.e., (RSTESTCD=='OVRLRESP' and RSSTRESC %in% c('PD','PMD'))). Only applies to assessments by investigator, if TUEVAL and RSEVAL variables available.

check_tu_rs_new_lesions(RS, TU)

Arguments

RS

Response SDTM dataset with variables USUBJID, RSSTRESC, RSTESTCD

TU

Tumor Identification SDTM dataset with variables USUBJID, TUSTRESC, TUDTC

Value

TRUE if check passed and FALSE if check failed + 'msg' and 'data' attributes

Author

Will Harris

Examples


TU <- data.frame(
 USUBJID = 1:3,
 TUSTRESC = c("INV001","NEW","NEW"),
 TUDTC = "2017-01-01"
)

RS <- data.frame(
 USUBJID = 1:2,
 RSSTRESC = c("SD","NE")
)

# required variable is missing 
check_tu_rs_new_lesions(RS,TU)
#> [1] FALSE
#> attr(,"msg")
#> [1] "RS is missing the variable: RSTESTCD"

RS$RSTESTCD = 'OVRLRESP'

# flag USUBJIDs with NEW 
check_tu_rs_new_lesions(RS,TU)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TU has 2 patient(s) with a new lesion but no Overall Response indicating progression. "
#> attr(,"data")
#>   USUBJID TUSTRESC      TUDTC
#> 1       2      NEW 2017-01-01
#> 2       3      NEW 2017-01-01


RS$RSSTRESC[2] = "PD"

# flag USUBJID with NEW and without PD
check_tu_rs_new_lesions(RS,TU)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TU has 1 patient(s) with a new lesion but no Overall Response indicating progression. "
#> attr(,"data")
#>   USUBJID TUSTRESC      TUDTC
#> 1       3      NEW 2017-01-01
   
# Metabolic response in heme trials
RS$RSSTRESC[2] = "PMD"
check_tu_rs_new_lesions(RS,TU)
#> [1] FALSE
#> attr(,"msg")
#> [1] "TU has 1 patient(s) with a new lesion but no Overall Response indicating progression. "
#> attr(,"data")
#>   USUBJID TUSTRESC      TUDTC
#> 1       3      NEW 2017-01-01


# pass when USUBJIDs with new have PD
RS <- data.frame(
 USUBJID = 1:3,
 RSSTRESC = c("SD","PD", "PD"), 
 RSTESTCD = "OVRLRESP"
)

check_tu_rs_new_lesions(RS,TU)
#> [1] TRUE

TU$TUEVAL = "INDEPENDENT ASSESSOR"

RS$RSEVAL = "INDEPENDENT ASSESSOR"

## pass if by IRF, even if NEW in TU
check_tu_rs_new_lesions(RS,TU)
#> [1] TRUE

RS <- NULL

# required dataset missing 
check_tu_rs_new_lesions(RS,TU)
#> [1] FALSE
#> attr(,"msg")
#> [1] "RS is missing the variables: USUBJID, RSSTRESC, RSTESTCD"