SPB Git

spb/wp38_uqo

Public
14.5 KB

# External regional covariates — 17 Quebec administrative regions (WP38, Phase 5)

Built by src/ingest/external.py (idempotent; re-downloads from the manifest URLs, verifies SHA-256, rebuilds every derived file). Retrieval date of the current build: 2026-11-01 (see manifest.json, field retrieved_utc of each entry). No value in this folder was typed by hand; every cell of regions_external.csv is parsed from a file whose checksum is in manifest.json. Empty cells mean "not obtained", never zero.

text
.venv/bin/python src/ingest/external.py            # rebuild (downloads only what is missing)
.venv/bin/python src/ingest/external.py --refresh  # force re-download of all sources
.venv/bin/python src/ingest/external.py --strict   # abort if a re-downloaded source changed

Dependencies: pandas, requests, geopandas/shapely/pyproj (project venv) plus openpyxl (needed to read the ISQ .xlsx files; installed in .venv on 2026-11-01, not yet listed in pyproject.toml).

# Files

File What Size
regions_external.csv 17 rows × 72 columns: region_code, region_name, then for each indicator X, X_vintage, X_source 22 KB
manifest.json one entry per file: file, source_name, url, landing_page, retrieved_utc, licence, vintage, notes, sha256, bytes (+ content_sha256 for GeoPackages)
access_log.json HTTP status of the endpoints that were probed/blocked (www12.statcan.gc.ca = 403) and REST pull details
dl/ raw downloads exactly as served (ISQ xlsx/csv, StatCan csv zips, WDS json, ATN pdf) 5.6 MB
geo/qc_regions_admin_mern_bdat100k.gpkg MRNF Découpages administratifs 1:100 000, layers regions_admin (17 dissolved polygons), regio_s_raw (21), mrc_s_raw (138 MRC polygons with region code). EPSG:4269 17.5 MB
geo/qc_er_2021_statcan_cbf.gpkg StatCan 2021 Census economic region cartographic boundaries, Quebec (17 features). EPSG:4326 37 MB
geo/qc_fsa_2021_statcan_cbf.gpkg StatCan 2021 Census forward sortation area cartographic boundaries, Quebec (414 FSAs). EPSG:4326 44 MB
geo/qc_cd_2021_statcan_cbf_points.gpkg representative points of the 98 Quebec census divisions (polygons not kept, size) 0.1 MB
fsa_to_region_2021.csv FSA → region assignment (centroid-in-polygon and dominant-area share)
cd_to_region_concordance_2021.csv census division → StatCan ER and → MERN administrative region
ra_er_overlap_2021.csv measured overlap between MERN regions and StatCan 2021 ERs
mern_municipalites_attributes.csv MRNF municipality attribute table (municipality code → MRC → region), no geometry 0.25 MB

Total ≈ 104 MB (the 87 MB MRNF archive is deleted after extraction; its SHA-256 is in the manifest and in dl/mern_bdat_adm_100k_shp.zip.sha256; --keep-archives keeps it).

# Indicators in regions_external.csv

Column Definition Vintage Source (file in dl/) Geography / caveats
population Population estimate, 1 July 2025 p (provisional) ISQ table 3595 Estimations de la population des régions administratives (isq_population_ra_…xlsx, ISQ update 14 Jan 2026) Administrative regions as of 1 July 2025 (post-2021 Estrie/Montérégie change, post-2024 Courcelles merger). Underlying data: StatCan annual demographic estimates, adapted by ISQ.
population_statcan_er Population estimate, 1 July 2025 StatCan 17-10-0150-01 via WDS (statcan_17100150_…json, release 14 Jan 2026) 2021 Census ER boundaries: identical to ISQ except Estrie (359 469 vs 527 340), Montérégie (1 691 032 vs 1 522 372) and Chaudière-Appalaches (458 369 vs 459 158, Courcelles).
population_census_2021_er Census count Census 2021 StatCan 98-10-0009-01 (statcan_98100009-eng.zip) 2021 ER boundaries (same caveat).
business_locations_with_employees Number of business statistical locations with employees (employer locations), all industries December 2025 ISQ Nombre d'entreprises actives… (isq_entreprises_actives_ra_industrie_dec2025.xlsx), ISQ aggregation of StatCan 33-10-1097-01 (CSD-level), captured 2 March 2026 Employer locations only. Locations without employees are published only at the province level (ISQ file nombre-entreprises-actives-avec-ou-sans-employes…, not downloaded; StatCan 33-10-1096/1175 are provincial). 703 employer locations not assignable to a municipality are excluded from the regional sums. Cross-checked against the size-class file (…_municipalites_dec2025.xlsx): identical totals.
business_locations_with_employees_mfg_31_33 same, NAICS 31-33 Manufacturing Dec 2025 same
business_locations_with_employees_retail_44_45 same, NAICS 44-45 Retail trade Dec 2025 same
disposable_income_per_capita_cad Household disposable income per capita, current $ (SNA household-sector aggregate, ISQ regional economic accounts) 2024 p ISQ table 3962 (isq_revenu_disponible_ra_tableau_3962.csv, release 1 June 2026) Not comparable with MFQ tax statistics (ISQ note).
gdp_basic_prices_kcad GDP at basic prices, all industries (T001), thousands of current $ 2024 e (estimated) ISQ table 2299 PIB régional par industrie (isq_pib_regional_ensemble_ra.xlsx, sheet 2024e, update 15 Sep 2026) Provincial totals from StatCan 36-10-0487-01; regional split by ISQ.
gdp_mfg_31_33_kcad, gdp_retail_44_45_kcad same, Manufacturing (31-33) and Retail trade (44-45) 2024 e same X (confidential) cells would be empty; none for these two rows.
employment_lfs_thousands LFS employment, annual average, persons (thousands) 2025 StatCan 14-10-0464-01 (statcan_14100464-eng.zip, release 9 Jan 2026) LFS economic regions = 16: Côte-Nord and Nord-du-Québec are one LFS region → their cells are empty; the combined value is in employment_lfs_thousands_combined_09_10 (identical in both rows).
employment_lfs_mfg_thousands LFS employment, Manufacturing [31-33] 2025 StatCan 14-10-0466-01 same 16-region caveat
employment_lfs_wholesale_retail_thousands LFS employment, Wholesale and retail trade [41, 44-45] 2025 StatCan 14-10-0466-01 retail alone is not separated from wholesale in this table
unemployment_rate_pct, employment_rate_pct LFS rates, annual average 2025 StatCan 14-10-0464-01 combined 09+10 value in unemployment_rate_pct_combined_09_10
land_area_km2 Land area Census 2021 StatCan 98-10-0009-01 2021 ER boundaries
population_density_per_km2 Census population / land area Census 2021 StatCan 98-10-0009-01 2021 ER boundaries
polygon_area_mern_km2 Planar area of the MRNF region polygon computed in EPSG:6622 MRNF BDAT V2026-10 derived Includes inland and coastal water (MRNF regions extend over the estuary/gulf); use land_area_km2 for density.
households_internet_access_pct Share of households connected to the Internet 2012 ISQ EQAMI, table 3532 (isq_eqami_menages_branches_…csv) Only RA-level source found. Côte-Nord + Nord-du-Québec published combined → households_internet_access_pct_combined_09_10. The 2016 edition is .. at RA level.
statcan_eruid_2021 StatCan 2021 ER code matched by name 2021 98-10-0009-01
ra_er_boundary_iou_2021, share_of_statcan_er_land_inside_mern_ra measured overlap MRNF region vs StatCan ER (see below) derived
n_fsa_centroids_2021 number of 2021 FSAs whose representative point falls in the region 2021 derived from fsa_to_region_2021.csv

# Do StatCan economic regions coincide with the 17 administrative regions? (verified, with a boundary-vintage caveat)

  1. Definition. Statistics Canada, Standard Geographical Classification (SGC) 2016 – Introduction (https://www.statcan.gc.ca/en/subjects/standard/sgc/2016/introduction, date modified 2024-10-01, HTTP 200 on 2026-11-01): an ER is "a grouping of complete census divisions (with one exception in Ontario)" and "Within the province of Quebec, economic regions are designated by law (les régions administratives)." The 2021 Census Dictionary page (www12.statcan.gc.ca, ID=geo022) could not be read: HTTP 403 to non-browser clients (recorded in access_log.json). The 2021 Illustrated Glossary (92-195-X, date modified 2022-02-09) repeats the "grouping of complete census divisions" definition without Quebec-specific text.
  2. Names and count. StatCan tables 98-10-0009, 17-10-0150 and the 2021 ER boundary layer list exactly 17 Quebec ERs (codes 2410–2490) whose names are the 17 administrative regions (StatCan writes "Saguenay--Lac-Saint-Jean", "Gaspésie--Îles-de-la-Madeleine" with a double hyphen). LFS tables (14-10-0464/0466) merge Côte-Nord and Nord-du-Québec into one ER (16 regions).
  3. Boundaries (measured, ra_er_overlap_2021.csv). Share of the StatCan 2021 ER land polygon that lies inside the MRNF region polygon of the same name (V2026-10): ≥ 0.990 for 16 of 17 regions (Laval 1.000, Montréal 0.9997, Gaspésie 0.9996 …). The IoU is lower for coastal regions (Gaspésie 0.26, Côte-Nord 0.71, Bas-Saint-Laurent 0.80, Montréal 0.80) only because the MRNF polygons include marine water, which StatCan's cartographic files clip out. The one real difference is Montérégie: 0.793 (and Estrie 0.990 from the other side): the StatCan 2021 ERs still assign census divisions 2446 Brome-Missisquoi and 2447 La Haute-Yamaska to Montérégie (ER 2435), whereas the province moved these two MRCs to Estrie on 28 July 2021 (ISQ note 2 of table 3595). This is confirmed independently by the CD → region concordance (cd_to_region_concordance_2021.csv: 96 of 98 CDs agree; the two mismatches are exactly 2446 and 2447) and by the population comparison (population vs population_statcan_er: Estrie +167 871, Montérégie −168 660; the 789 gap between the two is Courcelles, see next paragraph). A second, minor difference: the municipality of Courcelles moved from Estrie (MRC Le Granit) to Chaudière-Appalaches (MRC Beauce-Sartigan) on 1 Jan 2024 (ISQ note 3) — ISQ 2025p counts differ by 789 persons from StatCan's 2021-boundary ER counts for Chaudière-Appalaches.

Conclusion. The claim holds by definition and by name (ERs = administrative regions by law), and spatially for 15 regions; for Estrie and Montérégie every StatCan ER-based series in this table (population_statcan_er, population_census_2021_er, land_area_km2, population_density_per_km2, all LFS columns) is on pre-28-July-2021 boundaries, while ISQ series (population, business counts, income, GDP) and the MRNF geometry are on current boundaries. Analyses must either (a) use ISQ series for those two regions, or (b) re-aggregate CD-level StatCan data with cd_to_region_concordance_2021.csv (column mern_region_code), or (c) keep the two regions merged ("Estrie + Montérégie") when mixing vintages.

# FSA → region assignment (fsa_to_region_2021.csv)

414 Quebec FSAs (2021 Census FSA file; exceededTransferLimit never hit, all object ids retrieved). Columns: region_code_centroid (representative point of the FSA polygon inside the MRNF region), er_region_code_centroid / eruid_centroid (same, inside the StatCan 2021 ER), region_code_dominant_area and dominant_area_share (largest area share of the FSA polygon across MRNF regions, overlay in EPSG:6622), n_regions_touched (regions with > 0.1 % of the FSA area), lon/lat of the representative point. Every FSA received a region. 40 FSAs straddle more than one region; the centroid and dominant-area rules disagree for 4 rural FSAs (G0S: 17 vs 12; J0G: 16 vs 17; J0J: 05 vs 16; J0T: 14 vs 15). Urban FSAs (H*, G1*, J4* …) are unambiguous. Merchants geocoded only to an FSA in these 40 FSAs should carry a geographic-uncertainty flag (Phase 5 robustness: "geographic uncertainty restrictions").

Why the REST service and not the zip: the StatCan download pages on www12.statcan.gc.ca return HTTP 403 to curl/requests (probed, access_log.json), whereas the same 2021 cartographic boundary files are served by Statistics Canada's official Esri REST service (geo.statcan.gc.ca, listed on the open.canada.ca record ef70dc3b-1069-4037-9bce-61f47e628a1d) under the same Open Licence. The server returns HTTP 500 for where+geometry queries, so features are paged by object id (batches of 10); a few very large polygons (Côte-Nord, Nord-du-Québec, the eight northern CDs, FSA G0G) are fetched one at a time with geometryPrecision=6 (≈ 0.1 m).

# What was NOT obtained (and what was tried)

Item Status
Business locations without employees by region Not published below province level (ISQ provincial file; StatCan 33-10-1175 provincial). Regional counts are employer locations only.
StatCan Canadian Business Counts by economic region No such table exists in the WDS cube list (checked 8 280 cubes): CBC is published by province (33-10-1174/1175) and by CMA/CSD (33-10-1176). The ISQ regional file is StatCan's CSD table aggregated to RA, so it was used instead; the CD→region concordance is provided for anyone re-aggregating CSD/CD counts.
Share of population living in CMAs by region Not assembled (no single official table; would require CSD-level census counts × MRNF municipality→region table mern_municipalites_attributes.csv).
Household Internet access / e-commerce by region, recent Provincial or grouped only: StatCan CIUS 22-10-0134/0135 (2022) = province × CMA/non-CMA (dl/statcan_22100134-eng.zip kept as evidence); ATN NETendances 2023 – commerce électronique (dl/atn_netendances_2023_commerce_electronique.pdf) reports 5 grouped zones (RMR Montréal, RMR Québec, Est, Centre, Ouest), not the 17 regions; ISQ EQAMI 2016 has only RMR/hors RMR. The only RA-level series is EQAMI 2012 (used, flagged).
2021 Census Dictionary ER definition page www12.statcan.gc.ca → HTTP 403; replaced by the SGC 2016 Introduction (statcan.gc.ca, HTTP 200) quoted above.
StatCan FSA/ER zip files on www12 HTTP 403; retrieved from the official REST service instead (see above).
Côte-Nord vs Nord-du-Québec split for LFS and EQAMI 2012 Published combined by the source; left empty + _combined_09_10 columns.

# Licences

ISQ products: reusable with attribution to the Institut de la statistique du Québec (conditions on statistique.quebec.ca). Statistics Canada tables and boundary files: Statistics Canada Open Licence. MRNF Découpages administratifs: CC-BY 4.0 (Données Québec). NETendances PDF: © ATN, kept for citation only.

Files · main
Menu

Theme