Runs a suite of diagnostic tests to assess the validity of SCC analysis assumptions. Version 1.6.0+ implements diagnostics aligned with SelfControlledCaseSeries package standards.

runSccDiagnostics(
  connection,
  cdmDatabaseSchema,
  tempEmulationSchema = getOption("sqlRenderTempEmulationSchema"),
  resultsTable,
  riskWindowsTable,
  outcomeTable = "condition_era",
  outcomeDatabaseSchema = cdmDatabaseSchema,
  analysisId,
  databaseId,
  estimates = NULL,
  controlType = "outcome",
  diagnostics = c("all"),
  thresholds = getDefaultDiagnosticThresholds(),
  computeThreads = getOption("strategus.SelfControlledCohort.computeThreads", default =
    parallel::detectCores() - 1),
  resultExportManager
)

Arguments

connection

DatabaseConnector connection instance

cdmDatabaseSchema

Name of database schema that contains OMOP CDM

tempEmulationSchema

Schema for temp table emulation (Oracle, Impala)

resultsTable

Name of the results table (contains counts)

riskWindowsTable

Name of the risk windows table

outcomeTable

Name of outcome table (e.g., "condition_era", "cohort")

outcomeDatabaseSchema

Schema containing outcome table

analysisId

Analysis identifier

databaseId

Database identifier for results export

estimates

Data frame of raw SCC results (including rr and se_log_rr)

controlType

Calibrate effect estimates with outcome (default) or exposure controls. Determines whether EASE is grouped by target or outcome.

diagnostics

Character vector of diagnostics to run. Options: "all", "mdrr", "pre_exposure_gain", "event_dependent", "ease"

thresholds

Named list of diagnostic thresholds (see getDefaultDiagnosticThresholds)

computeThreads

Number of parallel threads to use for CPU-bound diagnostic computations (e.g., MDRR and EASE). Default is the number of available cores minus 1.

resultExportManager

ResultModelManager::ResultExportManager instance

Value

Invisible data frame of diagnostic results

Examples

# \donttest{
if (interactive()) {
  connectionDetails <- Eunomia::getEunomiaConnectionDetails()
  connection <- DatabaseConnector::connect(connectionDetails)

  diagnostics <- runSccDiagnostics(
    connection = connection,
    cdmDatabaseSchema = "main",
    resultsTable = "#scc_results",
    riskWindowsTable = "#risk_windows",
    analysisId = 1,
    databaseId = "Eunomia",
    estimates = resultsData,
    diagnostics = "all",
    thresholds = getDefaultDiagnosticThresholds()
  )

  DatabaseConnector::disconnect(connection)
}
# }