OHDSI/ETL-Synthea

LoadEventTables errors with person table does not exist

jdamato-mitre opened this issue · 7 comments

I am at the point of running ETLSyntheaBuilder::LoadEventTables but I am getting an error

ERROR: relation "cdm_synthea.person" does not exist

When was this table suppose to be created?
createCDMTables(), createSyntheaTables(), LoadSyntheaTables(), and LoadVocabTables() all ran successfully.

cdmSchema      <- "cdm_synthea"
cdmVersion     <- "5.4"
syntheaVersion <- "2.7.0"
syntheaSchema  <- "native"

Hi @jdamato-mitre , the PERSON table gets created via createCDMTables. Try running just createCDMTables and see if the PERSON table gets created before running the other steps.

Is there a way to rerun createCDMTables and to ignore relations that already exist?

image

I did not see an option in the documentation or a way to drop the CDM tables so that I can rerun createCDMTables. https://rdrr.io/github/OHDSI/ETL-Synthea/man/CreateCDMTables.html

@jdamato-mitre , There's this function: DropEventTables

But, of course, I haven't updated it to include the new 5.4 tables, so it will miss EPISODE (and EPISODE_EVENT). : )

I'll update the function to include the new 5.4 tables, in the meantime you can run it manually and just add "episode" and "episode_event" to the eventTables vector on line 20 of the above function.

I got the same error for "concept" and then again for "vocabulary", but I don't want to drop my vocabulary if I don't have to, LoadVocabFromCsv a few hours to complete.

@jdamato-mitre Understandable. We need to update how this thing works...

In the meantime, try wrapping your call to createCDMTables in a try() block and set silent = true:

try(ETLSyntheaBuilder::createCDMTables(cdmVersion, etc...), silent = TRUE)

@jdamato-mitre another idea is to call the cdm package directly rather than use createCDMTables:

try(
CommonDataModel::executeDdl(
		connectionDetails = connectionDetails,
		cdmVersion        = cdmVersion,
		cdmDatabaseSchema = cdmSchema,
		executeDdl        = TRUE,
		executePrimaryKey = TRUE,
		executeForeignKey = FALSE), silent = TRUE)

Thanks @AnthonyMolinaro for helping me with this! I ended up recreating everything. I was just using Synthea data so it wasn't to bad, not sure what actually happened but I have all the tables now. If this happens again with real data I will try what you suggested.