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

Define API behavior for outputs introduced by structural reforms

オープン
#3,814 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 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

環境構築

はじめの一歩

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

PolicyEngine/policyengine-api のほかの issue

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

似ている issue

Python の issue をもっと見る

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

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