This function uploads results in csv format into a result database
Usage
insertResultsToDatabase(
connectionDetails,
schema,
resultsFolder,
tablePrefix = "",
csvTablePrefix = "c_",
includedFiles = NULL
)
Arguments
- connectionDetails
The connection details to the result database
- schema
The schema for the result database
- resultsFolder
The folder containing the csv results
- tablePrefix
A prefix to append to the result tables for the characterization results
- csvTablePrefix
The prefix added to the csv results - default is 'c_'
- includedFiles
Specify the csv files to upload or NULL to upload all in directory
See also
Other Database:
createCharacterizationTables()
,
createSqliteDatabase()
Examples
# generate results into resultsFolder
conDet <- exampleOmopConnectionDetails()
tteSet <- createTimeToEventSettings(
targetIds = c(1,2),
outcomeIds = 3
)
cSet <- createCharacterizationSettings(
timeToEventSettings = tteSet
)
runCharacterizationAnalyses(
connectionDetails = conDet,
targetDatabaseSchema = 'main',
targetTable = 'cohort',
outcomeDatabaseSchema = 'main',
outcomeTable = 'cohort',
cdmDatabaseSchema = 'main',
characterizationSettings = cSet,
outputDirectory = file.path(tempdir(),'database')
)
#> Creating directory /tmp/RtmpvnvSBl/database
#> Creating directory /tmp/RtmpvnvSBl/database/execution
#> Currently in a tryCatch or withCallingHandlers block, so unable to add global calling handlers. ParallelLogger will not capture R messages, errors, and warnings, only explicit calls to ParallelLogger. (This message will not be shown again this R session)
#> Creating new cluster
#> Connecting using SQLite driver
#> Uploading #cohort_settings
#> Inserting data took 0.0342 secs
#> Computing time to event results
#> Executing SQL took 0.0224 secs
#> Computing time-to-event for 2 T-O pairs took 0.22 secs
#> exporting to csv file
#> Writing 96 rows to csv
# create sqlite database
charResultDbCD <- createSqliteDatabase()
# create database results tables
createCharacterizationTables(
connectionDetails = charResultDbCD,
resultSchema = 'main'
)
#> Connecting using SQLite driver
#> Deleting existing tables
#> Executing SQL took 0.00261 secs
#> Executing SQL took 0.00255 secs
#> Executing SQL took 0.00252 secs
#> Executing SQL took 0.0026 secs
#> Executing SQL took 0.00253 secs
#> Executing SQL took 0.00282 secs
#> Executing SQL took 0.00256 secs
#> Executing SQL took 0.00269 secs
#> Executing SQL took 0.00263 secs
#> Executing SQL took 0.00272 secs
#> Executing SQL took 0.00268 secs
#> Executing SQL took 0.00267 secs
#> Executing SQL took 0.00263 secs
#> Executing SQL took 0.00264 secs
#> Executing SQL took 0.00267 secs
#> Executing SQL took 0.00276 secs
#> Executing SQL took 0.00255 secs
#> Executing SQL took 0.00256 secs
#> Executing SQL took 0.00246 secs
#> Executing SQL took 0.00254 secs
#> Executing SQL took 0.00248 secs
#> Executing SQL took 0.00258 secs
#> Executing SQL took 0.00253 secs
#> Executing SQL took 0.00276 secs
#> Creating characterization results tables
#> Executing SQL took 0.00772 secs
#> Migrating data set
#> Migrator using SQL files in Characterization
#> Connecting using SQLite driver
#> Creating migrations table
#> | | | 0% | |======================================================================| 100%
#> Executing SQL took 0.0028 secs
#> Migrations table created
#> Executing migration: Migration_1-v0_3_0_store_version.sql
#> | | | 0% | |=================================== | 50% | |======================================================================| 100%
#> Executing SQL took 0.00329 secs
#> Saving migration: Migration_1-v0_3_0_store_version.sql
#> | | | 0% | |======================================================================| 100%
#> Executing SQL took 0.00287 secs
#> Migration complete Migration_1-v0_3_0_store_version.sql
#> Executing migration: Migration_2-v2_1_1_mean_exposure_time_type.sql
#> | | | 0% | |================== | 25% | |=================================== | 50% | |==================================================== | 75% | |======================================================================| 100%
#> Executing SQL took 0.00668 secs
#> Saving migration: Migration_2-v2_1_1_mean_exposure_time_type.sql
#> | | | 0% | |======================================================================| 100%
#> Executing SQL took 0.00271 secs
#> Migration complete Migration_2-v2_1_1_mean_exposure_time_type.sql
#> Executing migration: Migration_3-v2_2_0_count_as_bigint.sql
#> | | | 0% | |=================================== | 50% | |======================================================================| 100%
#> Executing SQL took 0.00305 secs
#> Saving migration: Migration_3-v2_2_0_count_as_bigint.sql
#> | | | 0% | |======================================================================| 100%
#> Executing SQL took 0.00291 secs
#> Migration complete Migration_3-v2_2_0_count_as_bigint.sql
#> Closing database connection
#> Updating version number
#> Executing SQL took 0.00325 secs
# insert results
insertResultsToDatabase(
connectionDetails = charResultDbCD,
schema = 'main',
resultsFolder = file.path(tempdir(),'database'),
includedFiles = c('time_to_event')
)
#> Connecting using SQLite driver
#> Uploading file: c_time_to_event.csv to table: c_time_to_event
#> - Preparing to upload rows 1 through 96
#> Inserting data took 0.0106 secs
#> Uploading data took 1.25 secs