This ophthalmology function is to check if BCVA 1m test is done per BCVA 4m result. Patient, Visits, Laterality where Low Vision Tests were done are excluded from this check. 1> If 4m test total <= 19 and 1m test is not done. 2> If 4m test total >= 20 and 1m test is performed Above two conditions will be outputted in the final result data frame, which includes USUBJID, VISIT, OEDTC, OELAT, BCVA_4M_TOTAL, BCVA_1M_TOTAL, ISSUE. Please note that this check will assume that the BCVA 1m and 4m total are accurate and they happen on the same day. If they are happening on different dates, such records will be removed and not checked.

check_oe_bcva_4m_vs_1m_req(OE)

Arguments

OE

Ophtho Dataset with variables USUBJID, OECAT, OESCAT, OETSTDTL, OESTRESN, OESTAT, OELAT, OERESCAT, VISIT, OEDTC, OEDY

Value

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

Author

Rosemary Li (HackR 2021 Team Eye)

Examples

OE_1m_done <- data.frame(
  USUBJID = "1",
  OECAT = "BEST CORRECTED VISUAL ACUITY",
  OETSTDTL = c(rep("TESTING DISTANCE: 4M", 4), rep("TESTING DISTANCE: 1M", 3)),
  OESCAT = c(rep("", 3), "TOTAL", rep("", 2), "TOTAL"),
  OESTAT = rep("", 7),
  OERESCAT = c("ROW 1 - SNELLEN 20/200",
               "ROW 2 - SNELLEN 20/160",
               "ROW 3 - SNELLEN 20/125",
               "",
               "ROW 1 - SNELLEN 20/200",
               "ROW 2 - SNELLEN 20/160",
               ""),
  VISIT = "WEEK 1",
  VISITNUM = 5,
  OEDTC = "2020-06-01",
  OEDY = 8,
  OELOC = "EYE",
  OELAT = "LEFT",
  OESTRESN = c(9, 9, 3, 21, 3, 2, 5)
)
check_oe_bcva_4m_vs_1m_req(OE_1m_done)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 BCVA 1m test result(s) not done properly based on 4m result. "
#> attr(,"data")
#>   USUBJID  VISIT      OEDTC OELAT BCVA_4M_TOTAL BCVA_1M_TOTAL
#> 1       1 WEEK 1 2020-06-01  LEFT            21             5
#>                           ISSUE
#> 1 1m Test Done but Not Required

OE_1m_not_done <- data.frame(
  USUBJID = "1",
  OECAT = "BEST CORRECTED VISUAL ACUITY",
  OETSTDTL = "TESTING DISTANCE: 4M",
  OESCAT = c(rep("", 3), "TOTAL"),
  OESTAT = "",
  OERESCAT = c("ROW 1 - SNELLEN 20/200",
               "ROW 2 - SNELLEN 20/160",
               "ROW 3 - SNELLEN 20/125",
               ""),
  VISIT = "WEEK 1",
  VISITNUM = 5,
  OEDTC = "2020-06-01",
  OEDY = 8,
  OELOC = "EYE",
  OELAT = "LEFT",
  OESTRESN = c(5, 5, 2, 12)
)
check_oe_bcva_4m_vs_1m_req(OE_1m_not_done)
#> [1] FALSE
#> attr(,"msg")
#> [1] "1 BCVA 1m test result(s) not done properly based on 4m result. "
#> attr(,"data")
#>   USUBJID  VISIT      OEDTC OELAT BCVA_4M_TOTAL BCVA_1M_TOTAL
#> 1       1 WEEK 1 2020-06-01  LEFT            12            NA
#>                           ISSUE
#> 1 1m Test Not Done but Required