verify_bounds: verify Event Plausibility - Boundary Checks (S3 Generic)

Description Usage Arguments Value Examples

View source: R/verify_events.R

Description

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.

Usage

1
verify_bounds(x = NULL, los_table = NULL, hours = 24)

Arguments

x

an extracted nhic event table

los_table

episode length table

hours

the number of hours you allow before and after an episode

Value

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

-1

event is before the ICU episode

0

event is during the ICU episode

+1

event is after the ICU episode

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
## 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)
DBI::dbDisconnect(ctn)

CC-HIC/inspectEHR documentation built on Jan. 16, 2020, 11:24 p.m.