Normalise country/ni and country/northern_ireland before the economy cache lookup
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 76/100
調査の方向性
policyengine_api/services/economy_service.pyから始め、_with_normalized_regionをconstants.pyにある_setup_regionおよびUK_REGION_REGISTRY_CODESとあわせて読み、キャッシュキーとシミュレーションのペイロードで地域名がどのように使われているかを追ってください。北アイルランドの両方の名前が同じキャッシュキーに解決されることを証明する、依頼されたテストを追加してください。保存済みレコードと既存のURLも引き続き機能するようにします。テストが通り、両方のリクエストが1つのキャッシュエントリーを共有すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
A UK request for Northern Ireland can arrive as country/ni (the UK metadata name, which the app sends) or as country/northern_ireland (the name in policyengine.py's UK region registry). The API maps the name only when it builds the simulation API payload, in EconomyService._setup_region (policyengine_api/services/economy_service.py, via UK_REGION_REGISTRY_CODES in constants.py). _with_normalized_region normalises US regions only, so the economy cache key is built from the region as requested.
As a result, the same Northern Ireland run (national or breakdown=local_areas) gets two cache entries and can be computed twice, once for each name. This came up in the review of #4024 (point 2).
Impact
Small today: the app always sends country/ni. It matters for any client that uses the registry name, and it doubles the cost of a Northern Ireland run when both names are used.
Proposed fix
Normalise UK regions before the cache lookup, in the same place as the US normalisation: map country/northern_ireland to one canonical name (or map both to the registry name), so both names share one cache entry. Keep saved records and existing URLs working. Add a test that both names resolve to the same cache key.
🤖 Generated with Claude Code
- 主要言語
- Python
- スター
- 18
- フォーク
- 33
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 56
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PolicyEngine/policyengine-api のほかの issue
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
PolicyEngine/policyengine-api#3911 ·
メンテナーはふだん 2 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
PolicyEngine/policyengine-api#3910 ·
メンテナーはふだん 2 日以内に返信
-
Serve economy reports on the v2 routes and save v2 report and simulation IDs対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
PolicyEngine/policyengine-api#4107 ·
メンテナーはふだん 2 日以内に返信
-
Drop the unused x and y columns from API v2's UK area impact tables対応中かも @anth-volk が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
PolicyEngine/policyengine-api#4102 ·
メンテナーはふだん 2 日以内に返信
-
Relock dependencies対応中かも @policyengine が 1 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 1/100
PolicyEngine/policyengine-api#4100 ·
メンテナーはふだん 2 日以内に返信
PolicyEngine/policyengine-api の issue をすべて見る
似ている issue
-
factory
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
Arize-ai/phoenix#17420 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
FireDynamics/LEDSmokeAnalysis#176 ·
メンテナーはふだん 1 日以内に返信
-
PC
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
dependencies
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
dlt-contrib/dlt-filesystem#51 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信