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

Aberta
#4,161 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

@anth-volk já está trabalhando nisso.

Desde 3/11/2026.

  • #4162 de @anth-volk — aberto

Avaliação

Dificuldade
5/5
Tempo estimado
Mais de uma semana
Facilidade para iniciantes
12/100
Tipo de issue
Refatoração
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
postgresql, python, supabase
Domínio
database

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Python
Estrelas
18
Forks
33
Merge médio
2d 18h
PRs com merge (30d)
105

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de PolicyEngine/policyengine-api

Todas as issues de PolicyEngine/policyengine-api

Issues semelhantes

Mais issues de Python

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.