wranglEHR is a data wrangling tool for EMAP. It is designed to run against OMOP CDM 5.3.1. Please see the R
vignettes for further details on how to use the package to perform the most common tasks:
extract()
produces a rectangular table in a “long” format that is suitable for most statistial packages.clean()
cleans the above table in accordance with pre-defined standards (pending)More documentation to follow
library(wranglEHR)
ctn <- ctn <- DBI::dbConnect(
RPostgres::Postgres(),
host = "****", # Host target for the UDS
port = 5432,
user = "****",
password = rstudioapi::askForPassword(),
dbname = "uds")
# Extract variables.
# Rename on the fly.
# Dynamically set time cadance.
ltb <- extract(
connection = ctn,
target_schema = "ops_dev",
visit_occurrence_ids = 600000:600005,
concept_names = c(3013502, 44809212),
relabel = c("spo2", "spo2_target"),
coalesce_rows = dplyr::first,
chunk_size = 5000,
cadance = 1
)
head(ltb)
# Add in bed movement data
ltb <- attach_locations(ctn, ltb)
head(ltb)
# Regularise the underlying time cadance of the table
ltb <- regularise(ltb, cadance = 1)
# Don't forget to switch of the lights after you leave
DBI::dbDisconnect(ctn)
If you find a bug, please file a minimal reproducible example on github.