extract_demographics: Extract 1d data from CC-HIC

View source: R/extract_demographics.R

extract_demographicsR Documentation

Extract 1d data from CC-HIC

Description

Takes a remote database contection to CC-HIC, a vector of HIC codes (and optionally a vector of labels to rename the codes) and returns a table with 1 row per patient and 1 column per data item.

Usage

extract_demographics(
  connection = NULL,
  episode_ids = NA_integer_,
  code_names = NA_character_,
  rename = NA_character_
)

Arguments

connection

a CC-HIC database connection

episode_ids

an integer vector of episode ids from the CC-HIC DB that you want to extact. The default (NULL) is to extract all.

code_names

a character vector of CC-HIC codes

rename

a character vector of names you want to relabel CC-HIC codes as, or NULL (the default) if you do not want to relabel.

Value

A tibble of 1d data

Examples

hic_codes <- "NIHR_HIC_ICU_0409"
new_labels <- "apache_score"
con <- setup_dummy_db()
dtb <- extract_demographics(
  connection = con,
  episode_ids = 1:10,
  code_names = hic_codes,
  rename = new_labels)
head(dtb)
DBI::dbDisconnect(con)

DocEd/wranglEHR documentation built on May 28, 2022, 1:50 p.m.