Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Normalise country/ni and country/northern_ireland before the economy cache lookup

オープン 初心者向け
#4,037 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api, backend, databases

調査の方向性

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

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

PolicyEngine/policyengine-api のほかの issue

PolicyEngine/policyengine-api の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。