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

Migrations formules #842

Merged
merged 13 commits into from
Jan 25, 2018
Merged

Migrations formules #842

merged 13 commits into from
Jan 25, 2018

Conversation

fpagnoux
Copy link
Member

@fpagnoux fpagnoux commented Nov 6, 2017

Connected to #830

  • Amélioration technique
  • Détails :
    • Migre la quasi-totalité des formules vers la syntaxe introduite par OpenFisca-Core 4

@fpagnoux fpagnoux force-pushed the migrations-formules branch from 7dc5d0b to 03f8c61 Compare November 6, 2017 11:19
@fpagnoux fpagnoux requested review from benjello November 6, 2017 11:40
Copy link
Member

@benjello benjello left a comment

Choose a reason for hiding this comment

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

A part le cas où le role ne font pas pas partie de l'entity qui reste à vérifier, cela me paraît très correct.

return revenus_du_travail + pen + rev_cap + prestations_sociales + ppe + impots_directs
# On prend en compte les PPE touchés par un foyer fiscal dont le déclarant principal est dans le ménage
ppe_i = menage.members.foyer_fiscal('ppe', period) # PPE du foyer fiscal auquel appartient chaque membre du ménage
ppe = menage.sum(ppe_i, role = FoyerFiscal.DECLARANT_PRINCIPAL) # On somme seulement pour les déclarants principaux
Copy link
Member

Choose a reason for hiding this comment

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

Je ne suis pas sûr que cela fonctionne avec un role non présent dans l'entité de départ ...

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 qu'il est possible d'avoir un foyer fiscal sans déclarant principal ?

L'algorithme n'a pas changé:

Avant :

ppe = self.cast_from_entity_to_role(ppe_holder, role = VOUS)  # La PPE de chaque foyer fiscal projetée sur les individus, uniquement pour les personnes qui ont le role "VOUS", a.k.a les premiers déclarants de chaque fiscal. 
ppe = self.sum_by_entity(ppe)  # On somme le résultat sur tous les membres du ménage 

Maintenant:

ppe_i = menage.members.foyer_fiscal('ppe', period)  # PPE du foyer fiscal auquel appartient chaque membre du ménage
ppe = menage.sum(ppe_i, role = FoyerFiscal.DECLARANT_PRINCIPAL)  # On somme seulement pour les déclarants principaux

En effet, s'il n'y a pas de déclarant principal dans un foyer fiscal, sa PPE ne sera pas prise en compte pour le ménage. Mais c'était déjà le comportement précédent.

Copy link
Member Author

Choose a reason for hiding this comment

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

À moins que ce qui t'inquiète soit le fait que FoyerFiscal.DECLARANT_PRINCIPAL ne soit pas un role de menage. A priori ça fonctionne, mais je vérifie.

Copy link
Member Author

@fpagnoux fpagnoux Jan 25, 2018

Choose a reason for hiding this comment

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

Je confirme que ça marche bien comme prévu 🙂 (FoyerFiscal.DECLARANT_PRINCIPAL n'est pas juste un entier, donc le moteur comprends que c'est un role au sein du foyer fiscal)

Copy link
Member

Choose a reason for hiding this comment

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

OK


# On prend en compte les prestations sociales touchées par une famille dont le demandeur est dans le ménage
prestations_sociales_i = menage.members.famille('prestations_sociales', period) # PF de la famille auquel appartient chaque membre du ménage
prestations_sociales = menage.sum(prestations_sociales_i, role = Famille.DEMANDEUR) # On somme seulement pour les demandeurs
Copy link
Member

Choose a reason for hiding this comment

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

Idem

irpp = self.sum_by_entity(irpp)
# On projette comme pour PPE dans revenu_disponible
irpp_i = menage.members.foyer_fiscal('irpp', period)
irpp = menage.sum(irpp_i, role = FoyerFiscal.DECLARANT_PRINCIPAL)
Copy link
Member

Choose a reason for hiding this comment

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

idem

f7ub = foyer_fiscal('f7ub', period)
f7uc = foyer_fiscal('f7uc', period)
f7uj = foyer_fiscal('f7uj', period)
_P = parameters(period)
Copy link
Member

Choose a reason for hiding this comment

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

Tu peux virer cette ligne

f7uc = foyer_fiscal('f7uc', period)
f7ui = foyer_fiscal('f7ui', period)
f7uj = foyer_fiscal('f7uj', period)
_P = parameters(period)
Copy link
Member

Choose a reason for hiding this comment

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

Tu peux virer cette ligne

maries_ou_pacses = foyer_fiscal('maries_ou_pacses', period)
rbg_int = foyer_fiscal('rbg_int', period)
f7gs = foyer_fiscal('f7gs', period)
_P = parameters(period)
Copy link
Member

Choose a reason for hiding this comment

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

Tu peux virer cette ligne

P = simulation.parameters_at(period.start).impot_revenu.reductions_impots.spfcpi
maries_ou_pacses = foyer_fiscal('maries_ou_pacses', period)
f7gq = foyer_fiscal('f7gq', period)
_P = parameters(period)
Copy link
Member

Choose a reason for hiding this comment

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

Tu peux virer cette ligne

maries_ou_pacses = foyer_fiscal('maries_ou_pacses', period)
f7gq = foyer_fiscal('f7gq', period)
f7fq = foyer_fiscal('f7fq', period)
_P = parameters(period)
Copy link
Member

Choose a reason for hiding this comment

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

Tu peux virer cette ligne

f7gq = foyer_fiscal('f7gq', period)
f7fq = foyer_fiscal('f7fq', period)
f7fm = foyer_fiscal('f7fm', period)
_P = parameters(period)
Copy link
Member

Choose a reason for hiding this comment

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

Tu peux virer cette ligne

f7fq = foyer_fiscal('f7fq', period)
f7fm = foyer_fiscal('f7fm', period)
f7fl = foyer_fiscal('f7fl', period)
_P = parameters(period)
Copy link
Member

Choose a reason for hiding this comment

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

Tu peux virer cette ligne

@benjello
Copy link
Member

@fpagnoux @sandcha @Anna-Livia : ces changements ont déjà été intégrés non ?
Ne doit-on pas fermer cette PR ?

@bonjourmauko
Copy link
Member

C'est possible te rebaser pour voir ce qu'il reste à faire ?

@sandcha sandcha force-pushed the migrations-formules branch from 8ea6cff to 8d28569 Compare January 23, 2018 23:09
@sandcha
Copy link
Contributor

sandcha commented Jan 23, 2018

Au rebase, un doute sur ce qu'il fallait faire de unites_consommation.
Cette question est exportée dans l'issue #882.

@@ -14,11 +14,19 @@ class unites_consommation(Variable):
definition_period = YEAR

def formula(menage, period, parameters):
age_indiv = menage.members('age', period.first_month)
Copy link
Member Author

Choose a reason for hiding this comment

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

Non, il faut garder cette formule qui est la plus récente.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed :)

@fpagnoux
Copy link
Member Author

@benjello voir la réponse aux questions soulevées sur les roles et entités.

@fpagnoux fpagnoux requested a review from benjello January 25, 2018 16:46
@fpagnoux fpagnoux force-pushed the migrations-formules branch from caed5ec to 1730588 Compare January 25, 2018 17:21
@fpagnoux fpagnoux merged commit 5fd9375 into master Jan 25, 2018
@fpagnoux fpagnoux deleted the migrations-formules branch January 25, 2018 18:06
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.

4 participants