generatePrevalence.RdUnified function for running one or more prevalence analyses with comprehensive result management. Replaces separate generateSinglePrevalence and generateMultiplePrevalence functions.
generatePrevalence(
prevalenceAnalysisList,
executionSettings,
captureSql = TRUE
)A CohortPrevalenceAnalysis R6 object or list of such objects
An executionSettings R6 object with connection and schema details
Logical. If TRUE (default), capture rendered SQL queries for audit trail
A PrevalenceResults R6 object containing all results with full provenance tracking
This function consolidates analysis execution and result collection into a single workflow. Results include prevalence, incidence, and drug usage data as configured in the analysis objects. SQL queries are captured with SHA256 checksums for reproducibility verification.
When running multiple analyses from a CohortPrevalenceExperiment, use the experiment's
define() method to obtain the analysis list, then pass it to this function:
exp <- CohortPrevalenceExperiment$new(...)$
addCohorts(...)$
addPrevalenceTypes(...)$
# ... configure dimensions ...
validate()
analyses <- exp$define()
results <- generatePrevalence(analyses, executionSettings)