R/check_oe_sc_lat_count_fingers.R
check_oe_sc_lat_count_fingers.Rd
Check If Post Treatment Count Fingers in Study Eye is done on the actual Study eye by comparing laterality from OE domain with SC domain. Check is ignored if Post Treatment Count Fingers is not collected in study as it is quite common for EP studies
check_oe_sc_lat_count_fingers(OE, SC)
boolean value if check failed or passed with 'msg' attribute if the test failed
sc <- data.frame(USUBJID = c(1,1,1,2,2,2),
SCTEST = c("Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest",
" ",
"Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest",
" "),
SCTESTCD = c("ELIGEYE", "FOCID", "", "ELIGEYE", "FOCID", ""),
SCCAT = c("STUDY EYE SELECTION", "STUDY EYE SELECTION", "",
"STUDY EYE SELECTION", "STUDY EYE SELECTION", ""),
SCORRES = c("LEFT", "OS", "", "RIGHT", "OD", ""),
SCDTC = rep("2021-01-01", 6),
stringsAsFactors = FALSE)
oe <- data.frame(USUBJID = c(1,1,1,1,1,2,2,2,2,2,2),
OECAT = rep("SAFETY ASSESSMENT OF LOW VISION", 11),
OELOC = rep("Eye", 11),
OELAT = c("LEFT", "Left", "left", "LEFT", "LEFT",
"RIGHT", "right", "right", "RIGHT", "RIGHT", "right"),
OEDY = c(1, 28, 56, 84, 112, 1, 28, 56, 84, 112, 140),
VISIT = c("Week 1", "Week 4", "Week 8", "Week 12", "Week 16",
"Week 1", "Week 4", "Week 8", "Week 12", "Week 16", "Week 20"),
OEDTC = c("2021-01-01", "2021-02-01", "2021-03-01", "2021-04-01", "2021-05-01",
"2021-01-01", "2021-02-01", "2021-03-01", "2021-04-01", "2021-05-01",
"2021-06-01"),
OETEST = c("A", "B", "C", "D", "E", "A", "B", "C", "D", "E", "F"),
stringsAsFactors=FALSE)
check_oe_sc_lat_count_fingers(SC=sc, OE=oe)
#> [1] TRUE
sc <- data.frame(USUBJID = c(1,1,1,2,2,2),
SCTEST = c("Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest",
" ",
"Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest",
" "),
SCTESTCD = c("ELIGEYE", "FOCID", "", "ELIGEYE", "FOCID", ""),
SCCAT = c("STUDY EYE SELECTION", "STUDY EYE SELECTION", "",
"STUDY EYE SELECTION", "STUDY EYE SELECTION", ""),
SCORRES = c("LEFT", "OS", "", "RIGHT", "OD", ""),
SCDTC = rep("2021-01-01", 6),
stringsAsFactors = FALSE)
oe <- data.frame(USUBJID = c(1,1,1,1,1,2,2,2,2,2,2),
OECAT = rep("SAFETY ASSESSMENT OF LOW VISION", 11),
OELOC = rep("Eye", 11),
OELAT = c("LEFT", "Left", "left", "LEFT", "right", "RIGHT",
"right", "right", "RIGHT", "RIGHT", "left"),
OEDY = c(1, 28, 56, 84, 112, 1, 28, 56, 84, 112, 140),
VISIT = c("Week 1", "Week 4", "Week 8", "Week 12", "Week 16",
"Week 1", "Week 4", "Week 8", "Week 12", "Week 16",
"Week 20"),
OEDTC = c("2021-01-01", "2021-02-01", "2021-03-01", "2021-04-01", "2021-05-01",
"2021-01-01", "2021-02-01", "2021-03-01", "2021-04-01", "2021-05-01",
"2021-06-01"),
OETEST = c("A", "B", "C", "D", "E", "A", "B", "C", "D", "E", "F"),
stringsAsFactors=FALSE)
check_oe_sc_lat_count_fingers(SC=sc, OE=oe)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with Post Treatment Count Fingers - Study Eye laterality does not match with Subject Characteristics Study Eye laterality. "
#> attr(,"data")
#> USUBJID SCDTC SC_STUDYEYE OELAT VISIT OEDTC OETEST
#> 1 1 2021-01-01 LEFT right Week 16 2021-05-01 E
#> 2 2 2021-01-01 RIGHT left Week 20 2021-06-01 F
sc <- data.frame(USUBJID = c(1,1,1,2,2,2,3),
SCTEST = c("Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest",
" ",
"Eye Meeting Eligibility Criteria",
"Focus of Study-Specific Interest",
" ",
"Focus of Study-Specific Interest"),
SCTESTCD = c("ELIGEYE", "FOCID", "", "ELIGEYE", "FOCID", "", "FOCID"),
SCCAT = c("STUDY EYE SELECTION", "STUDY EYE SELECTION", "",
"STUDY EYE SELECTION", "STUDY EYE SELECTION",
"", "STUDY EYE SELECTION"),
SCORRES = c("LEFT", "OS", "", "RIGHT", "OD", "", "OS"),
SCDTC = "2021-01-01",
stringsAsFactors = FALSE)
oe <- data.frame(USUBJID = c(1,1,1,1,1,2,2,2,2,2,2),
OESTAT = c("","","","","","","","","","", "not DONE"),
OECAT = "SAFETY ASSESSMENT OF LOW VISION",
OELOC = "Eye",
OELAT = c("LEFT", "Left", "left", "LEFT", "right", "RIGHT",
"right", "right", "RIGHT", "RIGHT", "left"),
OEDY = c(1, 28, 56, 84, 112, 1, 28, 56, 84, 112, 140),
VISIT = c("Week 1", "Week 4", "Week 8", "Week 12", "Week 16",
"Week 1", "Week 4", "Week 8", "Week 12", "Week 16",
"Week 20"),
OEDTC = c("2021-01-01", "2021-02-01", "2021-03-01", "2021-04-01", "2021-05-01",
"2021-01-01", "2021-02-01", "2021-03-01", "2021-04-01", "2021-05-01",
"2021-06-01"),
OETEST = c("A", "B", "C", "D", "E", "A", "B", "C", "D", "E", "F"),
stringsAsFactors=FALSE)
check_oe_sc_lat_count_fingers(SC=sc, OE=oe)
#> [1] FALSE
#> attr(,"msg")
#> [1] "2 record(s) with Post Treatment Count Fingers - Study Eye laterality does not match with Subject Characteristics Study Eye laterality. "
#> attr(,"data")
#> USUBJID SCDTC SC_STUDYEYE OELAT VISIT OEDTC OETEST
#> 1 1 2021-01-01 LEFT right Week 16 2021-05-01 E
#> 2 3 2021-01-01 LEFT <NA> <NA> <NA> <NA>