Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Define API behavior for outputs introduced by structural reforms

Abierto
#3,814 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
45/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python

Línea de trabajo

Comienza con HouseholdCalculationService.calculate_household(), find_unrecognized_inputs() y la llamada posterior a country.calculate() para rastrear la validación frente a la aplicación de reformas. Revisa el cambio a la operación de cálculo de hogares de API v2 y el issue relacionado #1885 antes de elegir el contrato. Se considerará terminado cuando los cálculos ordinarios y de ejes gestionen de forma coherente las salidas añadidas por reformas, las variables realmente desconocidas sigan siendo rechazadas y los casos de aceptación estén cubiertos.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
18
Forks
33
Merge medio
1 d 3 h
PR fusionados (30 d)
23

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de PolicyEngine/policyengine-api

Todos los issues de PolicyEngine/policyengine-api

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.