Compute statistics from risk windows.
getSccRiskWindowStats(
connection,
outcomeDatabaseSchema,
databaseId,
tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
outcomeIds = NULL,
outcomeTable = "condition_era",
firstOutcomeOnly = TRUE,
resultsDatabaseSchema = NULL,
riskWindowsTable = "#risk_windows",
resultExportPath = "scc_result",
analysisId = 1,
resultExportManager = ResultModelManager::createResultExportManager(tableSpecification
= getResultsDataModelSpecifications(), exportDir = resultExportPath, databaseId =
databaseId)
)DatabaseConnector connection instance
The name of the database schema that is the location where the data used to define the outcome cohorts is available. If exposureTable = CONDITION_ERA, exposureDatabaseSchema is not used by assumed to be cdmSchema. Requires read permissions to this database.
Unique identifier for database - required
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.
The condition_concept_ids or cohort_definition_ids of the outcomes of interest. If empty, all the outcomes in the outcome table will be included.
The tablename that contains the outcome cohorts. If outcomeTable <> CONDITION_OCCURRENCE, then expectation is outcomeTable has format of COHORT table: COHORT_DEFINITION_ID, SUBJECT_ID, COHORT_START_DATE, COHORT_END_DATE.
If TRUE, only use first occurrence of each condition concept id for each person.
Schema to oputput results to. Ignored if resultsTable and riskWindowsTable are temporary.
String: optionally store the risk windows in a (non-temporary) table.
Folder where result files are exported
An integer unique to this analysis
ResultModelManager::ResultExportManager instance - customize this to implement an alternative mechanism for exporting results
list containing data frames: treatmentTimeDistribution, timeToOutcomeDistribution, timeToOutcomeDistributionExposed, timeToOutcomeDistributionUnexposed
Requires a risk window table to be created first with `runSccRiskWindows`
if (FALSE) { # \dontrun{
# First, create the risk windows table
connectionDetails <- Eunomia::getEunomiaConnectionDetails()
connection <- DatabaseConnector::connect(connectionDetails)
riskWindowsTable <- "computed_risk_windows"
runSccRiskWindows(connection,
cdmDatabaseSchema = "main",
exposureIds = c(1102527, 1125315),
resultsDatabaseSchema = "main",
riskWindowsTable = riskWindowsTable,
exposureTable = "drug_era")
# Get stats based on outcomes of interest
tarStats <- getSccRiskWindowStats(connection,
outcomeDatabaseSchema = "main",
resultsDatabaseSchema = "main",
riskWindowsTable = riskWindowsTable,
outcomeTable = "condition_era",
outcomeIds = 192671)
} # }