Writes a remote SQL query to make a core table with all the necessary column names for most data extraction tasks. No work is done till the function is explicitly called.

make_core(connection)

Arguments

connection

a database connection

Value

a database object

Examples

db_pth <- system.file("testdata/synthetic_db.sqlite3", package = "inspectEHR") ctn <- connect(sqlite_file = db_pth) core <- make_core(ctn) head(core)
#> # Source: lazy query [?? x 22] #> # Database: sqlite 3.29.0 #> # [/tmp/Rtmpl8hgjg/temp_libpathdc12a384b20/inspectEHR/testdata/synthetic_db.sqlite3] #> episode_id nhs_number start_date provenance filename date_created version #> <int> <chr> <chr> <int> <chr> <chr> <chr> #> 1 13626 8674351972 2016-02-1… 2 simulat… 2019-08-20 … v8.3.2 #> 2 13626 8674351972 2016-02-1… 2 simulat… 2019-08-20 … v8.3.2 #> 3 13626 8674351972 2016-02-1… 2 simulat… 2019-08-20 … v8.3.2 #> 4 13626 8674351972 2016-02-1… 2 simulat… 2019-08-20 … v8.3.2 #> 5 13626 8674351972 2016-02-1… 2 simulat… 2019-08-20 … v8.3.2 #> 6 13626 8674351972 2016-02-1… 2 simulat… 2019-08-20 … v8.3.2 #> # … with 15 more variables: date_parsed <chr>, site <chr>, theme <chr>, #> # notes <chr>, code_name <chr>, string <chr>, string2 <chr>, string3 <chr>, #> # datetime <chr>, date <chr>, time <chr>, real <dbl>, integer <int>, #> # integer2 <int>, event_id <int>
DBI::dbDisconnect(ctn)