Define API behavior for outputs introduced by structural reforms
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
- Área
- api, backend-api-design, testing-qa
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
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de PolicyEngine/policyengine-api
-
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
PolicyEngine/policyengine-api#3847 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 38/100
PolicyEngine/policyengine-api#3823 ·
Los mantenedores suelen responder en 2 días
-
API v2: report validations as an append-only, provenance-keyed resource on reportsPosiblemente ocupada @anth-volk la tomó hace 20 días. Abierto
PolicyEngine/policyengine-api#3818 · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
PolicyEngine/policyengine-api#3816 ·
Los mantenedores suelen responder en 2 días
-
Retry/backoff + friendly error mapping for simulation entrypoint 429s; cache the versions mapAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
PolicyEngine/policyengine-api#3811 ·
Los mantenedores suelen responder en 2 días
Todos los issues de PolicyEngine/policyengine-api
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
spec-kitty/spec-kitty#5319 ·
Los mantenedores suelen responder en 1 día
-
backend::vllm diffusion multimodal
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
openai/openai-agents-python#5229 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día