R/check_oe_bcva_1m_late_early_tot.R
check_oe_bcva_1m_late_early_tot.Rd
This ophthalmology check is for BCVA 1m test. It checks three conditions: <1> BCVA test stops too late, meaning that lines were read after number of correct letters is <= 3. <2> BCVA test stops too early, meaning that further lines were not read when all numbers of correct letters is > 3. <3> BCVA total score is not correct, meaning that the sum of the number of correct at 1 meter doesn't match with what has been recorded in eCRF (BCVA Scores eCRF Page - C. Total number correct at 1m). Please note that this check only works with USUBJID, VISIT, VISITNUM, OELOC, OELAT combination has unique dates (OEDTC). If your datasets are having situations like 1) unscheduled visits happening on different dates or 2) BCVA TOTAL happens on a different date from BCVA row tests, such combinations will be removed from check. Please note that this check excludes forms BCVA Low Vision Test (BCV5), BCVA Scores (BCV7), BCVA Low Luminance Scores (BCVLL5), BCVA Combined Assessments (BCVAC), BCVA Low Luminance Combined Assessments (BCVACLL) before running check as these forms do not include Row numbers.
check_oe_bcva_1m_late_early_tot(OE)
boolean value if check failed or passed with 'msg' attribute if the test failed
OE_too_late <- data.frame(
USUBJID = "1",
OESPID = "FORMNAME-R:2/L:2XXXX",
OECAT = "BEST CORRECTED VISUAL ACUITY",
OETSTDTL = "TESTING DISTANCE: 1M",
OESCAT = c(rep("", 6), "TOTAL"),
OESTAT = "",
OERESCAT = c("ROW 1 - SNELLEN 20/200",
"ROW 2 - SNELLEN 20/160",
"ROW 4 - SNELLEN 20/100",
"ROW 3 - SNELLEN 20/125",
"ROW 5 - SNELLEN 20/80",
"ROW 6 - SNELLEN 20/63",
""),
VISIT = "WEEK 1",
VISITNUM = 5,
OEDTC = "2020-06-01",
OEDY = 8,
OELOC = "EYE",
OELAT = "LEFT",
OESTRESN = c(5, 5, 5, 4, 3, 2, 24)
)
check_oe_bcva_1m_late_early_tot(OE_too_late)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 BCVA 1m test record(s) failed with 1) test stops too late 2) test stops too early 3) total incorrect. "
#> attr(,"data")
#> USUBJID OETSTDTL VISIT OEDTC OELAT OESTRESN TOTAL
#> 1 1 TESTING DISTANCE: 1M WEEK 1 2020-06-01 LEFT 2 NA
#> issue
#> 1 BCVA 1m check stops too late
OE_too_early <- data.frame(
USUBJID = "1",
OESPID = "FORMNAME-R:2/L:2XXXX",
OECAT = "BEST CORRECTED VISUAL ACUITY",
OETSTDTL = "TESTING DISTANCE: 1M",
OESCAT = c(rep("", 5), "TOTAL"),
OESTAT = "",
OERESCAT = c("ROW 1 - SNELLEN 20/200",
"ROW 2 - SNELLEN 20/160",
"ROW 4 - SNELLEN 20/100",
"ROW 3 - SNELLEN 20/125",
"ROW 5 - SNELLEN 20/80",
""),
VISIT = "WEEK 1",
VISITNUM = 5,
OEDTC = "2020-06-01",
OEDY = 8,
OELOC = "EYE",
OELAT = "LEFT",
OESTRESN = c(5, 5, 5, 4, 4, 23)
)
check_oe_bcva_1m_late_early_tot(OE_too_early)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 BCVA 1m test record(s) failed with 1) test stops too late 2) test stops too early 3) total incorrect. "
#> attr(,"data")
#> # A tibble: 1 × 8
#> USUBJID OETSTDTL VISIT OEDTC OELAT OESTRESN TOTAL issue
#> <chr> <chr> <chr> <chr> <chr> <dbl> <lgl> <chr>
#> 1 1 TESTING DISTANCE: 1M WEEK 1 2020-06-01 LEFT 4 NA BCVA 1m c…
OE_total_incorrect <- data.frame(
USUBJID = "1",
OESPID = "FORMNAME-R:2/L:2XXXX",
OECAT = "BEST CORRECTED VISUAL ACUITY",
OETSTDTL = "TESTING DISTANCE: 1M",
OESCAT = c(rep("", 6), "TOTAL"),
OESTAT = "",
OERESCAT = c("ROW 1 - SNELLEN 20/200",
"ROW 2 - SNELLEN 20/160",
"ROW 4 - SNELLEN 20/100",
"ROW 3 - SNELLEN 20/125",
"ROW 5 - SNELLEN 20/80",
"ROW 6 - SNELLEN 20/63",
""),
VISIT = "WEEK 1",
VISITNUM = 5,
OEDTC = "2020-06-01",
OEDY = 8,
OELOC = "EYE",
OELAT = "LEFT",
OESTRESN = c(5, 5, 5, 4, 4, 2, 28)
)
check_oe_bcva_1m_late_early_tot(OE_total_incorrect)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 BCVA 1m test record(s) failed with 1) test stops too late 2) test stops too early 3) total incorrect. "
#> attr(,"data")
#> USUBJID OETSTDTL VISIT OEDTC OELAT OESTRESN TOTAL
#> 1 1 TESTING DISTANCE: 1M WEEK 1 2020-06-01 LEFT 28 25
#> issue
#> 1 BCVA 1m score incorrect