-
Notifications
You must be signed in to change notification settings - Fork 75
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
Include bracket rates and thresholds in scale descendants #1113
base: master
Are you sure you want to change the base?
Include bracket rates and thresholds in scale descendants #1113
Conversation
Hello, Thank you for this fix! Just in case, did/could you test it on the Web API?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally on the Web API and:
-
The command
openfisca serve
runs without error 🙌 -
Requesting the ParameterScale taxes.social_security_contribution works and gives the same result as before this PR 🙌
Request (and
jq
formatting):curl http://127.0.0.1:5000/parameter/taxes.social_security_contribution | jq
-
But requesting all the parameters lists now scale elements as parameters which would be an issue for Web API users. For example, the list contains:
taxes.social_security_contribution[INDEX].threshold
- and
taxes.social_security_contribution[INDEX].rate
when, for this scale it should only contain
taxes.social_security_contribution
.
Fix this issue before merging this PR?Request (and
jq
formatting):curl http://127.0.0.1:5000/parameters
And, later, if you both agree that this Web API issue is fixed, you can dismiss my review.
if not returned_any_results: | ||
return iter(()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an example where this situation occurs? 🤔 It could be added as a test.
Thanks for this review, @sandcha. On your last point, I'm not sure if I follow: this PR intends to do exactly as you say. For example, in the UK we have a progressive income tax scale, but the rates have specific names ("basic rate", "higher rate", "additional rate"). We'd like to surface these parameters without having to take them outside of their parameter scale, using |
If I understand correctly, in the parameter scale, they would only be accessible through their numeric index. How would exposing them this way enable you to name them? 🤔 Alternative implementationsI understand the value in using a value both as a named one and as part of a parameter scale. The only way I know of this being implemented in the OF-FR corpus is by defining a legal constant (“plafond de la sécurité sociale”) as a parameter and expressing scales as multiples of it ( WeightThe main issue I can see with this change is how much larger the @sandcha since you ran this branch locally, could you please provide us with the file size increase for a large corpus such as OF-FR? As a baseline, |
Thanks @MattiSG:
Ah, I should mention we've added a
This is a very interesting idea I hadn't thought of. Would this be the first feature that enables
Yes, this is a good point I hadn't considered. |
In the example I gave, this “dependency” is only made clear through documentation and variables handle the (basic multiplication) maths. There is no explicit parameter linking that would be discoverable or handled by OF-Core. Thanks for the additional information on |
Technical changes
ParameterScale.get_descendants
now includes bracket rates and thresholds.