This check assesses observations where PRCAT contains the word OCULAR and flags records with missing/inconsistent laterality

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

Arguments

PR

Procedure/Surgery Dataset for Ophtho Study with variables USUBJID, PRCAT, PRLAT, PRTRT, PROCCUR, PRPRESP, PRSPID (if Present), PRSTDTC (if Present), PRINDC (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) Monarch Shah (Added Concurrent Ocular Procedure in this check) (copied from check_cm_cmlat)

Examples


PR <- data.frame(
   USUBJID = 1:5,
   PRCAT = "PRIOR OCULAR SURGERIES AND PROCEDURES",
   PRSTDTC = 1:5,
   PRLAT   = c("Left", "","Bilateral", "", ""),
   PRTRT   = c("A", "B", "A", "B", "A"),
   PROCCUR = c("Y", "N", "N", "Y", "Y"),
   PRPRESP = "Y",
   PRSPID  = "FORMNAME-R:2/L:2XXXX",
   stringsAsFactors = FALSE)
check_pr_prlat(PR,preproc=roche_derive_rave_row)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with PRLAT Missing from records with PRCAT containing the word OCULAR when expected to be populated. "
#> attr(,"data")
#>   USUBJID                                 PRCAT PRSTDTC         RAVE PRLAT
#> 1       4 PRIOR OCULAR SURGERIES AND PROCEDURES       4 FORMNAME-R:2      
#> 2       5 PRIOR OCULAR SURGERIES AND PROCEDURES       5 FORMNAME-R:2      
#>   PRTRT
#> 1     B
#> 2     A

PR <- data.frame(
   USUBJID = 1:5,
   PRCAT = "CONCURRENT OCULAR PROCEDURE",
   PRSTDTC = 1:5,
   PRLAT   = c("Left", "LEFT","Bilateral", "RIGHT", "RIgHT"),
   PRTRT  = c("A", "B", "A", "B", "A"),
   PROCCUR = NA,
   PRPRESP = NA,
   stringsAsFactors = FALSE)
check_pr_prlat(PR)
#> [1] TRUE

PR <- data.frame(
   USUBJID = 1:5,
   PRCAT = "CONCURRENT OCULAR PROCEDURE",
   PRSTDTC = 1:5,
   PRLAT   = c("Left", "LEFT","Bilateral", "RIGHT", ""),
   PRTRT  = c("A", "B", "A", "B", "A"),
   PROCCUR = NA,
   PRPRESP = NA,
   stringsAsFactors = FALSE)
check_pr_prlat(PR)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with PRLAT Missing from records with PRCAT containing the word OCULAR when expected to be populated. "
#> attr(,"data")
#>   USUBJID                       PRCAT PRSTDTC PRLAT PRTRT
#> 1       5 CONCURRENT OCULAR PROCEDURE       5           A

PR <- data.frame(
   USUBJID = 1:5,
   PRCAT = "CONCURRENT OCULAR PROCEDURE",
   PRSTDTC = 1:5,
   PRLAT   = c("Left", "","Bilateral", "RIGHT", ""),
   PRTRT  = c("A", "B", "A", "B", "A"),
   PROCCUR = c("Y", "N", "N", "Y", "Y"),
   PRPRESP = "Y",
   stringsAsFactors = FALSE)
check_pr_prlat(PR)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with PRLAT Missing from records with PRCAT containing the word OCULAR when expected to be populated. "
#> attr(,"data")
#>   USUBJID                       PRCAT PRSTDTC PRLAT PRTRT
#> 1       5 CONCURRENT OCULAR PROCEDURE       5           A

PR <- data.frame(
   USUBJID = 1:5,
   PRCAT = c(rep("CONCURRENT NON-OCULAR PROCEDURE",3),rep("CONCURRENT OCULAR PROCEDURE",2)),
   PRSTDTC = 1:5,
   PRLAT   = c("", "","", "RIGHT", ""),
   PRTRT  = c("A", "B", "A", "B", "A"),
   PROCCUR = c("Y", "N", "N", "Y", "Y"),
   PRPRESP = "Y",
   stringsAsFactors = FALSE)
check_pr_prlat(PR)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with PRLAT Missing from records with PRCAT containing the word OCULAR when expected to be populated. "
#> attr(,"data")
#>   USUBJID                       PRCAT PRSTDTC PRLAT PRTRT
#> 1       5 CONCURRENT OCULAR PROCEDURE       5           A