Skip to content

Third-Party Data and Metadata

CCHS respondent data and bootstrap weights

This repository does not distribute CCHS respondent-level data, bootstrap weights, or derived respondent-level datasets. Each organization must obtain and use its files under its own authorization and applicable Statistics Canada or provincial data-sharing terms.

The MIT license in this repository applies to project code. It does not grant rights to CCHS microdata supplied separately by an analyst or organization.

CCHS harmonization metadata

Files named harmonization/CCHS_<year>.json, categories.json, and crosswalk.json are not distributed with this repository and are Git-ignored (see .gitignore). They contain variable descriptions, category labels, and mappings extracted or derived from cycle-specific CCHS codebook documentation, and the codebook itself is typically supplied to each organization under a Statistics Canada or provincial CCHS data-sharing agreement rather than the Statistics Canada Open Licence. Rather than resolve that licensing question on every organization's behalf, this repository ships only the extraction and harmonization code - each organization generates its own copies locally from its own authorized codebook.

To regenerate these files, see Adding a New CCHS Cycle:

  • scripts/extract_codebook.py parses variable names, concept descriptions, and answer-category tables out of a local codebooks/CCHS_<year>_DataDictionary_Freqs.pdf (also Git-ignored) into harmonization/CCHS_<year>.json. PDF text extraction can introduce ligature artifacts in descriptions (e.g. "file" rendered as "file") and is not guaranteed to produce perfect category mappings - review output before use.
  • scripts/build_crosswalk.py matches the most recent cycle's variables to the closest-matching variable description in each earlier cycle using fuzzy string matching (difflib, cutoff 0.6) to produce crosswalk.json. This is a heuristic concordance, not an authoritative Statistics Canada mapping - unmatched or ambiguous variables are recorded as null and should be verified manually.
  • scripts/harmonize_categories.py builds categories.json on top of crosswalk.json, normalizing category labels (e.g. "Yes"/"No"/"Valid skip"/"Don't know"/"Male"/"Female") across cycles with simple keyword rules. Labels that do not match a rule pass through unchanged.

None of these generated files contain respondent records, frequencies, or weights - only variable-level metadata. Before relying on them, or redistributing your own generated copies, confirm they remain consistent with your codebook's source documentation and the terms under which your organization obtained it.

Primary survey documentation is available from Statistics Canada:

If your codebook was sourced from a Statistics Canada Public Use Microdata File (PUMF) release, that documentation is covered by the Statistics Canada Open Licence, and the following acknowledgment applies to any metadata you derive from it and choose to redistribute:

Adapted from Statistics Canada, Canadian Community Health Survey (CCHS), Annual Component, cycle-specific Data Dictionary and Frequencies documentation. This does not constitute an endorsement by Statistics Canada of this product.

Note that CCHS PUMF releases use a smaller, disclosure-controlled variable set than the full annual-component share file (for example, StatCan's 2022 PUMF data dictionary lists roughly 255 variables, versus several hundred in a typical share-file extract), so a PUMF-derived cycle file will not match one generated from a share-file codebook variable-for-variable.

Geographic lookup metadata

The geographic lookup files contain public names, classifications, and codes used for interface labels and filtering. They contain no CCHS respondent records. They are adapted third-party data and are not licensed solely under the repository's MIT license.

Ontario census subdivisions

harmonization/ontario_csd_lookup.json is an Ontario subset and JSON adaptation of Statistics Canada's:

The repository file contains 577 Ontario census-subdivision records keyed by seven-digit SGC code. It retains Statistics Canada census-subdivision names and type abbreviations.

Required source acknowledgment:

Adapted from Statistics Canada, 2021 Census Geographic Attribute File, reference date January 1, 2021. This does not constitute an endorsement by Statistics Canada of this product.

Ontario official municipalities

harmonization/ontario_official_municipalities.json is an adapted subset of the Ontario Ministry of Municipal Affairs and Housing:

The source dataset provides municipality name, municipal status, and geographic area. The repository file contains all 414 lower-tier and single-tier records from the pinned source and adds Statistics Canada census-subdivision codes and normalized names. The 30 upper-tier source records are excluded because they are not census subdivisions. This is therefore a value-added join rather than an unmodified copy of the Ontario resource. The Statistics Canada acknowledgment above also applies to the incorporated codes and names.

Required Ontario source acknowledgment:

Contains information licensed under the Open Government Licence – Ontario.

Reproducibility

The lookups were regenerated on July 29, 2026, replacing earlier JSON whose exact source snapshots had not been recorded. Exact source URLs, dates, SHA-256 checksums, output checksums, record counts, and the transformation summary are stored in harmonization/geographic_lookup_provenance.json.

Regenerate and verify the files with:

uv run python scripts/generate_geographic_lookups.py
uv run pytest -q tests/test_geographic_lookups.py

The generator pins both downloads by checksum, repairs a documented encoding defect in the current Ontario CSV, rejects missing or ambiguous matches, and records explicit cross-vintage name overrides. To adopt a newer Ontario source or future Statistics Canada geography, update the source URL, checksum, dates, and any reviewed name mappings together.

Codebook PDFs

Codebook PDFs are local inputs used by the extraction scripts and are not distributed. codebooks/*.pdf is Git-ignored. Analysts must obtain codebooks from an authorized source and comply with the source terms.