-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Upgrade to Tax-Calculator 0.15.0 #808
Conversation
b14ef23
to
d84d42c
Compare
On my local machine, I got the following error when I tried to change the start year to 2018: It looks like I forgot to add a cpi field for this parameter. This is simple to fix. However, there is a bigger problem with the PolicyBrain cpi button logic. The following code snippet is where PolicyBrain determines if a parameter should have a cpi button or not:
The problem is that most of the parameters are marked as inflatable if their value is greater than one. This is a heuristic for determining if a parameter is inflatable. Rates are not inflatable and are lower than one. Bracket ceilings for example are greater than one and are inflatable. This fails for parameters like Is there a better way to determine from the |
Thanks @martinholmer. My interpretation of that attribute was that all parameters where |
@martinholmer I've been updating test data and I just got an interesting result with the following script:
and output:
Why do you think that I'm getting errors for II_brk4_3 when it is not changed? |
@hdoupe said:
You are correct. In fact, as far as I can see, in Tax-Calculator any policy parameter that has When a user of the TaxBrain GUI form changes the value of |
@hdoupe specified this reform:
and when he implemented it, he got these error messages:
which prompted this question:
You are correct that this is a puzzle. It took me some time to come up with the puzzle solution. (Or, at least what I think is a solution. If you don't agree, then we can delve further into this matter.) The 2017 value of
Your JSON reform file is translated by Tax-Calculator into this reform:
which means these five
So Tax-Calculator generates this (unexpected to us) error message for 2018:
And the same error is generated in years after 2018 because So, in the end, the unexpected error messages are appropriate. Another way to understand the solution to this puzzle is to confirm that when your reform is changed to start in 2018 instead of 2017, the error messages would be only about |
@martinholmer said
Ah, ok. I understand now. Thanks for clearing this up. TaxBrain has always decided whether a parameter can be inflated or not. For example, the rate does not have a cpi button but the ceiling does: It seems like the proper way to solve this is to give each parameter a CPI button except for boolean type parameters. Does this line up more closely with how Tax-Calculator treats parameters? |
@hdoupe said:
That would be closer to what Tax-Calculator is doing now, but your questions on this matter reveal that the real problem is that Tax-Calculator's |
Ok, adding some type of inflatable attribute makes sense to me. The only other name I can think of is |
@hdoupe said:
OK. I'll start on this enhancement now with hopes for a new release later today. |
@martinholmer Thanks for the quick response, but there's no big rush. Enjoy your weekend. I still have to solve some other problems on this PR, and it won't be ready until end of Monday at the earliest. |
@hdoupe, the taxcalc packages for Tax-Calculator release 0.15.1 are now available. Let me know if you have any questions or problems using the 0.15.1 release. |
@martinholmer Thanks for the in-depth diagnosis. That makes perfect sense. The fifth bracket decreased in 2018 due to the TCJA, but the fourth bracket was frozen since I specified the single parameter. Thus, the fifth bracket was set lower than the fourth bracket and we got our errors. |
@hdoupe said:
Exactly. That's an excellent way to describe what's going on. |
Using the new
Fixing this under the current approach of storing each parameter to a column in a database would involve extensive changes to the database. Given the magnitude of these changes, I think this is a good time to make the swap to storing the run parameters primarily as JSON files. This idea was first raised in #435, @GoFroggyRun has mentioned this, and @codekansas has also suggested that we move away from our current approach. This would have no effect on the file upload runs, and the raw input from the GUI is parsed as a dictionary that is built from the attributes of the model object (i.e. One solution is to create a decorator like we did for the new results table names. If the version of PB is less than 1.4.0 (would be a minor bump to 1.4.0 if we do this change), then we form the JSON object from the raw fields and serve that to the parsing functions. This would require saving all of the no longer needed fields though. @GoFroggyRun @codekansas what do you think? |
With the most recent commit, all tests are passing for PR #808. To summarize the work done so far, the tests have been refactored to further separate the "data" from the "code" as suggested by @codekansas here, and PolicyBrain has been updated to Tax-Calculator 0.15.1. The environment setup scripts were also altered to get the travis build to pass. A bug involving how PolicyBrain decides whether a parameter is inflatable or not was discovered by upgrading to Tax-Calculator 0.15.1. Except for the CPI bug, this PR is ready to be reviewed and merged afterwards. I think that we should merge this PR as it is (with modifications if suggested in the review) and begin work on the CPI bug and the larger data storage modifications in a separate PR. Doing this in a separate PR has a two main benefits:
Unless there are any objections, this is how we will proceed. |
This discussion might be relevant to updating presets on TaxBrain to account for the new baseline. |
@hdoupe said:
Definitely agree. Regarding backward compatibility, I'm not sure whether we want to store "all of the no longer needed fields." Would it be easier to preserve backward compatibility if we just provide the reform file ran, not necessarily via GUI, and its results (which I think is the point of preserving the compatibility)? We don't have to worry too much when fields were added or removed, while users are able to archive what they ran along with the results and cite whatever they need. |
Thanks for the link @MattHJensen. The presets will definitely need to be addressed. It seems to me that all of the presets are still valid (except for the TCJA preset) but are compared to the new post-TCJA baseline instead of the pre-TCJA baseline. I think that the TCJA preset should also be swapped with the |
@GoFroggyRun said
Right, they could pull up the results just fine no matter what we do with the parameters. However, we need the fields data to provide the edit parameters page for previous runs. I think there are a couple solutions:
(3) seems like the easiest but laziest option. (2) is risky since we are doing a lot of work on the database, but I guess we could back up the database. (1) probably consumes the most time.
The major downside of (4) is the user won't have a way to review the parameters used to get an archived result. |
I plan to begin working on solution (3) in a separate PR. This will allow us to get a fix out faster, and it allows us to go back and implement a more permanent solution in the future. If anyone has any objections to this plan then please let me know and we can discuss it further. I will also kick the preset addition to a separate issue/PR that will be completed before the end of this release cycle. |
@hdoupe what I have in mind is more like your (4). By providing the reform files ran, we don't necessarily have to allow users to always be able to edit their previous runs, via GUI, as PB releases go. A reform/assumption file and tax-calculator version (and TaxData version once available) should be sufficient for a user to recreate (theoretically) his/her results and provide citation, which, in my opinion, are the primary reasons we care about backward compatibility. For example, the file upload page doesn't support editing, and thus makes its maintenance easier than GUI page in terms of backward compatibility. Maybe we can do something similar: once those GUI runs got stale, we make GUI re-editing not available, yet store reform/assumption information likewise in the file-upload way. |
No description provided.