Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Request UK constituency and local-authority impacts separately from the national economy result

未关闭
#4,021 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

@anth-volk 已经在做这个了。

开始于 2026年10月22日。

  • #4024 来自 @anth-volk —— 未关闭

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
停滞
技术栈
fastapi, python
领域
api, backend

调研方向

Read the annual economy route and its request validation, calculation options and cache key handling, then trace how it builds simulation API requests and handles upstream errors. Check the existing dataset and .py bundle configuration for the requested updates, including the Northern Ireland region mapping. Done means the supported UK requests produce separately cached local-area results and invalid combinations or upstream refusals return the specified errors; coordinate deployment with simulation API change #881 and the app change.

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

描述

What this is about

.py 6.10.0 runs UK national economy reports on a national dataset (microcosm_uk_2024_25) that has no area codes, so a national run no longer returns constituency or local-authority impacts. The simulation API (PolicyEngine/policyengine-sim-api#881) adds a separate run on the local-area dataset that returns only those impacts. The Public API needs a way to ask for that run.

What changes in the Public API

  • The annual economy route, GET /{country}/economy/{reform}/over/{baseline}, accepts a new optional query parameter, breakdown=local_areas. The budget-window route does not accept it.
  • The parameter is valid only for the UK, with region set to uk or a UK country (country/*), and not with target=cliff. Any other combination, or any other value, returns HTTP 400.
  • When the parameter is set, it becomes part of the calculation options, so the request gets its own options hash and its own cached result. Requests without it keep their current options hash and cached results.
  • The Public API sends "breakdown": "local_areas" to the simulation API only when the parameter is set, and stores and returns the result the simulation API sends back (kind: "local_areas", with constituency_impact and local_authority_impact).
  • If the simulation API refuses a breakdown request with HTTP 400 or 422 (for example, because the deployed .py release cannot run it), the Public API returns a 502 error that says so, instead of a generic 500.
  • UK reports for Northern Ireland use country/ni in the Public API's metadata, but .py's region registry names that region country/northern_ireland. The Public API translates the name when it builds the simulation request.
  • The .py bundle moves from 6.7.5 to 6.10.0 (this replaces #3991), and the reviewed UK default dataset becomes microcosm_uk_2024_25.

Order of deployment

This change has to merge after the simulation API change (PolicyEngine/policyengine-sim-api#881) is deployed with .py 6.10.0, and after the app change that requests the breakdown is merged.

主要语言
Python
星标
18
派生
33
平均合并
2 天 18 小时
30 天内合并 PR
36

环境准备

从这里开始

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

PolicyEngine/policyengine-api 的其他 Issue

查看 PolicyEngine/policyengine-api 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

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