PolicyEngine / policyengine-app

PolicyEngine's free web app for computing the impact of public policy.
GNU Affero General Public License v3.0
35 stars 89 forks source link

Set premium_tax_credit to zero in autogenerated US Python code #956

Closed MaxGhenis closed 2 months ago

MaxGhenis commented 5 months ago

Since this has a random component (ZIP code assignment) it can generate volatile results, and we don't compute it in the app.

anth-volk commented 5 months ago

To be clear, at which autogeneration point were you thinking of doing this?

MaxGhenis commented 5 months ago

wdym? just add it to the household definition in the tax unit

MaxGhenis commented 2 months ago

Actually -- and not sure if this is what you were asking @anth-volk -- but we should ideally do this before we query the API. It seems like we must be doing this somewhere since it's not showing up in the results, but I don't see where. @nikhilwoodruff could you clarify?

Let's prioritize this though. I just got some bad results with the Python package from not setting it to zero.

MaxGhenis commented 2 months ago

Another developer building a Streamlit app also just got inconsistent results due to this. @anth-volk could you take or assign this after getting the API back up? cc @PavelMakarchuk @ThapeloMasasa

anth-volk commented 2 months ago

Sure. I'll come back here to ask for clarification if necessary.

anth-volk commented 2 months ago

Looks like the reason this isn't an issue in the API is because we only seed input variables, which this is not, and thus perhaps it's not calculated?

Also, would it not be better to just not assign a ZIP code to households? Or is that necessary for other pieces of the app? I could imagine the random assignment of that variable potentially impacting other values, as well.

Finally, when you say "but we should ideally do this before we query the API" - are you still looking for a solution that presets the variable to zero in the Reproduce in Python blocks? Because the Python packages don't access the API, right? I would imagine that presetting would have to occur in the US package, as opposed to the API?

MaxGhenis commented 2 months ago

Adding @nikhilwoodruff as he's dealt with this more in the past. We don't display the PTC in the web app because (a) the size of the parameters slows down the app considerably, and (b) we've refactored it for accuracy only in California. But I don't know how he did this. Simplest solution might be to remove it from the list of tax credits / benefits in the policyengine-us package.

anth-volk commented 2 months ago

Ah, discussed this with him about two hours ago, and I think we may both have misunderstood your intent on this one - we had thought you were still looking to add lines in the Reproduce in Python blocks to disable

MaxGhenis commented 2 months ago

That was my initial suggestion, but open to any solution to the general problem of Reproduce in Python not mirroring the web app. The mechanics of how we hide the PTC in the web app (which I don't know about) will influence this.

anth-volk commented 2 months ago

Okay, I'll chat more in-depth with Nikhil and formulate a strategy today.

anth-volk commented 2 months ago

Instead, we will remove the calculation of this from the US country package within the household_net_income calculation tree

anth-volk commented 2 months ago

Closing