-
Notifications
You must be signed in to change notification settings - Fork 2
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
Refactor and add missing income tests #59
Open
bonjourmauko
wants to merge
12
commits into
main
Choose a base branch
from
add-income-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bonjourmauko
requested review from
Br3nda,
jduckles,
verbman,
asgharkazi,
MarkCalvert and
piacandrews
September 29, 2023 02:57
bonjourmauko
changed the title
Refactor income test
Refactor and add missing income tests
Oct 7, 2023
Bump |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
sole_parent_support
,jobseeker_support
income_test_n
as the result of applying an income test to a benefit.Discussion
Main benefits are income-tested (subject to an abatement rate based on income).
Non-main benefits can be income-tested via main benefits (i.e. accommodation
supplement via jobseeker). However, some benefits change the definitions of
certain things, i.e. income is not the same for accommodation supplement and
for jobseeker support. Furthermore, the notion of income-tested benefit has
been replaced with that of main benefit, which can create confusion when a
benefit like accommodation supplement is income-tested via jobseeker support.
This poses a challenge to the rule-maker, because in order to define a general
rule for an income test, that applies to benefits with different definitions of
income, it has to make it high order. In plain English, it has to create a
rule factory. A rule that creates a rule, depending on the context of its
application (i.e. the benefit it is applied to).
There are several ways to solve this problem, yet all gravitate around two
philosophies:
Stick to the letter: if the rule-maker defines a pure high-order function
that can't be applied directly, one solution is to just model it as close to
the letter that is possible.
Incorporate: if the rule can't be applied directly, ignore it, and
incorporate it as many times as is used without abstracting it into a rule
the way the rule-maker did (cf. copy-paste several times).
Currently the OpenFisca DSL does not provide any native way of modelling this
cases, as it is assumed as an invariant that, what can be modelled, can be
directly applied at definition time (just following the text), and not at
run time (depending on the context it is being applied).
As usually the law doesn't contain this kind of abstractions, their use has
always been discouraged as not being truthful to the text or modelling as a
developer and not as a policy folk. This case is, then, peculiar.
The solution adopted here is to model the income test as a normal
Variable
,and capturing the context of its application from the stack. While it works,
it is not a very elegant solution, and it is likely error-prone.