PSLmodels / Tax-Brain

Tax-Brain is an integrator model for PSL tax models
http://taxbrain.pslmodels.org/
MIT License
9 stars 14 forks source link

Apply index parameters before other parameters #65

Closed hdoupe closed 5 years ago

hdoupe commented 5 years ago

The following reform was not converted correctly:

adj = {
    "ACTC_c": [
        {"year": 2019, "value": 2000.0},
        {"year": 2026, "value": 1000.0}
    ],
    "STD": [
        {"year": 2019, "MARS": "single", "value": 2000.0},
        {"year": 2020, "MARS": "mjoint", "value": 12345},
        {"year": 2026, "MARS": "single", "value": 1000.0}
    ],
    "STD_checkbox": [{"value": false}]
}

It appeared that indexing was not turned off for the STD parameter since values like 2000 were increased in years after it was set:

{
    "ACTC_c": {2019: 2000.0, 2026: 1000.0},
    "STD": {
        2019: [2000.0, 24537.6, 12268.8, 18403.2, 24537.6],
        2020: [2037.2, 12345, 12497.0, 18745.5, 24994.0],
        2026: [1000.0, 14081.96, 14255.34, 21383.0, 28510.66]},
    "STD-indexed": {2019: false}
}

It turned out that STD-indexed was only applied after the values were converted for the STD parameter. This PR applies all changes to indexing rules before converting the other parameters.

hdoupe commented 5 years ago

ping @andersonfrailey

andersonfrailey commented 5 years ago

Looks good, thanks @hdoupe