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.
extract_demographics( connection = NULL, episode_ids = NULL, code_names = NULL, rename = NULL )
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. |
A tibble of 1d data
db_pth <- system.file("testdata/synthetic_db.sqlite3", package = "inspectEHR") ctn <- connect(sqlite_file = db_pth) hic_codes <- "NIHR_HIC_ICU_0409" new_labels <- "apache_score" extract_demographics(ctn, episode_ids = 13639:13643, hic_codes, new_labels)#> # A tibble: 5 x 2 #> episode_id apache_score #> <int> <int> #> 1 13639 12 #> 2 13640 16 #> 3 13641 47 #> 4 13642 28 #> 5 13643 14