Varifies events as being duplicated (+1) or not. This is primarily trained on the datetime of an object (if 2d), and looks for two events that are perfectly co-incident. This assumptions can be relaxed with exact = FALSE which looks to see if there are any duplicates in value for the preceeding/following 12 hours. This is pointless for dataitems like heart rate, but is useful so dataitems like creatinine, where we have seen this type of duplication error. 1d events are checked for raw duplication, since they should only occur once per episode anyway.

verify_duplicate(x, exact = TRUE)

Arguments

x

an extracted event table

exact

TRUE/FALSE

Value

a tibble of the same length as x with the following features:

+1

value is a suspected/confirmed duplicate

0

event is unique

Note, when 2 values are deems to be duplicates, the one that first appears in the database is cleared as verified, while the second is not.

Examples

## DB Connection db_pth <- system.file("testdata/synthetic_db.sqlite3", package = "inspectEHR") ctn <- connect(sqlite_file = db_pth) ## Pre-requisites core <- make_core(ctn) ## Data item extraction hr <- extract(core, input = "NIHR_HIC_ICU_0108") ## verify Range vhr <- verify_duplicate(hr) head(vhr)
#> # A tibble: 6 x 2 #> event_id duplicate #> <int> <int> #> 1 2412851 0 #> 2 2412852 0 #> 3 2412853 0 #> 4 2412854 0 #> 5 2412855 0 #> 6 2412856 0
DBI::dbDisconnect(ctn)