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

Include each variable's quantity type (stock or flow) in the country metadata

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

Los mantenedores suelen responder en 3 días

@anth-volk ya está trabajando en esto.

Desde el 20/10/2026.

  • #3987 de @anth-volk — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
30/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Estancado
Stack tecnológico
fastapi, flask, python
Área
api, backend

Línea de trabajo

Start with PolicyEngineCountry.build_variables in policyengine_api/country.py and check how each variable exposes its quantity type. Add the requested quantityType field with the stock or flow value, then verify the shared metadata document includes it for variables such as household_rental_property_value. A linked pull request is already open, so this work is underway.

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

Descripción

What

Add each variable's quantity type to the variable descriptions that GET /{country_id}/metadata returns, as quantityType, with the value "stock" or "flow".

"household_rental_property_value": {
  "definitionPeriod": "year",
  "quantityType": "stock",
  "unit": "currency-USD",
  ...
}

Why

PolicyEngine core gives every variable a quantity_type:

  • "stock": a balance or value at one point in time, such as household_vehicles_value or household_rental_property_value in the US model, or mortgage_debt in the UK model;
  • "flow": an amount over a period, such as employment_income or rent.

A model sets it explicitly, or core picks a default: "stock" for yes-or-no, whole-number, list, text and date variables and for rates (unit /1), and "flow" for every other number.

The Public API's metadata leaves it out, so clients can't tell a balance from an amount per year. PolicyEngine/policyengine-app-v2#1360 shows "Annually" under each money input in the household builder, and leaves it off for stocks, but it can only do that once the metadata says which variables are stocks. Until then, money stocks such as "Rental property value" are labelled "Annually".

Scope

  • One new field per variable in PolicyEngineCountry.build_variables (policyengine_api/country.py). Both the Flask route and the native FastAPI route serve this same document, so both get the field.
  • Existing fields are unchanged. The field adds one short string per variable to a document that is already about 70MB for the US.
  • No database, route, or deployment change.
Lenguaje dominante
Python
Estrellas
18
Forks
33
Merge medio
2 d 6 h
PR fusionados (30 d)
32

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.