Title: | Implement Descriptive Studies Using the Common Data Model |
---|---|
Description: | An end-to-end framework that enables users to implement various descriptive studies for a given set of target and outcome cohorts for data mapped to the Observational Medical Outcomes Partnership Common Data Model. |
Authors: | Jenna Reps [aut, cre], Patrick Ryan [aut], Chris Knoll [aut] |
Maintainer: | Jenna Reps <[email protected]> |
License: | Apache License 2.0 |
Version: | 2.1.3 |
Built: | 2025-03-05 05:25:17 UTC |
Source: | https://github.com/ohdsi/characterization |
Removes csv files from folders that have not been marked as completed and removes the record of the execution file
cleanIncremental(executionFolder, ignoreWhenEmpty = FALSE)
cleanIncremental(executionFolder, ignoreWhenEmpty = FALSE)
executionFolder |
The folder that has the execution files |
ignoreWhenEmpty |
When TRUE, if there are no incremental logs then nothing is run |
A list with the settings
Other Incremental:
cleanNonIncremental()
cleanIncremental( file.path(tempdir(), 'incremental'), ignoreWhenEmpty = TRUE )
cleanIncremental( file.path(tempdir(), 'incremental'), ignoreWhenEmpty = TRUE )
Removes csv files from the execution folder as there should be no csv files when running in non-incremental model
cleanNonIncremental(executionFolder)
cleanNonIncremental(executionFolder)
executionFolder |
The folder that has the execution files |
A list with the settings
Other Incremental:
cleanIncremental()
# example code cleanNonIncremental(file.path(tempdir(), 'incremental'))
# example code cleanNonIncremental(file.path(tempdir(), 'incremental'))
Compute dechallenge rechallenge study
computeDechallengeRechallengeAnalyses( connectionDetails = NULL, targetDatabaseSchema, targetTable, outcomeDatabaseSchema = targetDatabaseSchema, outcomeTable = targetTable, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), settings, databaseId = "database 1", outputFolder, minCellCount = 0, ... )
computeDechallengeRechallengeAnalyses( connectionDetails = NULL, targetDatabaseSchema, targetTable, outcomeDatabaseSchema = targetDatabaseSchema, outcomeTable = targetTable, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), settings, databaseId = "database 1", outputFolder, minCellCount = 0, ... )
connectionDetails |
An object of type 'connectionDetails' as created using the [DatabaseConnector::createConnectionDetails()] function. |
targetDatabaseSchema |
Schema name where your target cohort table resides. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'. |
targetTable |
Name of the target cohort table. |
outcomeDatabaseSchema |
Schema name where your outcome cohort table resides. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'. |
outcomeTable |
Name of the outcome cohort table. |
tempEmulationSchema |
Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created |
settings |
The settings for the timeToEvent study |
databaseId |
An identifier for the database (string) |
outputFolder |
A directory to save the results as csv files |
minCellCount |
The minimum cell value to display, values less than this will be replaced by -1 |
... |
extra inputs |
An Andromeda::andromeda()
object containing the dechallenge rechallenge results
Other DechallengeRechallenge:
computeRechallengeFailCaseSeriesAnalyses()
,
createDechallengeRechallengeSettings()
conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) computeDechallengeRechallengeAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', settings = drSet, outputFolder = tempdir() )
conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) computeDechallengeRechallengeAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', settings = drSet, outputFolder = tempdir() )
Compute fine the subjects that fail the dechallenge rechallenge study
computeRechallengeFailCaseSeriesAnalyses( connectionDetails = NULL, targetDatabaseSchema, targetTable, outcomeDatabaseSchema = targetDatabaseSchema, outcomeTable = targetTable, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), settings, databaseId = "database 1", showSubjectId = FALSE, outputFolder, minCellCount = 0, ... )
computeRechallengeFailCaseSeriesAnalyses( connectionDetails = NULL, targetDatabaseSchema, targetTable, outcomeDatabaseSchema = targetDatabaseSchema, outcomeTable = targetTable, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), settings, databaseId = "database 1", showSubjectId = FALSE, outputFolder, minCellCount = 0, ... )
connectionDetails |
An object of type 'connectionDetails' as created using the [DatabaseConnector::createConnectionDetails()] function. |
targetDatabaseSchema |
Schema name where your target cohort table resides. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'. |
targetTable |
Name of the target cohort table. |
outcomeDatabaseSchema |
Schema name where your outcome cohort table resides. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'. |
outcomeTable |
Name of the outcome cohort table. |
tempEmulationSchema |
Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created |
settings |
The settings for the timeToEvent study |
databaseId |
An identifier for the database (string) |
showSubjectId |
if F then subject_ids are hidden (recommended if sharing results) |
outputFolder |
A directory to save the results as csv files |
minCellCount |
The minimum cell value to display, values less than this will be replaced by -1 |
... |
extra inputs |
An Andromeda::andromeda()
object with the case series details of the failed rechallenge
Other DechallengeRechallenge:
computeDechallengeRechallengeAnalyses()
,
createDechallengeRechallengeSettings()
conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) computeRechallengeFailCaseSeriesAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', settings = drSet, outputFolder = tempdir() )
conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) computeRechallengeFailCaseSeriesAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', settings = drSet, outputFolder = tempdir() )
Compute time to event study
computeTimeToEventAnalyses( connectionDetails = NULL, targetDatabaseSchema, targetTable, outcomeDatabaseSchema = targetDatabaseSchema, outcomeTable = targetTable, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), cdmDatabaseSchema, settings, databaseId = "database 1", outputFolder, minCellCount = 0, ... )
computeTimeToEventAnalyses( connectionDetails = NULL, targetDatabaseSchema, targetTable, outcomeDatabaseSchema = targetDatabaseSchema, outcomeTable = targetTable, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), cdmDatabaseSchema, settings, databaseId = "database 1", outputFolder, minCellCount = 0, ... )
connectionDetails |
An object of type 'connectionDetails' as created using the [DatabaseConnector::createConnectionDetails()] function. |
targetDatabaseSchema |
Schema name where your target cohort table resides. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'. |
targetTable |
Name of the target cohort table. |
outcomeDatabaseSchema |
Schema name where your outcome cohort table resides. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'. |
outcomeTable |
Name of the outcome cohort table. |
tempEmulationSchema |
Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created |
cdmDatabaseSchema |
The database schema containing the OMOP CDM data |
settings |
The settings for the timeToEvent study |
databaseId |
An identifier for the database (string) |
outputFolder |
A directory to save the results as csv files |
minCellCount |
The minimum cell value to display, values less than this will be replaced by -1 |
... |
extra inputs |
An Andromeda::andromeda()
object containing the time to event results.
Other TimeToEvent:
createTimeToEventSettings()
# example code conDet <- exampleOmopConnectionDetails() tteSet <- createTimeToEventSettings( targetIds = c(1,2), outcomeIds = 3 ) result <- computeTimeToEventAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', cdmDatabaseSchema = 'main', settings = tteSet, outputFolder = file.path(tempdir(), 'tte') )
# example code conDet <- exampleOmopConnectionDetails() tteSet <- createTimeToEventSettings( targetIds = c(1,2), outcomeIds = 3 ) result <- computeTimeToEventAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', cdmDatabaseSchema = 'main', settings = tteSet, outputFolder = file.path(tempdir(), 'tte') )
Create aggregate covariate study settings
createAggregateCovariateSettings( targetIds, outcomeIds, minPriorObservation = 0, outcomeWashoutDays = 0, riskWindowStart = 1, startAnchor = "cohort start", riskWindowEnd = 365, endAnchor = "cohort start", covariateSettings = FeatureExtraction::createCovariateSettings(useDemographicsGender = TRUE, useDemographicsAge = TRUE, useDemographicsAgeGroup = TRUE, useDemographicsRace = TRUE, useDemographicsEthnicity = TRUE, useDemographicsIndexYear = TRUE, useDemographicsIndexMonth = TRUE, useDemographicsTimeInCohort = TRUE, useDemographicsPriorObservationTime = TRUE, useDemographicsPostObservationTime = TRUE, useConditionGroupEraLongTerm = TRUE, useDrugGroupEraOverlapping = TRUE, useDrugGroupEraLongTerm = TRUE, useProcedureOccurrenceLongTerm = TRUE, useMeasurementLongTerm = TRUE, useObservationLongTerm = TRUE, useDeviceExposureLongTerm = TRUE, useVisitConceptCountLongTerm = TRUE, useConditionGroupEraShortTerm = TRUE, useDrugGroupEraShortTerm = TRUE, useProcedureOccurrenceShortTerm = TRUE, useMeasurementShortTerm = TRUE, useObservationShortTerm = TRUE, useDeviceExposureShortTerm = TRUE, useVisitConceptCountShortTerm = TRUE, endDays = 0, longTermStartDays = -365, shortTermStartDays = -30), caseCovariateSettings = createDuringCovariateSettings(useConditionGroupEraDuring = TRUE, useDrugGroupEraDuring = TRUE, useProcedureOccurrenceDuring = TRUE, useDeviceExposureDuring = TRUE, useMeasurementDuring = TRUE, useObservationDuring = TRUE, useVisitConceptCountDuring = TRUE), casePreTargetDuration = 365, casePostOutcomeDuration = 365, extractNonCaseCovariates = TRUE )
createAggregateCovariateSettings( targetIds, outcomeIds, minPriorObservation = 0, outcomeWashoutDays = 0, riskWindowStart = 1, startAnchor = "cohort start", riskWindowEnd = 365, endAnchor = "cohort start", covariateSettings = FeatureExtraction::createCovariateSettings(useDemographicsGender = TRUE, useDemographicsAge = TRUE, useDemographicsAgeGroup = TRUE, useDemographicsRace = TRUE, useDemographicsEthnicity = TRUE, useDemographicsIndexYear = TRUE, useDemographicsIndexMonth = TRUE, useDemographicsTimeInCohort = TRUE, useDemographicsPriorObservationTime = TRUE, useDemographicsPostObservationTime = TRUE, useConditionGroupEraLongTerm = TRUE, useDrugGroupEraOverlapping = TRUE, useDrugGroupEraLongTerm = TRUE, useProcedureOccurrenceLongTerm = TRUE, useMeasurementLongTerm = TRUE, useObservationLongTerm = TRUE, useDeviceExposureLongTerm = TRUE, useVisitConceptCountLongTerm = TRUE, useConditionGroupEraShortTerm = TRUE, useDrugGroupEraShortTerm = TRUE, useProcedureOccurrenceShortTerm = TRUE, useMeasurementShortTerm = TRUE, useObservationShortTerm = TRUE, useDeviceExposureShortTerm = TRUE, useVisitConceptCountShortTerm = TRUE, endDays = 0, longTermStartDays = -365, shortTermStartDays = -30), caseCovariateSettings = createDuringCovariateSettings(useConditionGroupEraDuring = TRUE, useDrugGroupEraDuring = TRUE, useProcedureOccurrenceDuring = TRUE, useDeviceExposureDuring = TRUE, useMeasurementDuring = TRUE, useObservationDuring = TRUE, useVisitConceptCountDuring = TRUE), casePreTargetDuration = 365, casePostOutcomeDuration = 365, extractNonCaseCovariates = TRUE )
targetIds |
A list of cohortIds for the target cohorts |
outcomeIds |
A list of cohortIds for the outcome cohorts |
minPriorObservation |
The minimum time (in days) in the database a patient in the target cohorts must be observed prior to index |
outcomeWashoutDays |
Patients with the outcome within outcomeWashout days prior to index are excluded from the risk factor analysis |
riskWindowStart |
The start of the risk window (in days) relative to the 'startAnchor'. |
startAnchor |
The anchor point for the start of the risk window. Can be '"cohort start"' or '"cohort end"'. |
riskWindowEnd |
The end of the risk window (in days) relative to the 'endAnchor'. |
endAnchor |
The anchor point for the end of the risk window. Can be '"cohort start"' or '"cohort end"'. |
covariateSettings |
An object created using |
caseCovariateSettings |
An object created using |
casePreTargetDuration |
The number of days prior to case index we use for FeatureExtraction |
casePostOutcomeDuration |
The number of days prior to case index we use for FeatureExtraction |
extractNonCaseCovariates |
Whether to extract aggregate covariates and counts for patients in the targets and outcomes in addition to the cases |
A list with the settings
aggregateSetting <- createAggregateCovariateSettings( targetIds = c(1,2), outcomeIds = c(3), minPriorObservation = 365, outcomeWashoutDays = 90, riskWindowStart = 1, startAnchor = "cohort start", riskWindowEnd = 365, endAnchor = "cohort start", casePreTargetDuration = 365, casePostOutcomeDuration = 365 )
aggregateSetting <- createAggregateCovariateSettings( targetIds = c(1,2), outcomeIds = c(3), minPriorObservation = 365, outcomeWashoutDays = 90, riskWindowStart = 1, startAnchor = "cohort start", riskWindowEnd = 365, endAnchor = "cohort start", casePreTargetDuration = 365, casePostOutcomeDuration = 365 )
This function creates a list of settings for different characterization studies
createCharacterizationSettings( timeToEventSettings = NULL, dechallengeRechallengeSettings = NULL, aggregateCovariateSettings = NULL )
createCharacterizationSettings( timeToEventSettings = NULL, dechallengeRechallengeSettings = NULL, aggregateCovariateSettings = NULL )
timeToEventSettings |
A list of timeToEvent settings |
dechallengeRechallengeSettings |
A list of dechallengeRechallenge settings |
aggregateCovariateSettings |
A list of aggregateCovariate settings |
Specify one or more timeToEvent, dechallengeRechallenge and aggregateCovariate settings
Returns the connection to the sqlite database
Other LargeScale:
loadCharacterizationSettings()
,
runCharacterizationAnalyses()
,
saveCharacterizationSettings()
# example code drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet )
# example code drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet )
This function executes a large set of SQL statements to create tables that can store results
createCharacterizationTables( connectionDetails, resultSchema, targetDialect = "postgresql", deleteExistingTables = TRUE, createTables = TRUE, tablePrefix = "c_", tempEmulationSchema = getOption("sqlRenderTempEmulationSchema") )
createCharacterizationTables( connectionDetails, resultSchema, targetDialect = "postgresql", deleteExistingTables = TRUE, createTables = TRUE, tablePrefix = "c_", tempEmulationSchema = getOption("sqlRenderTempEmulationSchema") )
connectionDetails |
The connectionDetails to a database created by using the
function |
resultSchema |
The name of the database schema that the result tables will be created. |
targetDialect |
The database management system being used |
deleteExistingTables |
If true any existing tables matching the Characterization result tables names will be deleted |
createTables |
If true the Characterization result tables will be created |
tablePrefix |
A string appended to the Characterization result tables |
tempEmulationSchema |
The temp schema used when the database management system is oracle |
This function can be used to create (or delete) Characterization result tables
Returns NULL but creates the required tables into the specified database schema.
Other Database:
createSqliteDatabase()
,
insertResultsToDatabase()
# create sqlite database charResultDbCD <- createSqliteDatabase() # create database results tables createCharacterizationTables( connectionDetails = charResultDbCD, resultSchema = 'main' )
# create sqlite database charResultDbCD <- createSqliteDatabase() # create database results tables createCharacterizationTables( connectionDetails = charResultDbCD, resultSchema = 'main' )
Create dechallenge rechallenge study settings
createDechallengeRechallengeSettings( targetIds, outcomeIds, dechallengeStopInterval = 30, dechallengeEvaluationWindow = 30 )
createDechallengeRechallengeSettings( targetIds, outcomeIds, dechallengeStopInterval = 30, dechallengeEvaluationWindow = 30 )
targetIds |
A list of cohortIds for the target cohorts |
outcomeIds |
A list of cohortIds for the outcome cohorts |
dechallengeStopInterval |
An integer specifying the how much time to add to the cohort_end when determining whether the event starts during cohort and ends after |
dechallengeEvaluationWindow |
An integer specifying the period of time after the cohort_end when you cannot see an outcome for a dechallenge success |
A list with the settings
Other DechallengeRechallenge:
computeDechallengeRechallengeAnalyses()
,
computeRechallengeFailCaseSeriesAnalyses()
drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 )
drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 )
Create during covariate settings
createDuringCovariateSettings( useConditionOccurrenceDuring = FALSE, useConditionOccurrencePrimaryInpatientDuring = FALSE, useConditionEraDuring = FALSE, useConditionGroupEraDuring = FALSE, useDrugExposureDuring = FALSE, useDrugEraDuring = FALSE, useDrugGroupEraDuring = FALSE, useProcedureOccurrenceDuring = FALSE, useDeviceExposureDuring = FALSE, useMeasurementDuring = FALSE, useObservationDuring = FALSE, useVisitCountDuring = FALSE, useVisitConceptCountDuring = FALSE, includedCovariateConceptIds = c(), addDescendantsToInclude = FALSE, excludedCovariateConceptIds = c(), addDescendantsToExclude = FALSE, includedCovariateIds = c() )
createDuringCovariateSettings( useConditionOccurrenceDuring = FALSE, useConditionOccurrencePrimaryInpatientDuring = FALSE, useConditionEraDuring = FALSE, useConditionGroupEraDuring = FALSE, useDrugExposureDuring = FALSE, useDrugEraDuring = FALSE, useDrugGroupEraDuring = FALSE, useProcedureOccurrenceDuring = FALSE, useDeviceExposureDuring = FALSE, useMeasurementDuring = FALSE, useObservationDuring = FALSE, useVisitCountDuring = FALSE, useVisitConceptCountDuring = FALSE, includedCovariateConceptIds = c(), addDescendantsToInclude = FALSE, excludedCovariateConceptIds = c(), addDescendantsToExclude = FALSE, includedCovariateIds = c() )
useConditionOccurrenceDuring |
One covariate per condition in the condition_occurrence table starting between cohort start and cohort end. (analysis ID 109) |
useConditionOccurrencePrimaryInpatientDuring |
One covariate per condition observed as a primary diagnosis in an inpatient setting in the condition_occurrence table starting between cohort start and cohort end. (analysis ID 110) |
useConditionEraDuring |
One covariate per condition in the condition_era table starting between cohort start and cohort end. (analysis ID 217) |
useConditionGroupEraDuring |
One covariate per condition era rolled up to groups in the condition_era table starting between cohort start and cohort end. (analysis ID 218) |
useDrugExposureDuring |
One covariate per drug in the drug_exposure table between cohort start and end. (analysisId 305) |
useDrugEraDuring |
One covariate per drug in the drug_era table between cohort start and end. (analysis ID 417) |
useDrugGroupEraDuring |
One covariate per drug rolled up to ATC groups in the drug_era table between cohort start and end. (analysis ID 418) |
useProcedureOccurrenceDuring |
One covariate per procedure in the procedure_occurrence table between cohort start and end. (analysis ID 505) |
useDeviceExposureDuring |
One covariate per device in the device exposure table starting between cohort start and end. (analysis ID 605) |
useMeasurementDuring |
One covariate per measurement in the measurement table between cohort start and end. (analysis ID 713) |
useObservationDuring |
One covariate per observation in the observation table between cohort start and end. (analysis ID 805) |
useVisitCountDuring |
The number of visits observed between cohort start and end. (analysis ID 926) |
useVisitConceptCountDuring |
The number of visits observed between cohort start and end, stratified by visit concept ID. (analysis ID 927) |
includedCovariateConceptIds |
A list of concept IDs that should be used to construct covariates. |
addDescendantsToInclude |
Should descendant concept IDs be added to the list of concepts to include? |
excludedCovariateConceptIds |
A list of concept IDs that should NOT be used to construct covariates. |
addDescendantsToExclude |
Should descendant concept IDs be added to the list of concepts to exclude? |
includedCovariateIds |
A list of covariate IDs that should be restricted to. |
creates an object specifying how during covariates should be constructed from data in the CDM model.
An object of type covariateSettings
, to be used in other functions.
Other CovariateSetting:
getDbDuringCovariateData()
settings <- createDuringCovariateSettings( useConditionOccurrenceDuring = TRUE, useConditionOccurrencePrimaryInpatientDuring = FALSE, useConditionEraDuring = FALSE, useConditionGroupEraDuring = FALSE )
settings <- createDuringCovariateSettings( useConditionOccurrenceDuring = TRUE, useConditionOccurrencePrimaryInpatientDuring = FALSE, useConditionEraDuring = FALSE, useConditionGroupEraDuring = FALSE )
This function creates a connection to an sqlite database
createSqliteDatabase(sqliteLocation = tempdir())
createSqliteDatabase(sqliteLocation = tempdir())
sqliteLocation |
The location of the sqlite database |
This function creates a sqlite database and connection
Returns the connection detail object to the sqlite database
Other Database:
createCharacterizationTables()
,
insertResultsToDatabase()
charResultDbCD <- createSqliteDatabase()
charResultDbCD <- createSqliteDatabase()
Create time to event study settings
createTimeToEventSettings(targetIds, outcomeIds)
createTimeToEventSettings(targetIds, outcomeIds)
targetIds |
A list of cohortIds for the target cohorts |
outcomeIds |
A list of cohortIds for the outcome cohorts |
An list with the time to event settings
Other TimeToEvent:
computeTimeToEventAnalyses()
# example code tteSet <- createTimeToEventSettings( targetIds = c(1,2), outcomeIds = 3 )
# example code tteSet <- createTimeToEventSettings( targetIds = c(1,2), outcomeIds = 3 )
This returns an object of class 'ConnectionDetails' that lets you connect via 'DatabaseConnector::connect()' to the example database.
exampleOmopConnectionDetails(exdir = tempdir())
exampleOmopConnectionDetails(exdir = tempdir())
exdir |
a directory to unzip the example OMOP database into. Default is tempdir(). |
Finds the location of the example database in the package and calls 'DatabaseConnector::createConnectionDetails' to create a 'ConnectionDetails' object for connecting to the database.
An object of class 'ConnectionDetails' with the details to connect to the example OHDSI OMOP CDM database
conDet <- exampleOmopConnectionDetails() connectionHandler <- ResultModelManager::ConnectionHandler$new(conDet)
conDet <- exampleOmopConnectionDetails() connectionHandler <- ResultModelManager::ConnectionHandler$new(conDet)
Extracts covariates that occur during a cohort
getDbDuringCovariateData( connection, oracleTempSchema = NULL, cdmDatabaseSchema, cdmVersion = "5", cohortTable = "#cohort_person", rowIdField = "subject_id", aggregated = TRUE, cohortIds = c(-1), covariateSettings, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), ... )
getDbDuringCovariateData( connection, oracleTempSchema = NULL, cdmDatabaseSchema, cdmVersion = "5", cohortTable = "#cohort_person", rowIdField = "subject_id", aggregated = TRUE, cohortIds = c(-1), covariateSettings, minCharacterizationMean = 0, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), ... )
connection |
The database connection |
oracleTempSchema |
The temp schema if using oracle |
cdmDatabaseSchema |
The schema of the OMOP CDM data |
cdmVersion |
version of the OMOP CDM data |
cohortTable |
the table name that contains the target population cohort |
rowIdField |
string representing the unique identifier in the target population cohort |
aggregated |
whether the covariate should be aggregated |
cohortIds |
cohort id for the target cohort |
covariateSettings |
settings for the covariate cohorts and time periods |
minCharacterizationMean |
the minimum value for a covariate to be extracted |
tempEmulationSchema |
Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created |
... |
additional arguments from FeatureExtraction |
The user specifies a what during covariates they want and this executes them using FE
A 'FeatureExtraction' covariateData object containing the during covariates based on user settings
Other CovariateSetting:
createDuringCovariateSettings()
conDet <- exampleOmopConnectionDetails() connection <- DatabaseConnector::connect(conDet) settings <- createDuringCovariateSettings( useConditionOccurrenceDuring = TRUE, useConditionOccurrencePrimaryInpatientDuring = FALSE, useConditionEraDuring = FALSE, useConditionGroupEraDuring = FALSE ) duringData <- getDbDuringCovariateData( connection <- connection, cdmDatabaseSchema = 'main', cohortIds = 1, covariateSettings = settings, cohortTable = 'cohort' )
conDet <- exampleOmopConnectionDetails() connection <- DatabaseConnector::connect(conDet) settings <- createDuringCovariateSettings( useConditionOccurrenceDuring = TRUE, useConditionOccurrencePrimaryInpatientDuring = FALSE, useConditionEraDuring = FALSE, useConditionGroupEraDuring = FALSE ) duringData <- getDbDuringCovariateData( connection <- connection, cdmDatabaseSchema = 'main', cohortIds = 1, covariateSettings = settings, cohortTable = 'cohort' )
This function uploads results in csv format into a result database
insertResultsToDatabase( connectionDetails, schema, resultsFolder, tablePrefix = "", csvTablePrefix = "c_" )
insertResultsToDatabase( connectionDetails, schema, resultsFolder, tablePrefix = "", csvTablePrefix = "c_" )
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_' |
Calls ResultModelManager uploadResults function to upload the csv files
Returns the connection to the sqlite database
Other Database:
createCharacterizationTables()
,
createSqliteDatabase()
# generate results into resultsFolder conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) runCharacterizationAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', outcomeDatabaseSchema = 'main', outcomeTable = 'cohort', cdmDatabaseSchema = 'main', characterizationSettings = cSet, outputDirectory = tempdir() ) # create sqlite database charResultDbCD <- createSqliteDatabase() # create database results tables createCharacterizationTables( connectionDetails = charResultDbCD, resultSchema = 'main' ) # insert results insertResultsToDatabase( connectionDetails = charResultDbCD, schema = 'main', resultsFolder = tempdir() )
# generate results into resultsFolder conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) runCharacterizationAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', outcomeDatabaseSchema = 'main', outcomeTable = 'cohort', cdmDatabaseSchema = 'main', characterizationSettings = cSet, outputDirectory = tempdir() ) # create sqlite database charResultDbCD <- createSqliteDatabase() # create database results tables createCharacterizationTables( connectionDetails = charResultDbCD, resultSchema = 'main' ) # insert results insertResultsToDatabase( connectionDetails = charResultDbCD, schema = 'main', resultsFolder = tempdir() )
This function converts the json file back into an R object
loadCharacterizationSettings(fileName)
loadCharacterizationSettings(fileName)
fileName |
The location of the the json settings |
Input the directory containing the 'characterizationSettings.json' file and load the settings into R
Returns the json settings as an R object
Other LargeScale:
createCharacterizationSettings()
,
runCharacterizationAnalyses()
,
saveCharacterizationSettings()
# example code setPath <- file.path(tempdir(), 'charSet.json') drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) saveCharacterizationSettings( settings = cSet, fileName = setPath ) setting <- loadCharacterizationSettings(setPath)
# example code setPath <- file.path(tempdir(), 'charSet.json') drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) saveCharacterizationSettings( settings = cSet, fileName = setPath ) setting <- loadCharacterizationSettings(setPath)
Specify the database connection containing the CDM data, the cohort database schemas/tables, the characterization settings and the directory to save the results to
runCharacterizationAnalyses( connectionDetails, targetDatabaseSchema, targetTable, outcomeDatabaseSchema, outcomeTable, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), cdmDatabaseSchema, characterizationSettings, outputDirectory, executionPath = file.path(outputDirectory, "execution"), csvFilePrefix = "c_", databaseId = "1", showSubjectId = FALSE, minCellCount = 0, incremental = TRUE, threads = 1, minCharacterizationMean = 0.01 )
runCharacterizationAnalyses( connectionDetails, targetDatabaseSchema, targetTable, outcomeDatabaseSchema, outcomeTable, tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"), cdmDatabaseSchema, characterizationSettings, outputDirectory, executionPath = file.path(outputDirectory, "execution"), csvFilePrefix = "c_", databaseId = "1", showSubjectId = FALSE, minCellCount = 0, incremental = TRUE, threads = 1, minCharacterizationMean = 0.01 )
connectionDetails |
The connection details to the database containing the OMOP CDM data |
targetDatabaseSchema |
Schema name where your target cohort table resides. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'. |
targetTable |
Name of the target cohort table. |
outcomeDatabaseSchema |
Schema name where your outcome cohort table resides. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'. |
outcomeTable |
Name of the outcome cohort table. |
tempEmulationSchema |
Some database platforms like Oracle and Impala do not truly support temp tables. To emulate temp tables, provide a schema with write privileges where temp tables can be created |
cdmDatabaseSchema |
The schema with the OMOP CDM data |
characterizationSettings |
The study settings created using |
outputDirectory |
The location to save the final csv files to |
executionPath |
The location where intermediate results are saved to |
csvFilePrefix |
A string to append the csv files in the outputDirectory |
databaseId |
The unique identifier for the cdm database |
showSubjectId |
Whether to include subjectId of failed rechallenge case series or hide |
minCellCount |
The minimum count value that is calculated |
incremental |
If TRUE then skip previously executed analyses that completed |
threads |
The number of threads to use when running aggregate covariates |
minCharacterizationMean |
The minimum mean threshold to extract when running aggregate covariates |
The results of the characterization will be saved into an sqlite database inside the specified saveDirectory
Multiple csv files in the outputDirectory.
Other LargeScale:
createCharacterizationSettings()
,
loadCharacterizationSettings()
,
saveCharacterizationSettings()
conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) runCharacterizationAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', outcomeDatabaseSchema = 'main', outcomeTable = 'cohort', cdmDatabaseSchema = 'main', characterizationSettings = cSet, outputDirectory = tempdir() )
conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) runCharacterizationAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', outcomeDatabaseSchema = 'main', outcomeTable = 'cohort', cdmDatabaseSchema = 'main', characterizationSettings = cSet, outputDirectory = tempdir() )
This function converts the settings into a json object and saves it
saveCharacterizationSettings(settings, fileName)
saveCharacterizationSettings(settings, fileName)
settings |
An object of class characterizationSettings created using |
fileName |
The location to save the json settings |
Input the characterization settings and output a json file to a file named 'characterizationSettings.json' inside the saveDirectory
Returns the location of the directory containing the json settings
Other LargeScale:
createCharacterizationSettings()
,
loadCharacterizationSettings()
,
runCharacterizationAnalyses()
drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) saveCharacterizationSettings( settings = cSet, fileName = file.path(tempdir(), 'cSet.json') )
drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) saveCharacterizationSettings( settings = cSet, fileName = file.path(tempdir(), 'cSet.json') )
This is a shiny app for viewing interactive plots and tables
viewCharacterization(resultFolder, cohortDefinitionSet = NULL)
viewCharacterization(resultFolder, cohortDefinitionSet = NULL)
resultFolder |
The location of the csv results |
cohortDefinitionSet |
The cohortDefinitionSet extracted using webAPI |
Input is the output of ...
Opens a shiny app for interactively viewing the results
conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) runCharacterizationAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', outcomeDatabaseSchema = 'main', outcomeTable = 'cohort', cdmDatabaseSchema = 'main', characterizationSettings = cSet, outputDirectory = file.path(tempdir(),'view') ) viewCharacterization( resultFolder = file.path(tempdir(),'view') )
conDet <- exampleOmopConnectionDetails() drSet <- createDechallengeRechallengeSettings( targetIds = c(1,2), outcomeIds = 3 ) cSet <- createCharacterizationSettings( dechallengeRechallengeSettings = drSet ) runCharacterizationAnalyses( connectionDetails = conDet, targetDatabaseSchema = 'main', targetTable = 'cohort', outcomeDatabaseSchema = 'main', outcomeTable = 'cohort', cdmDatabaseSchema = 'main', characterizationSettings = cSet, outputDirectory = file.path(tempdir(),'view') ) viewCharacterization( resultFolder = file.path(tempdir(),'view') )