insertResultsToSqlite {PatientLevelPrediction} | R Documentation |
Create sqlite database with the results
Description
This function create an sqlite database with the PLP result schema and inserts all results
Usage
insertResultsToSqlite(
resultLocation,
cohortDefinitions = NULL,
databaseList = NULL,
sqliteLocation = file.path(resultLocation, "sqlite")
)
Arguments
resultLocation |
(string) location of directory where the main package results were saved |
cohortDefinitions |
A set of one or more cohorts extracted using ROhdsiWebApi::exportCohortDefinitionSet() |
databaseList |
A list created by |
sqliteLocation |
(string) location of directory where the sqlite database will be saved |
Details
This function can be used upload PatientLevelPrediction results into an sqlite database
Value
Returns the location of the sqlite database file
Examples
plpData <- getEunomiaPlpData()
saveLoc <- file.path(tempdir(), "insertResultsToSqlite")
results <- runPlp(plpData, outcomeId = 3, analysisId = 1, saveDirectory = saveLoc)
databaseFile <- insertResultsToSqlite(saveLoc, cohortDefinitions = NULL,
sqliteLocation = file.path(saveLoc, "sqlite"))
# check there is some data in the database
library(DatabaseConnector)
connectionDetails <- createConnectionDetails(
dbms = "sqlite",
server = databaseFile)
conn <- connect(connectionDetails)
# All tables should be created
getTableNames(conn, databaseSchema = "main")
# There is data in the tables
querySql(conn, "SELECT * FROM main.model_designs limit 10")
# clean up
unlink(saveLoc, recursive = TRUE)
[Package PatientLevelPrediction version 6.4.1 Index]