-
Notifications
You must be signed in to change notification settings - Fork 101
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
Enforce simplify-periods PR from openfisca-core #685
Conversation
@@ -168,7 +166,9 @@ def nb_enf(famille, period, age_min, age_max): | |||
Renvoie le nombre d'enfant au sens des allocations familiales dont l'âge est compris entre ag1 et ag2 | |||
""" | |||
|
|||
period = period.this_month | |||
assert period.unit == u'month' | |||
assert period.size == 1 |
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.
Why did you put those assertions here to replace period = period.this_month
and not elsewhere?
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.
Because nb_enf is a helper function that is used in other modules. Do you see a better solution ?
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.
Oops, I did not see that because of the diff display. All right then.
I don't want to open here a debate on helpers vs variables, but we're right in here.
|
When |
Because of the explicit period management that is now required, a month must be given to call a monthly variable from a yearly variable. I use janvier (same as before but explicit now) whenever it is needed : janvier = period.this_month
age = simulation.calculate('age', janvier) |
@benjello on second thought that is exactly what I concluded and what I implemented. Filling the value is correctly handled by There is redondancy but this can be adressed by numpy references. However I am reluctant to address optimization issues in this PR. |
306d7a8
to
a97f730
Compare
All the tests pass in my development environment, however that is not the case for travis. Somebody has a hint ? Edit : this is certainly caused by travis installing openfisca-core/master instead of the new version still not merged. Edit : travis now installs the correct version, but a test fails. I can't understand why :
Edit : I needed to install inversion_revenus in my dev environment. |
e7872bd
to
0cfc353
Compare
@@ -748,9 +757,10 @@ class taille_entreprise(Variable): | |||
entity = Individu | |||
label = u"Catégorie de taille d'entreprise" | |||
url = u"http://www.insee.fr/fr/themes/document.asp?ref_id=ip1321" | |||
period_unit = MONTH | |||
calculate_output = calculate_output_first_month |
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.
Si le seul but est de faire passer ce test, autant modifier le test, vu que la période y est arbitraire.
|
||
|
||
class age_en_mois(Variable): | ||
base_function = missing_value | ||
column = AgeCol(val_type = "months") | ||
entity = Individu | ||
label = u"Âge (en mois)" | ||
period_unit = MONTH | ||
calculate_output = calculate_output_first_month |
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.
Y a-t-il vraiment un sens à calculer un age_en_mois
pour une année ? Ce test le fait, mais le test sur les valeurs annuelles me paraît peu pertinent.
|
||
|
||
class enfant_a_charge(Variable): | ||
column = BoolCol | ||
entity = Individu | ||
label = u"Enfant à charge non marié, de moins de 18 ans au 1er janvier de l'année de perception des" \ | ||
u" revenus, ou né durant la même année, ou handicapés quel que soit son âge" | ||
period_unit = MONTH | ||
calculate_output = calculate_output_first_month |
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.
Cette variable semble très liée à l'impôt , et donc plutôt annuelle. Elle est appelée une seule fois par une variable mensuelle (dans cmu.py
). Plutôt que de la définir en mensuelle et de rajouter un calculate_output, je suggère plutôt que l'unique appellant mensuel s'adapte et qu'on la définisse en annuel.
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.
Besoin d'une discussion IRL pour voir si ces 4 tests sont vraiment à déprécier 😏 :
test_mes_aides_5591635b7ae4c40130761eb7
test_mes_aides_54c2259755fa25a535d69571
test_mes_aides_54be84abdee70bd172bf3ba3
test_mes_aides_5421322ffb35830200b3133b
295e63f
to
2c23a59
Compare
requirements.txt
Outdated
@@ -1,5 +1,5 @@ | |||
# Add Biryani extra requirement here because it is needed by OpenFisca-Core and installation from Git URL below | |||
# does not take extras_require of Core setup.py into account. | |||
Biryani[datetimeconv] >= 0.10.4 | |||
--editable git+https://github.com/openfisca/openfisca-core.git#egg=OpenFisca-Core | |||
--editable git+https://github.com/openfisca/openfisca-core.git@simplify-periods#egg=OpenFisca-Core |
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.
Si c'est temporaire, attention à bien penser à le reverter.
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.
Oui bien vu ! Il faut surtout pas merger ça.
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.
Quand je commit ce genre de chose, j'ai pour habitude de préfixer le commit par un gros [TO REVERT], pour que ce soit plus facilement visible à la review.
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.
Quand je commit ce genre de chose, j'ai pour habitude de préfixer le commit par un gros [TO REVERT], pour que ce soit plus facilement visible à la review.
9510a58
to
fcece09
Compare
Remove period = period.this_* when this is useless.
Use a period that matches the attribute period_behavior of the called variable, or use an option (ADD, DIVIDE).
fcece09
to
72761b4
Compare
5496ea4
to
21008ee
Compare
Connected to openfisca/openfisca-core#442
Related to openfisca/openfisca-core#452
period_behavior
period = period.this_***