execute: Execute Self-Controlled Cohort Analyses for Strategus

View source: R/StrategusModuleFunctions.R

executeR Documentation

Execute Self-Controlled Cohort Analyses for Strategus

Description

Executes Self-Controlled Cohort analyses within the OHDSI Strategus framework using the provided analysis specifications and settings.

Usage

execute(
  connectionDetails,
  executionSettings,
  analysisSpecifications,
  databaseId,
  exportFolder
)

Arguments

connectionDetails

An object containing the details required to connect to the database.

executionSettings

A list of settings for execution, including database schemas and cohort table names.

analysisSpecifications

A list containing analysis settings, exposure-outcome pairs, and compute thread count.

databaseId

A string identifier for the target database.

exportFolder

Path to the folder where results and exports will be written.

Details

This function validates the input specifications, extracts unique exposure and outcome cohort IDs, identifies negative control pairs, and iterates over each analysis setting to run the Self-Controlled Cohort analysis. Results are exported to the specified folder. Diagnostic settings are handled per-analysis, and warnings are issued if no negative controls are found.

Value

No return value. Results are written to the specified export folder as a side effect.

Examples


if (interactive()) {
eo1 <- createExposureOutcome(exposureId = 1124300, outcomeId = 444382)
analysis1 <- createSccAnalysis(analysisId = 1,
                              description = "Main",
                              runSelfControlledCohortArgs = createRunSelfControlledCohortArgs())

moduleSpec <- createSelfControlledCohortModuleSpecifications(
  analysisSettings = list(analysis1),
  exposureOutcomeList = list(eo1)
)
execute(
  connectionDetails = connectionDetails,
  executionSettings = list(
    databaseSchema = "main",
    cohortTable = "cohort",
    cdmDatabaseSchema = "main"
  ),
  analysisSpecifications = moduleSpec,
  databaseId = "MyDatabase",
  exportFolder = tempdir()
)
}


SelfControlledCohort documentation built on June 17, 2026, 5:07 p.m.