-
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
Migrations formules #842
Migrations formules #842
Conversation
7dc5d0b
to
03f8c61
Compare
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.
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.
openfisca_france/model/mesures.py
Outdated
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 |
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.
Je ne suis pas sûr que cela fonctionne avec un role non présent dans l'entité de départ ...
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.
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.
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.
À 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.
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.
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)
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.
OK
openfisca_france/model/mesures.py
Outdated
|
||
# 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 |
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.
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) |
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.
idem
f7ub = foyer_fiscal('f7ub', period) | ||
f7uc = foyer_fiscal('f7uc', period) | ||
f7uj = foyer_fiscal('f7uj', period) | ||
_P = parameters(period) |
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.
Tu peux virer cette ligne
f7uc = foyer_fiscal('f7uc', period) | ||
f7ui = foyer_fiscal('f7ui', period) | ||
f7uj = foyer_fiscal('f7uj', period) | ||
_P = parameters(period) |
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.
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) |
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.
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) |
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.
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) |
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.
Tu peux virer cette ligne
f7gq = foyer_fiscal('f7gq', period) | ||
f7fq = foyer_fiscal('f7fq', period) | ||
f7fm = foyer_fiscal('f7fm', period) | ||
_P = parameters(period) |
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.
Tu peux virer cette ligne
f7fq = foyer_fiscal('f7fq', period) | ||
f7fm = foyer_fiscal('f7fm', period) | ||
f7fl = foyer_fiscal('f7fl', period) | ||
_P = parameters(period) |
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.
Tu peux virer cette ligne
@fpagnoux @sandcha @Anna-Livia : ces changements ont déjà été intégrés non ? |
C'est possible te rebaser pour voir ce qu'il reste à faire ? |
8ea6cff
to
8d28569
Compare
Au rebase, un doute sur ce qu'il fallait faire de unites_consommation. |
openfisca_france/model/mesures.py
Outdated
@@ -14,11 +14,19 @@ class unites_consommation(Variable): | |||
definition_period = YEAR | |||
|
|||
def formula(menage, period, parameters): | |||
age_indiv = menage.members('age', period.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.
Non, il faut garder cette formule qui est la plus récente.
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.
Fixed :)
@benjello voir la réponse aux questions soulevées sur les roles et entités. |
caed5ec
to
1730588
Compare
Connected to #830