Record each run of a v2 simulation and report, and key results by run

Abierto
#4,161 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

@anth-volk ya está trabajando en esto.

Desde el 3/11/2026.

  • #4162 de @anth-volk — abierto

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
12/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
postgresql, python, supabase
Área
database

Línea de trabajo

The v2 simulation tables live in the Supabase database, so start with the schema migrations that create simulations, reports, report_runs and household_jobs, and the result tables they feed. The issue asks for a new simulation_runs table, a join record between report runs and simulation runs, and role grants for two new database roles, so the migration needs to apply cleanly before the roles exist. Done means the migration applies on a fresh database, existing rows are kept, and no foreign keys cross from the simulation API tables to the Public API tables.

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

Descripción

API v2's simulation tables in the v2 Supabase database (simulations, reports, report_runs, household_jobs and the result tables) were designed for an execution model where each simulation ran once. We now want every run of a simulation or a report saved, with the PolicyEngine.py and country package versions it used, so a re-run keeps the earlier results, and the simulation API and its Modal workers will write these rows themselves.

What needs to change in the v2 schema:

  • a simulation_runs table: one row per run of a simulation, with its versions, status, Modal call and output file, instead of execution columns on simulations;
  • a record of which simulation runs each report run combines, so a budget window's run can combine one pair per year;
  • result rows keyed by the run that produced them;
  • household_jobs shaped for one household, one year and one policy, with its versions and Modal call;
  • no foreign keys between the tables the simulation API writes and the tables the Public API writes: each service checks the rows it refers to;
  • table privileges for two new database roles, one for the simulation API and one for its Modal workers, declared so the deploy can apply them once an operator has created the roles, without failing before then.

No table is dropped.

Lenguaje dominante
Python
Estrellas
18
Forks
33
Merge medio
2 d 21 h
PR fusionados (30 d)
93

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.