This check assesses ocular CMCAT records and flags records with missing/inconsistent laterality

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

Arguments

CM

Concomitant Medications Dataset for Ophtha Study with variables USUBJID, CMCAT, CMLAT, CMTRT, CMSPID (if Present), CMSTDTC (if Present), CMLOC (if Present), CMINDC (if Present), CMDOSFRM (if Present)

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

Tim Barnett (HackR 2021 Team Eye) (copied from check_cm_cmlat)

Examples


CM <- data.frame(
   USUBJID = 1:5,
   CMCAT = "PRIOR OCULAR THERAPIES AND TREATMENTS",
   CMSTDTC = 1:5,
   CMLAT   = c("Left", "","Bilateral", "", ""),
   CMTRT   = c("A", "B", "A", "B", "A"),
   CMDECOD = c("A", "B", "A", "B", "A"),
   CMROUTE = c("","OPHTHALMIC","INTRAVITREAL","INTRAVITREAL", "opHTHALMIC"),
   CMSPID  = "FORMNAME-R:13/L:13XXXX",
   stringsAsFactors = FALSE)
check_cm_cmlat_prior_ocular(CM,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "3 record(s) with CMLAT missing when expected to be populated. "
#> attr(,"data")
#>   CMSTDTC          RAVE CMLAT CMTRT
#> 1       2 FORMNAME-R:13           B
#> 2       4 FORMNAME-R:13           B
#> 3       5 FORMNAME-R:13           A

CM <- data.frame(
   USUBJID = 1:5,
   CMCAT = "Prior Ocular Therapies/Treatments",
   CMSTDTC = 1:5,
   CMLAT   = c("", "LEFT","Bilateral", "", "RIgHT"),
   CMTRT  = c("A", "B", "A", "B", "A"),
   CMDECOD = c("A", "B", "A", "B", "A"),
   #CMROUTE = c("","OPHTHALMIC","INTRAVITREAL","INTRAVITREAL", "opHTHALMIC"),
   stringsAsFactors = FALSE)
check_cm_cmlat_prior_ocular(CM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with CMLAT missing when expected to be populated. "
#> attr(,"data")
#>   CMSTDTC CMLAT CMTRT
#> 1       1           A
#> 2       4           B

CM <- data.frame(
   USUBJID = 1:5,
   CMCAT = "CONCOMITANT MEDICATIONS",
   CMSTDTC = 1:5,
   CMLAT   = c("Left", "LEFT","Bilateral", "RIGHT", "RIgHT"),
   CMTRT  = c("A", "B", "A", "B", "A"),
   CMDECOD = c("A", "B", "A", "B", "A"),
   CMROUTE = c("","OPHTHALMIC","INTRAVITREAL","INTRAVITREAL", "opHTHALMIC"),
   stringsAsFactors = FALSE)
check_cm_cmlat_prior_ocular(CM)
#> [1] TRUE

CM <- data.frame(
   USUBJID = 1:5,
   CMCAT = "CONCOMITANT MEDICATIONS",
   CMSTDTC = 1:5,
   CMLAT   = c("Left", "LEFT","Bilateral", "RIGHT", "RIgHT"),
   CMTRT  = c("A", "B", "A", "B", "A"),
   CMDECOD = c("A", "B", "A", "B", "A"),
   #CMROUTE = c("","OPHTHALMIC","INTRAVITREAL","INTRAVITREAL", "opHTHALMIC"),
   stringsAsFactors = FALSE)
check_cm_cmlat_prior_ocular(CM)
#> [1] TRUE

CM <- data.frame(
   USUBJID = 1:5,
   CMCAT = c(rep("Prior Ocular Therapies/Treatments",3), rep("Non-Ocular Therapies/Treatments",2)),
   CMSTDTC = 1:5,
   CMLAT   = c("", "LEFT","Bilateral", "", ""),
   CMTRT  = c("A", "B", "A", "B", "A"),
   CMDECOD = c("A", "B", "A", "B", "A"),
   #CMROUTE = c("","OPHTHALMIC","INTRAVITREAL","ORAL", "ORAL"),
   stringsAsFactors = FALSE)
check_cm_cmlat_prior_ocular(CM)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with CMLAT missing when expected to be populated. "
#> attr(,"data")
#>   CMSTDTC CMLAT CMTRT
#> 1       1           A