Define API behavior for outputs introduced by structural reforms
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 45/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
HouseholdCalculationService.calculate_household()、find_unrecognized_inputs()、および後続の country.calculate() 呼び出しから始めて、検証と改革の適用を追跡します。契約を選択する前に、API v2 の世帯計算への切り替えと関連する issue #1885 を確認します。通常の計算と軸計算が改革によって追加された出力を一貫して処理し、本当に未知の変数は引き続き拒否され、受け入れケースが網羅されていれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Problem
The household calculation API validates requested output-variable names against the baseline country metadata before constructing the tax-benefit system with the submitted reform. Consequently, a caller cannot request the value of a variable introduced by that reform.
For example, the Family Security Act structural reform adds pregnant_mothers_credit. A calculation requesting only baseline variables succeeds, and the reformed model can use pregnant_mothers_credit internally. Adding this output request to the household, however, produces HTTP 400:
{
"status": "error",
"message": "Unrecognized calculate input(s): Unrecognized household variable `pregnant_mothers_credit` at `household.tax_units.your tax unit.pregnant_mothers_credit`."
}
Cause
HouseholdCalculationService.calculate_household() calls find_unrecognized_inputs() with country.metadata. That metadata describes the unreformed system. The submitted policy is applied only afterward by country.calculate(), so validation cannot recognize variables added by the reform.
This differs from the cloning defect fixed by PolicyEngine/policyengine-core#294: the model can now resolve reform-added variables while calculating formulas, but API clients still cannot name those variables as requested outputs.
Expected behavior
Define and implement the API contract for reform-added output variables as part of the API v2 household-calculation compute cutover:
- If reform-added outputs are supported, validate household output requests against the effective reformed tax-benefit system and return the requested values.
- If they are intentionally unsupported, return a specific error explaining that distinction rather than reporting that a valid reform-added variable does not exist.
- Apply the same behavior to ordinary and axis calculations.
Acceptance coverage
- A structural reform introduces a new variable and uses it successfully as an internal dependency.
- Requesting that variable directly follows the chosen API contract.
- The behavior is covered both without axes and with an earnings axis.
- An actually unknown variable remains rejected.
Related: #1885.
- 主要言語
- Python
- スター
- 18
- フォーク
- 33
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 23
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
PolicyEngine/policyengine-api のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
PolicyEngine/policyengine-api#3847 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
PolicyEngine/policyengine-api#3823 ·
メンテナーはふだん 2 日以内に返信
-
API v2: report validations as an append-only, provenance-keyed resource on reports対応中かも @anth-volk が 20 日前に担当しました。 オープン
PolicyEngine/policyengine-api#3818 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
PolicyEngine/policyengine-api#3816 ·
メンテナーはふだん 2 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
PolicyEngine/policyengine-api#3811 ·
メンテナーはふだん 2 日以内に返信
PolicyEngine/policyengine-api の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
qgis/QGIS-Plugins-Website#459 ·
-
bug severity:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
bot-found bug priority: P3
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
madenvel/KalinkaPlayer#179 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
ls1intum/edutelligence#1098 ·
メンテナーはふだん 1 日以内に返信