Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

_normalise_period_key drops the stop date of start.stop reform keys

Offen
#724 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
68/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
python
Bereich
backend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

_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.

Vorherrschende Sprache
Python
Sterne
1
Forks
1
Ø Merge
1 T. 7 Std.
Gemergte PRs (30 T.)
24

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus PolicyEngine/policyengine-sim-api

Alle Issues in PolicyEngine/policyengine-sim-api

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.