This ophthalmology check looks for any mismatch between the Derived Best Corrected Visual Acuity (BCVA) Total Score & reported Total BCVA Score from Data based on OETESTCD = "LOGSCORE" for older studies or OETESTCD = "VACSCORE" for newer studies

check_oe_bcva_tot_mismatch(OE)

Arguments

OE

Ophtho Dataset with variables USUBJID, OETESTCD, OECAT, OESCAT, OETSTDTL, OESTRESN, OESTAT (if present), OELAT, VISIT, OEDTC

Value

boolean value if check failed or passed with 'msg' attribute if the test failed

Author

Monarch Shah (HackR 2021 Team Eye)

Examples


#Using Old Standard, FAIL Case (4m <=19, so 4m + 1m to match with Rave Total)
OE <- data.frame(
   USUBJID = 1,
   OETESTCD = c("NUMLCOR", "NUMLCOR", "LCORCON", "LOGSCORE"),
   OECAT   = rep("BEST CORRECTED VISUAL ACUITY", 4),
   OESCAT   = c("TOTAL", "TOTAL","", ""),
   OETSTDTL  = c("TESTING DISTANCE: 4M", "TESTING DISTANCE: 1M", "", ""),
   OESTRESN = c(18, 0, 30, 48),
   OESTAT= rep("", 4),
   OELOC   = rep("EYE", 4),
   OELAT   = rep("LEFT", 4),
   VISIT   = rep("SCREENING", 4),
   VISITNUM   = rep(99, 4),
   OEDTC = rep("2021-05-19", 4),
   OEDY  = rep(1, 4),
   stringsAsFactors = FALSE)

check_oe_bcva_tot_mismatch(OE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with BCVA Total Score Derived and from RAVE/eCRF with mismatch. "
#> attr(,"data")
#>   USUBJID OELAT     VISIT      OEDTC TOT_4M TOT_1M PARTB_CONST BCVATOT_CRF
#> 1       1  LEFT SCREENING 2021-05-19     18      0          30          48
#>   BCVATOT_DERIVED
#> 1              18


#Using New Standard, PASS Case

OE <- data.frame(
   USUBJID = 1,
   OETESTCD = c("NUMLCOR", "NUMLCOR", "LCORCON", "VACSCORE"),
   OECAT   = rep("BEST CORRECTED VISUAL ACUITY", 4),
   OESCAT   = c("NORMAL LIGHTING SCORE", "NORMAL LIGHTING SCORE","", ""),
   OETSTDTL  = c("TESTING DISTANCE: 4M", "TESTING DISTANCE: 1M", "", ""),
   OESTRESN = c(22, 0, 30, 52),
   OESTAT= rep("", 4),
   OELOC   = rep("EYE", 4),
   OELAT   = rep("LEFT", 4),
   VISIT   = rep("SCREENING", 4),
   VISITNUM   = rep(99, 4),
   OEDTC = rep("2021-05-19", 4),
   OEDY  = rep(1, 4),
   stringsAsFactors = FALSE)
check_oe_bcva_tot_mismatch(OE)
#> [1] TRUE


#Using New Standard, FAIL Case (Total 4m + 1m (As 4m <=19) not equal to CRF Total Score)

OE <- data.frame(
   USUBJID = 1,
   OETESTCD = c("NUMLCOR", "NUMLCOR", "LCORCON", "VACSCORE"),
   OECAT   = "BEST CORRECTED VISUAL ACUITY",
   OESCAT   = c("NORMAL LIGHTING SCORE", "NORMAL LIGHTING SCORE","", ""),
   OETSTDTL  = c("TESTING DISTANCE: 4M", "TESTING DISTANCE: 1M", "", ""),
   OESTRESN = c(17, 12, 0, 27),
   OESTAT= "",
   OELOC   = "EYE",
   OELAT   = "LEFT",
   VISIT   = "SCREENING",
   VISITNUM   = 99,
   OEDTC = "2021-05-19",
   OEDY  = 1,
   stringsAtors = FALSE)
check_oe_bcva_tot_mismatch(OE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with BCVA Total Score Derived and from RAVE/eCRF with mismatch. "
#> attr(,"data")
#>   USUBJID OELAT     VISIT      OEDTC TOT_4M TOT_1M PARTB_CONST BCVATOT_CRF
#> 1       1  LEFT SCREENING 2021-05-19     17     12           0          27
#>   BCVATOT_DERIVED
#> 1              29


#FAIL Case without optional variable, OESTAT

OE$OESTAT <- NULL
check_oe_bcva_tot_mismatch(OE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 record(s) with BCVA Total Score Derived and from RAVE/eCRF with mismatch. "
#> attr(,"data")
#>   USUBJID OELAT     VISIT      OEDTC TOT_4M TOT_1M PARTB_CONST BCVATOT_CRF
#> 1       1  LEFT SCREENING 2021-05-19     17     12           0          27
#>   BCVATOT_DERIVED
#> 1              29


#missing required variable, OETESTCD

OE$OETESTCD <- NULL
check_oe_bcva_tot_mismatch(OE)
#> [1] FALSE
#> attr(,"msg")
#> [1] "OE is missing the variable: OETESTCD"