Make reference table
make_reference(connection = NULL, translate_site = NULL, .debug = FALSE)
connection | a database connection returned by [DBI::dbConnect()] |
---|---|
translate_site | a lookup table to translate site names on export in a consistent way. The table requires two columns: `site` and `translation`. The `site` column should be a character vector with names of the existing sites as they are stored in the database (e.g. `c("GSTT", "RGT")` etc). The `translation` column should be a character vector with new names to obfuscate the real names (e.g. `c("Site A", "Site B")` etc). This is a 1:1 mapping so doesn't confer any real privacy advantage, but is useful as a means to casually obscure data origins. |
.debug | logical flag to use internal simulated data for testing |
a tibble with episode level data with site
Prepares a small local table with the following fields: * episode_id: primary key for the `episodes` table * nhs_number: core patient identifier * start_date: the ICU episode start date * site: the hospital site of origin
if (FALSE) { # Make a database connection object using DBI::dbConnect() # ctn <- DBI::dbConnect() ref <- make_reference(ctn) head(ref) DBI::dbDisconnect(ctn) }