Build a Subset Cohort Definition (Demographic)
Source:R/buildDependentCohorts.R
buildSubsetCohortDemographic.RdCreates a SQL file and metadata for a subset cohort based on person-level demographics. Returns a CohortDef object ready to add to a CohortManifest.
Usage
buildSubsetCohortDemographic(
label,
baseCohortId,
minAge = NULL,
maxAge = NULL,
genderConceptIds = NULL,
raceConceptIds = NULL,
ethnicityConceptIds = NULL,
cohortsDirectory = NULL,
manifest = NULL
)Arguments
- label
Character. User-friendly name for the subset (e.g., "CKD - Males 40-75")
- baseCohortId
Integer. The cohort ID to subset.
- minAge
Integer. Minimum age at cohort start. NULL = no minimum. Default: NULL
- maxAge
Integer. Maximum age at cohort start. NULL = no maximum. Default: NULL
- genderConceptIds
Numeric vector. Gender concept IDs to include. NULL = all. Default: NULL
- raceConceptIds
Numeric vector. Race concept IDs to include. NULL = all. Default: NULL
- ethnicityConceptIds
Numeric vector. Ethnicity concept IDs to include. NULL = all. Default: NULL
- cohortsDirectory
Character. Path to inputs/cohorts/. Uses study hierarchy if not provided.
- manifest
CohortManifest object (optional). If provided, validates that base cohort exists. Recommended to ensure referential integrity. If NULL, a warning is issued.