Runs complete post-processing workflow: merges results across all tasks for a specified pipeline version, generates reference files (cohortManifestSnapshot, databaseInfo, schema_review), runs QC validation on cohort completeness, and generates execution metadata.
Arguments
- pipelineVersion
Character. Pipeline version (e.g., "1.0.0")
- dbIds
Character vector of database configuration IDs from config.yml
- resultsPath
Character. Path to results root folder. Defaults to "exec/results"
- exportPath
Character. Path where combined results will be saved. Defaults to "dissemination/export/merge"
- cohortsFolderPath
Character. Path to cohorts folder for the CohortManifest. Defaults to "inputs/cohorts". If the path exists and contains a cohort manifest, generates a cohortManifestSnapshot.csv reference file.
- testMode
Logical or NULL. When TRUE, QC checks are non-fatal (errors become warnings) and qcStatus is set to "DevMode". When NULL (default), testMode is automatically set to TRUE for non-semver pipeline versions (e.g. "dev", "test") and FALSE for semantic versions (e.g. "1.0.0").
- compress
Logical. If TRUE, merged per-task result files are written as gzip-compressed
.csv.gzinstead of plain.csv(passed through toimportAndBind). Reference/QC files (databaseInfo.csv, cohortManifestSnapshot.csv, schema_review.csv, qc_*.csv) are always plain.csvregardless of this setting, since only merged results tend to get large.readr::read_csv()/spec_csv()read.csv.gzfiles transparently, so downstream code only needs to know a file may end in.gzwhencompress = TRUEwas used to produce it. Default: FALSE.
Value
Data frame summarizing all merged tasks with columns:
taskName: Name of the task
fileCount: Number of result files found for that task
totalRows: Total rows across all result files
filesExported: Comma-separated list of exported file names
Details
The function runs the complete post-processing workflow:
Captures git commit SHA for reproducibility tracking
Snapshots environment (renv.lock) for non-dev versions
Discovers tasks for the specified pipeline version
Merges results across all databases for each task via importAndBind()
Generates reference files: cohortManifestSnapshot.csv, databaseInfo.csv
Reviews schema of exported files (schema_review.csv)
Validates cohort completeness (qc_cohortValidation.csv)
Generates execution metadata (qc_processMeta.csv)
Output files created in version export folder:
Merged result CSVs (per task)
cohortManifestSnapshot.csv: Active cohort manifest at export time (id, label, filePath, hash, cohortType, timestamp)
databaseInfo.csv: Databases included in merge operation
schema_review.csv: Column-level inspection of all files
qc_cohortValidation.csv: Cohort completeness validation results
qc_processMeta.csv: Execution metadata (executionTimestamp, pipelineVersion, codeCommitSha, lockfileHash, databasesIncluded, qcStatus)
Expected folder structure: