Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

_normalise_period_key drops the stop date of start.stop reform keys

Aperta
#724 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Start at _normalise_period_key and _normalise_policy in projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py, then trace how the normalised key flows into policyengine.core.Simulation(policy=...). Read compile_reform_to_policy in tax_benefit_models/common/reform.py and reform_dict_from_parameter_values in utils/parametric_reforms.py to see where end_date is dropped. Done when a bounded key like 2026-01-01.2026-12-31 stops applying after its stop date in a multi-year budget run; note the author has not executed this, so first reproduce with a small two-year simulation.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

_normalise_period_key (projects/policyengine-simulation-executor/src/policyengine_simulation_executor/simulation_runtime.py) reduces a start.stop period key to its start date:

def _normalise_period_key(period_key: Any) -> str:
    """Convert legacy ``start.stop`` period keys to v4 effective dates."""
    text = str(period_key)
    parts = text.split(".")
    if len(parts) > 1 and len(parts[0]) == 10:
        return parts[0]
    return text

_normalise_policy applies it to both the baseline and the reform policy before they reach policyengine.core.Simulation(policy=...). In policyengine.py main:

  • compile_reform_to_policy turns each {path: {date: value}} entry into a ParameterValue with end_date=None (tax_benefit_models/common/reform.py);
  • reform_dict_from_parameter_values (utils/parametric_reforms.py) runs such an open-ended value until the day before the next value of the same parameter starts, or to 2100-12-31.

So the stop date of a bounded app value never reaches the simulation. For example, {"2026-01-01.2026-12-31": 0.05} stays in force after 2026, until the next start date the policy gives that parameter, or to 2100. In a budget window, later years then use the reform value instead of the baseline.

This comes from reading sim-api main and policyengine.py main on 2026-10-06; I have not run it. The release bundle sim-api pins may resolve an older policyengine.py. Found while reviewing PolicyEngine/policyengine-us#9628.

Lingua principale
Python
Stelle
1
Fork
1
Merge medio
1g 7h
PR unite (30g)
24

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di PolicyEngine/policyengine-sim-api

Tutte le issue di PolicyEngine/policyengine-sim-api

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.