I'm not sure if this is an RMM issue or not but starting by putting it here. This issue is based on the work happening in OHDSI/Strategus#147 (comment).
Here is some code that can be used to reproduce the example between creating the table & uploading data in SQLite vs PostgreSQL. The files references in the code below is attached to the issue at the bottom. The issue is that when database_id is inserted into SQLite, it is formatted as 85642205.0 while when it is inserted into PostgreSQL, it is 85642205
# Create empty SQLite database -------------------------
library(RSQLite)
if (file.exists("D:/TEMP/temp.sqlite")) {
unlink("D:/TEMP/temp.sqlite")
}
mydb <- dbConnect(RSQLite::SQLite(), "D:/TEMP/temp.sqlite")
dbDisconnect(mydb)
resultsConnectionDetails <- DatabaseConnector::createConnectionDetails(
dbms = "sqlite",
server = "D:/TEMP/temp.sqlite"
)
# Create the table
connection <- DatabaseConnector::connect(resultsConnectionDetails)
# Create the SQL from the resultsDataModelSpecification.csv
sql <- ResultModelManager::generateSqlSchema(
csvFilepath = "D:/temp/StrategusR6Testing/results_folder/DatabaseMetaData/resultsDataModelSpecification.csv"
)
[database_meta_data.zip](https://github.com/user-attachments/files/16395694/database_meta_data.zip)
[database_meta_data.zip](https://github.com/user-attachments/files/16395708/database_meta_data.zip)
sql <- SqlRender::render(
sql = sql,
database_schema = "main"
)
DatabaseConnector::executeSql(connection = connection, sql = sql)
# NOTE: database_id is character
specification <- CohortGenerator::readCsv(file = "D:/temp/StrategusR6Testing/results_folder/DatabaseMetaData/resultsDataModelSpecification.csv")
ResultModelManager::uploadResults(
connection = connection,
schema = "main",
resultsFolder = "D:/temp/StrategusR6Testing/results_folder/DatabaseMetaData",
purgeSiteDataBeforeUploading = TRUE,
databaseIdentifierFile = "D:/temp/StrategusR6Testing/results_folder/DatabaseMetaData/database_meta_data.csv",
specifications = specification
)
#NOTE: database_id = 85642205.0
DatabaseConnector::disconnect(connection)
# Do the same but on PG
resultsConnectionDetails <- DatabaseConnector::createConnectionDetails(
dbms = "postgresql",
connectionString = keyring::key_get("resultsConnectionString", keyring = "ohda"),
user = keyring::key_get("resultsAdmin", keyring = "ohda"),
password = keyring::key_get("resultsAdminPassword", keyring = "ohda")
)
# Create the table
connection <- DatabaseConnector::connect(resultsConnectionDetails)
# Create the SQL from the resultsDataModelSpecification.csv
sql <- ResultModelManager::generateSqlSchema(
csvFilepath = "D:/temp/StrategusR6Testing/results_folder/DatabaseMetaData/resultsDataModelSpecification.csv"
)
sql <- SqlRender::render(
sql = sql,
database_schema = "sena_test"
)
DatabaseConnector::executeSql(connection = connection, sql = sql)
# NOTE: database_id is character
specification <- CohortGenerator::readCsv(file = "D:/temp/StrategusR6Testing/results_folder/DatabaseMetaData/resultsDataModelSpecification.csv")
ResultModelManager::uploadResults(
connection = connection,
schema = "sena_test",
resultsFolder = "D:/temp/StrategusR6Testing/results_folder/DatabaseMetaData",
purgeSiteDataBeforeUploading = TRUE,
databaseIdentifierFile = "D:/temp/StrategusR6Testing/results_folder/DatabaseMetaData/database_meta_data.csv",
specifications = specification
)
#NOTE: database_id = 85642205
DatabaseConnector::disconnect(connection)
database_meta_data.zip
I'm not sure if this is an RMM issue or not but starting by putting it here. This issue is based on the work happening in OHDSI/Strategus#147 (comment).
Here is some code that can be used to reproduce the example between creating the table & uploading data in SQLite vs PostgreSQL. The files references in the code below is attached to the issue at the bottom. The issue is that when
database_idis inserted into SQLite, it is formatted as85642205.0while when it is inserted into PostgreSQL, it is85642205database_meta_data.zip