Skip to content
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

Merge Variables and DatedVariables #522 #770

Merged
merged 8 commits into from
Jun 13, 2017
Merged

Conversation

fpagnoux
Copy link
Member

@fpagnoux fpagnoux commented Jun 1, 2017

@fpagnoux fpagnoux changed the title rAdapt France to Core v13 Adapt France to Core v13 Jun 1, 2017
@MattiSG
Copy link
Member

MattiSG commented Jun 2, 2017

Documentons-nous aujourd'hui quelque part les regexp et traitements appliqués lors des mises à jour ? Il va falloir prendre l'habitude de le faire pour faciliter la migration des différents systèmes socio-fiscaux.

@fpagnoux
Copy link
Member Author

fpagnoux commented Jun 7, 2017

Non, pas aujourd'hui, mais oui, il faudrait le faire.

@fpagnoux fpagnoux changed the title Adapt France to Core v13 Merge Variables and DatedVariables #522 Jun 7, 2017
@fpagnoux fpagnoux requested a review from sandcha June 7, 2017 17:10
CHANGELOG.md Outdated

* Amélioration technique
* Détails :
- Adapte OpenFisca-France à OpenFisca-Core 13.0.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mettre à jour la version de Core. Sinon, est-ce qu'un lien vers le descriptif avant/après du changelog Core aurait sa place ici ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

CHANGELOG.md Outdated
* Amélioration technique
* Détails :
- Adapte OpenFisca-France à OpenFisca-Core 13.0.0
- Modifie la manière de définir les dates de début des formules, et les dates de fin des variables.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Devrions-nous évoquer la modification de nommage des formules (même sans date) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oui 👍

@@ -41,7 +41,7 @@ class f6el(Variable):
column = IntCol(val_type = "monetary")
entity = FoyerFiscal
label = u"Autres pensions alimentaires versées à des enfants majeurs: 1er enfant"
start_date = date(2006, 1, 1)
# start_date = date(2006, 1, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce que le simple fait de commenter le start_date comme nous l'avions prévu est finalement suffisant pour l'utilisateur ? # Déprécié: start_date = date(2006, 1, 1) ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Est-ce que le mot "Déprécié" rend vraiment l'intention plus claire ?
Je pense que la question est pertinente, mais vu le retard qu'on a pris, je préférerais rester sur ce qui a été défini dans l'issue plutôt que de passer du temps à réfléchir à une bonne formulation.

column = FloatCol
entity = FoyerFiscal
label = u"Charges déductibles non plafonnées"
url = "http://impotsurlerevenu.org/definitions/215-charge-deductible.php"
definition_period = YEAR
end = '2014-12-31'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -554,11 +546,10 @@ class cd_doment(Variable):
column = FloatCol
entity = FoyerFiscal
label = u"Investissements DOM-TOM dans le cadre d’une entreprise"
start_date = date(2002, 1, 1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conserver le start_date commenté ou le transcrire explicitement dans formula_2002_01_01 afin de ne pas perdre d'information explicite (jour, mois) ?
Si l'on en profite pour simplifier la lecture, devrait-on appliquer ça à tout formule éligible ? C'est à dire même pour les groupes de formules (variables à plusieurs formules).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sachant que la variable est définie à l'échelle de l'année (definition_period = YEAR), je trouve formula_2002 suffisamment explicite.

Je ne pense pas que l'uniformisation soit de notre responsabilité. On adapte juste france à core en essayant d'introduire le moins de désordre possible 🙂

@@ -679,8 +675,7 @@ def function_20050101_20121231(self, simulation, period):
DEF = deficit_rcm
return max_(TOT1 + TOT2 + TOT3 - DEF, 0)

@dated_function(start = date(2013, 1, 1))
def function_20130101_20151231(self, simulation, period):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

De même que précédemment : que faire d'une information de fin de formule qui ne figurait que dans le nom ? Remonter un warning à openfisca-france pour clarification ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commentaire ajouté.

out = (plus_values.taux2 * (f3vd + f3sd) + plus_values.taux3 * (f3vi + f3si) +
plus_values.taux4 * (f3vf + f3sf) + plus_values.taux1 * max_(0, f3vg - f3vh) + plus_values.pvce * rpns_pvce)
# TODO: chek this rpns missing ?
return round_(out)

@dated_function(start = date(2013, 1, 1))
def function_20130101_20151231(self, simulation, period): # f3sd is in f3vd holder
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

De même : perte d'information sans impact sur l'exécution.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commentaire ajouté

@@ -1756,8 +1735,7 @@ def function_20020101_20071231(self, simulation, period):
out = f2dh + f2ee
return out * not_(finpfl) / 12

@dated_function(start = date(2008, 1, 1))
def function_20080101_20151231(self, simulation, period):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

De même : que faire de cette perte d'information sans impact sur l'exécution ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commentaire ajouté 👌


@dated_function(start = date(2009, 1, 1), stop = date(2009, 12, 31))
def function_20090101_20091231(self, simulation, period):

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo : ligne en trop.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

column = FloatCol
entity = FoyerFiscal
label = u"patnat"
definition_period = YEAR
end = '2013-12-31'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo : ligne en trop.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@fpagnoux fpagnoux requested a review from sandcha June 12, 2017 16:25
@@ -3930,7 +3930,7 @@ class f1ar(Variable):
column = BoolCol
entity = FoyerFiscal
label = u"Crédit d'impôt aide à la mobilité : le déclarant déménage à plus de 200 km pour son emploi"
stop_date = date(2080, 12, 31)
end = '2080-12-31'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

En marge de la PR : 2080 typo pour 2008 ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sûrement

@@ -25,10 +25,9 @@ class stage_gratification(Variable):
column = FloatCol
entity = Individu
label = u"Gratification de stage"
start_date = date(2014, 11, 1) # TODO: remove when updating legislation backwards
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conserver le commentaire vers le nom de la formule ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@@ -44,10 +43,9 @@ class stage_gratification_reintegration(Variable):
column = FloatCol
entity = Individu
label = u"Part de la gratification de stage réintégrée à l'assiette des cotisations et contributions sociales"
start_date = date(2014, 11, 1) # TODO: remove when updating legislation backwards
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

De même : conserver le commentaire ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@dated_function(start = date(2002, 1, 1), stop = date(2005, 6, 30)) # TODO FIXME start date
def function_2005_06_30(self, simulation, period):
# TODO FIXME start date
def formula_2002_01_31(self, simulation, period):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo start date : formula_2002_01_01

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍 👍

label = u"Décote IR 2015 appliquée sur IR 2014 (revenus 2013)"
definition_period = YEAR

@dated_function(start = date(2013, 1, 1), stop = date(2013, 12, 31))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouter end = '2013-12-31'

Copy link
Member Author

@fpagnoux fpagnoux Jun 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are in a reform, and in that case, the end didn't mean that the formula stops in '2013-12-31'.

It meant that we were replacing the formula of decote from '2013-01-01' to '2013-12-31' (it took me some time to understand, as I had errors when putting an end date).

The behaviour we now have is slightly different than it was before, as we are now changing the formula "from 2013" instead of "for 2013 only".

It's probably alright in this context (I doubt we'll ever study the impact of the PLF 2015 in 2017), and we don't have a better helper :(.

label = u"Somme des réductions d'impôt à intégrer pour l'année 2013"
reference = reductions_impot.reductions
definition_period = YEAR

@dated_function(start = date(2013, 1, 1), stop = date(2013, 12, 31))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ajouter end = '2013-12-31' ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Même réponse que pour les cas précédents

setup.py Outdated
@@ -51,7 +51,7 @@
install_requires = [
'Biryani[datetimeconv] >= 0.10.4',
'numpy >= 1.11',
'OpenFisca-Core >= 12.2.0, < 13.0',
'OpenFisca-Core >= 13.0, < 14.0',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mettre à jour la version à : 'OpenFisca-Core >= 14.0, < 15.0', ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

ressortissant_eee = individu('ressortissant_eee', period)
duree_possession_titre_sejour = individu('duree_possession_titre_sejour', period)
duree_min_titre_sejour = legislation(period).prestations.minima_sociaux.rsa.duree_min_titre_sejour
return or_(ressortissant_eee, duree_possession_titre_sejour >= duree_min_titre_sejour)

@dated_function(stop = date(2009, 5, 31))
def function_rmi(individu, period, legislation):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conserver le suffixe rmi en commentaire ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@@ -970,8 +946,7 @@ def function_rsa(famille, period, legislation):

return eligib * socle * taux

@dated_function(stop = date(2009, 5, 31))
def function_rmi(famille, period, legislation):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Conserver "rmi" (du nom de fonction) en commentaire ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oui

column = FloatCol
entity = Famille
label = u"Revenu de référence, basé sur la situation familiale, pris en compte dans le calcul des AL."
definition_period = MONTH

@dated_function(stop = date(2014, 12, 31))
def function_2014(famille, period, legislation):
def formula_2014(famille, period, legislation):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renommer en formula ? Cette formule commence à l'âge de pierre si on fait fi de son nom. 🙂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍 👍

Rename function -> formula
Rename stop_date -> end
@fpagnoux fpagnoux force-pushed the dated-variable-#371 branch 3 times, most recently from 867073b to ca4d836 Compare June 13, 2017 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants