SPB Git

spb/wp38_uqo

Public
14.5 KB · 137 lines markdown
1# External regional covariates — 17 Quebec administrative regions (WP38, Phase 5)23Built by `src/ingest/external.py` (idempotent; re-downloads from the manifest URLs, verifies SHA-256,4rebuilds every derived file). Retrieval date of the current build: 2026-11-01 (see `manifest.json`,5field `retrieved_utc` of each entry). **No value in this folder was typed by hand**; every cell of6`regions_external.csv` is parsed from a file whose checksum is in `manifest.json`. Empty cells mean7"not obtained", never zero.89```10.venv/bin/python src/ingest/external.py            # rebuild (downloads only what is missing)11.venv/bin/python src/ingest/external.py --refresh  # force re-download of all sources12.venv/bin/python src/ingest/external.py --strict   # abort if a re-downloaded source changed13```1415Dependencies: pandas, requests, geopandas/shapely/pyproj (project venv) **plus `openpyxl`** (needed to16read the ISQ .xlsx files; installed in `.venv` on 2026-11-01, not yet listed in `pyproject.toml`).1718## Files1920| File | What | Size |21|---|---|---|22| `regions_external.csv` | 17 rows × 72 columns: `region_code`, `region_name`, then for each indicator `X`, `X_vintage`, `X_source` | 22 KB |23| `manifest.json` | one entry per file: `file, source_name, url, landing_page, retrieved_utc, licence, vintage, notes, sha256, bytes` (+ `content_sha256` for GeoPackages) | |24| `access_log.json` | HTTP status of the endpoints that were probed/blocked (www12.statcan.gc.ca = 403) and REST pull details | |25| `dl/` | raw downloads exactly as served (ISQ xlsx/csv, StatCan csv zips, WDS json, ATN pdf) | 5.6 MB |26| `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 |27| `geo/qc_er_2021_statcan_cbf.gpkg` | StatCan 2021 Census **economic region** cartographic boundaries, Quebec (17 features). EPSG:4326 | 37 MB |28| `geo/qc_fsa_2021_statcan_cbf.gpkg` | StatCan 2021 Census **forward sortation area** cartographic boundaries, Quebec (414 FSAs). EPSG:4326 | 44 MB |29| `geo/qc_cd_2021_statcan_cbf_points.gpkg` | representative points of the 98 Quebec census divisions (polygons not kept, size) | 0.1 MB |30| `fsa_to_region_2021.csv` | FSA → region assignment (centroid-in-polygon **and** dominant-area share) | |31| `cd_to_region_concordance_2021.csv` | census division → StatCan ER and → MERN administrative region | |32| `ra_er_overlap_2021.csv` | measured overlap between MERN regions and StatCan 2021 ERs | |33| `mern_municipalites_attributes.csv` | MRNF municipality attribute table (municipality code → MRC → region), no geometry | 0.25 MB |3435Total ≈ 104 MB (the 87 MB MRNF archive is deleted after extraction; its SHA-256 is in the manifest and in36`dl/mern_bdat_adm_100k_shp.zip.sha256`; `--keep-archives` keeps it).3738## Indicators in `regions_external.csv`3940| Column | Definition | Vintage | Source (file in `dl/`) | Geography / caveats |41|---|---|---|---|---|42| `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. |43| `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). |44| `population_census_2021_er` | Census count | Census 2021 | StatCan 98-10-0009-01 (`statcan_98100009-eng.zip`) | 2021 ER boundaries (same caveat). |45| `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. |46| `business_locations_with_employees_mfg_31_33` | same, NAICS 31-33 Manufacturing | Dec 2025 | same | |47| `business_locations_with_employees_retail_44_45` | same, NAICS 44-45 Retail trade | Dec 2025 | same | |48| `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). |49| `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. |50| `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. |51| `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). |52| `employment_lfs_mfg_thousands` | LFS employment, Manufacturing [31-33] | 2025 | StatCan 14-10-0466-01 | same 16-region caveat |53| `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 |54| `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` |55| `land_area_km2` | Land area | Census 2021 | StatCan 98-10-0009-01 | 2021 ER boundaries |56| `population_density_per_km2` | Census population / land area | Census 2021 | StatCan 98-10-0009-01 | 2021 ER boundaries |57| `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. |58| `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. |59| `statcan_eruid_2021` | StatCan 2021 ER code matched by name | 2021 | 98-10-0009-01 | |60| `ra_er_boundary_iou_2021`, `share_of_statcan_er_land_inside_mern_ra` | measured overlap MRNF region vs StatCan ER (see below) | | derived | |61| `n_fsa_centroids_2021` | number of 2021 FSAs whose representative point falls in the region | 2021 | derived from `fsa_to_region_2021.csv` | |6263## Do StatCan economic regions coincide with the 17 administrative regions? (verified, with a boundary-vintage caveat)64651. **Definition.** Statistics Canada, *Standard Geographical Classification (SGC) 2016 – Introduction*66   (https://www.statcan.gc.ca/en/subjects/standard/sgc/2016/introduction, date modified 2024-10-01, HTTP 20067   on 2026-11-01): an ER is "a grouping of complete census divisions (with one exception in Ontario)" and68   "Within the province of Quebec, economic regions are designated by law (les régions administratives)."69   The 2021 Census Dictionary page (www12.statcan.gc.ca, ID=geo022) could not be read: **HTTP 403** to70   non-browser clients (recorded in `access_log.json`). The 2021 Illustrated Glossary (92-195-X, date71   modified 2022-02-09) repeats the "grouping of complete census divisions" definition without Quebec-specific text.722. **Names and count.** StatCan tables 98-10-0009, 17-10-0150 and the 2021 ER boundary layer list exactly73   17 Quebec ERs (codes 2410–2490) whose names are the 17 administrative regions (StatCan writes74   "Saguenay--Lac-Saint-Jean", "Gaspésie--Îles-de-la-Madeleine" with a double hyphen). LFS tables75   (14-10-0464/0466) merge Côte-Nord and Nord-du-Québec into one ER (16 regions).763. **Boundaries (measured, `ra_er_overlap_2021.csv`).** Share of the StatCan 2021 ER land polygon that77   lies inside the MRNF region polygon of the same name (V2026-10): ≥ 0.990 for 16 of 17 regions78   (Laval 1.000, Montréal 0.9997, Gaspésie 0.9996 …). The IoU is lower for coastal regions (Gaspésie79   0.26, Côte-Nord 0.71, Bas-Saint-Laurent 0.80, Montréal 0.80) **only because the MRNF polygons include80   marine water**, which StatCan's cartographic files clip out. The one real difference is81   **Montérégie: 0.793** (and Estrie 0.990 from the other side): the StatCan 2021 ERs still assign82   census divisions **2446 Brome-Missisquoi and 2447 La Haute-Yamaska to Montérégie (ER 2435)**, whereas83   the province moved these two MRCs to **Estrie on 28 July 2021** (ISQ note 2 of table 3595). This is84   confirmed independently by the CD → region concordance (`cd_to_region_concordance_2021.csv`: 96 of 9885   CDs agree; the two mismatches are exactly 2446 and 2447) and by the population comparison86   (`population` vs `population_statcan_er`: Estrie +167 871, Montérégie −168 660; the 789 gap between87   the two is Courcelles, see next paragraph).88   A second, minor difference: the municipality of Courcelles moved from Estrie (MRC Le Granit) to89   Chaudière-Appalaches (MRC Beauce-Sartigan) on 1 Jan 2024 (ISQ note 3) — ISQ 2025p counts differ by90   789 persons from StatCan's 2021-boundary ER counts for Chaudière-Appalaches.9192**Conclusion.** The claim holds *by definition and by name* (ERs = administrative regions by law), and93*spatially* for 15 regions; for **Estrie and Montérégie every StatCan ER-based series in this table94(population_statcan_er, population_census_2021_er, land_area_km2, population_density_per_km2, all LFS95columns) is on pre-28-July-2021 boundaries**, while ISQ series (population, business counts, income, GDP)96and the MRNF geometry are on current boundaries. Analyses must either (a) use ISQ series for those two97regions, or (b) re-aggregate CD-level StatCan data with `cd_to_region_concordance_2021.csv`98(column `mern_region_code`), or (c) keep the two regions merged ("Estrie + Montérégie") when mixing vintages.99100## FSA → region assignment (`fsa_to_region_2021.csv`)101102414 Quebec FSAs (2021 Census FSA file; `exceededTransferLimit` never hit, all object ids retrieved).103Columns: `region_code_centroid` (representative point of the FSA polygon inside the MRNF region),104`er_region_code_centroid` / `eruid_centroid` (same, inside the StatCan 2021 ER), `region_code_dominant_area`105and `dominant_area_share` (largest area share of the FSA polygon across MRNF regions, overlay in EPSG:6622),106`n_regions_touched` (regions with > 0.1 % of the FSA area), `lon`/`lat` of the representative point.107Every FSA received a region. 40 FSAs straddle more than one region; the centroid and dominant-area108rules disagree for 4 rural FSAs (G0S: 17 vs 12; J0G: 16 vs 17; J0J: 05 vs 16; J0T: 14 vs 15). Urban109FSAs (H*, G1*, J4* …) are unambiguous. Merchants geocoded only to an FSA in these 40 FSAs should carry a110geographic-uncertainty flag (Phase 5 robustness: "geographic uncertainty restrictions").111112Why the REST service and not the zip: the StatCan download pages on www12.statcan.gc.ca return113**HTTP 403** to curl/requests (probed, `access_log.json`), whereas the same 2021 cartographic boundary114files are served by Statistics Canada's official Esri REST service (geo.statcan.gc.ca, listed on the115open.canada.ca record ef70dc3b-1069-4037-9bce-61f47e628a1d) under the same Open Licence. The server116returns HTTP 500 for `where`+geometry queries, so features are paged by object id (batches of 10); a few117very large polygons (Côte-Nord, Nord-du-Québec, the eight northern CDs, FSA G0G) are fetched one at a time118with `geometryPrecision=6` (≈ 0.1 m).119120## What was NOT obtained (and what was tried)121122| Item | Status |123|---|---|124| 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. |125| 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. |126| 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`). |127| 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). |128| 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. |129| StatCan FSA/ER zip files on www12 | HTTP 403; retrieved from the official REST service instead (see above). |130| 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. |131132## Licences133134ISQ products: reusable with attribution to the Institut de la statistique du Québec (conditions on135statistique.quebec.ca). Statistics Canada tables and boundary files: Statistics Canada Open Licence.136MRNF *Découpages administratifs*: CC-BY 4.0 (Données Québec). NETendances PDF: © ATN, kept for citation only.137
Files · main
Menu

Theme