Provide geographic attribute files as hosted parquet, including pre-2006 censuses

未关闭
#233 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@mountainMath 已经在做这个了。

开始于 2026年11月5日。

  • #232 来自 @mountainMath —— 未关闭

评估

难度
5/5
预计耗时
一周以上
新手友好度
38/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
r
领域
backend, data

调研方向

Start by checking the R implementation of get_statcan_geographic_attributes() and the hosted storage status described in the issue; then inspect the listed source files and layouts for the older censuses. The work also requires deciding how to expose differing census fields and documenting provenance. Done means the missing parquet files are hosted with source and licence metadata, and the function can read them across the intended census years.

由索引模型根据 Issue 内容生成。

描述

enhancement

The geographic attribute files are useful well beyond TongFen: they link the lowest census geography to the higher levels, with population, dwellings and representative points. get_statcan_geographic_attributes() only covers 2006 to 2021 and downloads from StatCan, which now puts at least the 2021 file behind a browser check (#228).

This proposes serving the attribute files as hosted parquet, written with r2parquet, and adding the older censuses.

Files

Census Source Base geography Records
2021, 2016, 2011, 2006 92-151 attribute files DB Not counted here
2001 GeoSuite 2001 geosuite2001.mdb, tables CB and DA Block, DA 478,707 blocks, 52,993 DAs
1996 GAF1996.txt EA 49,361
1991 gaf91.txt EA 45,995
1986 GAF1986.txt EA 44,042
1981 GAF1981.txt EA 41,197

I haven't found a separate 2001 attribute file. The GeoSuite CB table has similar content: population, dwellings, representative points, and the codes for higher levels. If StatCan did release a 2001 attribute file, it should replace this.

Hosting status

I found no attribute files in the public mountainmath S3 bucket under the tongfen, cancensus, statcan, census, gaf or attribute prefixes, and the existing mirror holds only correspondence files. R2 still needs checking, as I couldn't list its buckets.

What needs doing

  • Confirm what's already hosted on R2, then convert and upload what's missing, with the source and the Statistics Canada Open Data licence in the parquet footer.
  • Extend get_statcan_geographic_attributes() to the older years and read from the hosted files. Keep the provenance visible, since re-hosting is the concern raised in #228.
  • Parse the older fixed-width layouts, which have a different structure for each census.
  • Decide whether to return columns as released or harmonised across years. As released is simpler and closer to the source, but the older EA-based files have quite different fields from the DB-based ones.
  • Decide on the function's scope. The existing name still fits, but pre-2006 results are at EA level.
  • Consider the same treatment for get_statcan_geo_suite(). Its 2001 download URL returned a Cloudflare challenge (HTTP 403) when tested from a script.

Related: mountainMath/tongfen#22, which covers the correspondence files for the same censuses.

主要语言
HTML
星标
90
派生
14
PR 合并指标
30 天内没有已合并 PR

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

mountainMath/cancensus 的其他 Issue

查看 mountainMath/cancensus 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。