PolicyEngine / policyengine-us

The PolicyEngine US Python package contains a rules engine of the US tax-benefit system, and microdata generation for microsimulation analysis.
https://policyengine.org/us
GNU Affero General Public License v3.0
102 stars 175 forks source link

ParameterNotFoundError when running 2022 computations using default dataset #4099

Open MaxGhenis opened 7 months ago

MaxGhenis commented 7 months ago

The below code produces this error (notebook):

ParameterNotFoundError: The parameter 'gov.states.dc.dhs.tanf.need_standard.main.16' was not found in the 2022-01-01 tax and benefit system.

But it works when using dataset="cps_2022". Maybe this is more of a core issue, but we should give more intuitive error messages.

from policyengine_us import Microsimulation
from policyengine_core.periods import instant
from policyengine_core.reforms import Reform
import pandas as pd

def use_reported_state_tax(parameters):
    parameters.simulation.reported_state_income_tax.update(start=instant("2022-01-01"), stop=instant("2030-12-31"), value=True)
    return parameters

class baseline_reform(Reform):
    def apply(self):
        self.modify_parameters(use_reported_state_tax)

baseline = Microsimulation(reform=baseline_reform)
baseline.calc("snap", period=2022).sum()
MaxGhenis commented 7 months ago

This is likely causing 2022 microsimulations to fail: https://policyengine.org/us/policy?reform=14&focus=policyOutput.policyBreakdown&timePeriod=2022&region=us&baseline=2