_normalise_period_key drops the stop date of start.stop reform keys
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Start at _normalise_period_key and _normalise_policy in projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py, then trace how the normalised key flows into policyengine.core.Simulation(policy=...). Read compile_reform_to_policy in tax_benefit_models/common/reform.py and reform_dict_from_parameter_values in utils/parametric_reforms.py to see where end_date is dropped. Done when a bounded key like 2026-01-01.2026-12-31 stops applying after its stop date in a multi-year budget run; note the author has not executed this, so first reproduce with a small two-year simulation.
索引モデルが issue の本文から書いたものです。
説明
_normalise_period_key (projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py) reduces a start.stop period key to its start date:
def _normalise_period_key(period_key: Any) -> str:
"""Convert legacy ``start.stop`` period keys to v4 effective dates."""
text = str(period_key)
parts = text.split(".")
if len(parts) > 1 and len(parts[0]) == 10:
return parts[0]
return text
_normalise_policy applies it to both the baseline and the reform policy before they reach policyengine.core.Simulation(policy=...). In policyengine.py main:
compile_reform_to_policyturns each{path: {date: value}}entry into aParameterValuewithend_date=None(tax_benefit_models/common/reform.py);reform_dict_from_parameter_values(utils/parametric_reforms.py) runs such an open-ended value until the day before the next value of the same parameter starts, or to 2100-12-31.
So the stop date of a bounded app value never reaches the simulation. For example, {"2026-01-01.2026-12-31": 0.05} stays in force after 2026, until the next start date the policy gives that parameter, or to 2100. In a budget window, later years then use the reform value instead of the baseline.
This comes from reading sim-api main and policyengine.py main on 2026-10-06; I have not run it. The release bundle sim-api pins may resolve an older policyengine.py. Found while reviewing PolicyEngine/policyengine-us#9628.
- 主要言語
- Python
- スター
- 1
- フォーク
- 1
- 平均マージ
- 1日 11時間
- マージ済み PR(30日)
- 50
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PolicyEngine/policyengine-sim-api のほかの issue
-
Integration tests fail due to missing UV virtual environment setup対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
PolicyEngine/policyengine-sim-api#314 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
PolicyEngine/policyengine-sim-api#814 ·
メンテナーはふだん 1 日以内に返信
-
Register weighted-microdata rules: weights aren't values対応中かも @anth-volk が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
PolicyEngine/policyengine-sim-api#806 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
PolicyEngine/policyengine-sim-api#805 ·
メンテナーはふだん 1 日以内に返信
-
Refactor within ruff's complexity limits, then select every ruff rule (ALL)対応中かも @anth-volk が 2 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
PolicyEngine/policyengine-sim-api#803 ·
メンテナーはふだん 1 日以内に返信
PolicyEngine/policyengine-sim-api の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
UKGovernmentBEIS/control-arena#917 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
debpalash/VoiceStudio#2937 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
aws-samples/sample-per-model-bedrock#261 ·
メンテナーはふだん 1 日以内に返信