OHDSI / OHDSI/Characterization
Characterization is not supporting temporal covariate settings object
Open
@jreps is already working on this.
Since Apr 26, 2024.
- Dominant language
- R
- Stars
- 3
- Forks
- 6
- Avg merge
- 2h 11m
- Merged PRs (30d)
- 4
Description
Reproducible code. the code below gives the error
Error: Columns time_id not found
While uploading covariates
This is because timeId is absent in these tables
https://github.com/OHDSI/Characterization/blob/fa8c856802d75ae1e9289af11490830d39e5465e/inst/sql/sql_server/ResultTables.sql#L99-L123
# Set up
remotes::install_github("OHDSI/DatabaseConnector")
remotes::install_github("OHDSI/FeatureExtraction")
outputLocation <- file.path("D:", "test")
# cohort definition set
targetCohortIds <- 40 # diabetes mellitus
outcomeCohortIds <- 23 # inpatient
cohortDefinitionSet <-
PhenotypeLibrary::getPlCohortDefinitionSet(cohortIds = c(targetCohortIds, outcomeCohortIds))
database <- "eunomia"
resultsLocation <- file.path(outputLocation, database)
cohortDatabaseSchema <- "main"
cdmDatabaseSchema <- "main"
databaseId <- database
cohortTableNames <-
CohortGenerator::getCohortTableNames(cohortTable = "cohort")
targetCohortDatabaseSchema <- cdmDatabaseSchema
targetCohortTable <- cohortTableNames$cohortTable
outcomeCohortDatabaseSchema <- cdmDatabaseSchema
outcomeCohortTable <- cohortTableNames$cohortTable
connectionDetails <- Eunomia::getEunomiaConnectionDetails()
CohortGenerator::createCohortTables(
connectionDetails = connectionDetails,
cohortDatabaseSchema = cohortDatabaseSchema,
cohortTableNames = cohortTableNames
)
CohortGenerator::generateCohortSet(
connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
cohortDatabaseSchema = cohortDatabaseSchema,
cohortTableNames = cohortTableNames,
cohortDefinitionSet = cohortDefinitionSet
)
# feature extraction specification from CohortDiagnostics as it has temporalCovariateSettings
cohortDiagnosticsCovariateSettings <-
CohortDiagnostics::getDefaultCovariateSettings()
# Setting for characterization package
aggregateCovariateSettings1 <-
Characterization::createAggregateCovariateSettings(
targetIds = targetCohortIds,
outcomeIds = outcomeCohortIds,
riskWindowStart = 0,
startAnchor = 'cohort start',
riskWindowEnd = 0,
endAnchor = 'cohort end',
covariateSettings = cohortDiagnosticsCovariateSettings
)
timeToEventSettings1 <- Characterization::createTimeToEventSettings(targetIds = targetCohortIds,
outcomeIds = outcomeCohortIds)
dechallengeRechallengeSettings <-
Characterization::createDechallengeRechallengeSettings(
targetIds = targetCohortIds,
outcomeIds = outcomeCohortIds,
dechallengeStopInterval = 30,
dechallengeEvaluationWindow = 31
)
characterizationSettings <-
Characterization::createCharacterizationSettings(
timeToEventSettings = list(timeToEventSettings1),
dechallengeRechallengeSettings = list(dechallengeRechallengeSettings),
aggregateCovariateSettings = list(aggregateCovariateSettings1)
)
Characterization::runCharacterizationAnalyses(
connectionDetails = connectionDetails,
cdmDatabaseSchema = cdmDatabaseSchema,
targetDatabaseSchema = targetCohortDatabaseSchema,
targetTable = targetCohortTable,
outcomeDatabaseSchema = outcomeCohortDatabaseSchema,
outcomeTable = outcomeCohortTable,
characterizationSettings = characterizationSettings,
saveDirectory = resultsLocation,
tablePrefix = 'c_',
databaseId = databaseId
)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.