forked from CC-HIC/inspectEHR
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
83 lines (63 loc) · 2.19 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
output: github_document
editor_options:
chunk_output_type: console
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
options(tibble.print_min = 5, tibble.print_max = 5)
```
# wranglEHR <a href='https://inform-health-informatics.github.io/wranglEHR/'><img src='man/figures/logo.png' align="right" height="139" /></a>
<!-- badges: start -->
[![Lifecycle Status](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/)
<!-- badges: end -->
## Overview
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)
## Installation
```{r, eval = FALSE}
# install directly from github with
remotes::install_github("inform-health-informatics/wranglEHR")
```
## Usage
More documentation to follow
```{r, message = FALSE, eval = FALSE}
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)
```
## Getting help
If you find a bug, please file a minimal reproducible example on [github](https://github.com/inform-health-informatics/wranglEHR/issues).