Varifies events as being within (0
), after (+1
) or
before (-1
) an associated episode. This isn't necessarily a problem,
for example, microbiology data coming back after death. However, it is
often demonstrative of a bigger problem. For example, data is sometimes
contributes from more than one episode, and then duplicated across episodes.
verify_bounds(x = NULL, los_table = NULL, hours = 24)
x | an extracted nhic event table |
---|---|
los_table | episode length table |
hours | the number of hours you allow before and after an episode |
a tibble of the same length as x with the following features:
event is before the ICU episode
event is during the ICU episode
event is after the ICU episode
## DB Connection db_pth <- system.file("testdata/synthetic_db.sqlite3", package = "inspectEHR") ctn <- connect(sqlite_file = db_pth) ## Pre-requisites core <- make_core(ctn) episodes <- characterise_episodes(ctn) ## Data item extraction hr <- extract(core, input = "NIHR_HIC_ICU_0108") ## verify Boundary Conditions vhr <- verify_bounds(hr, los_table = episodes) head(vhr)#> # A tibble: 6 x 2 #> event_id out_of_bounds #> <int> <int> #> 1 2412851 -1 #> 2 2412852 -1 #> 3 2412853 -1 #> 4 2412854 -1 #> 5 2412855 -1 #> 6 2412856 -1