-
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
Ajout du barème pour le chèque énergie #924
Conversation
b5bc7a1
to
a98a2c3
Compare
@thomasdouenne : tu ne l'as pas implémenté ailleurs ? |
1b3072e
to
0657a01
Compare
@benjello aurais-tu un moment pour regarder cette PR ? Note : Je n'ai pas trouvé dans https://github.com/openfisca/openfisca-france-indirect-taxation/tree/api_migration le barème du chèque énergie. |
@gulliet: je n'y connais pas grand chose donc je ne regarderais que la forme Sinon tout est sur la branche de thomas https://github.com/thomasdouenne/openfisca-france-indirect-taxation/tree/api_migration (oui on nest mal organisé ;-) mais on a dû faire face à beaucoup d'évolutions de core) |
|
||
def formula_2017(menage, period, parameters): | ||
uc = parameters(period).cheque_energie.unites_consommation | ||
nb_persons = menage.nb_persons() |
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.
Le premier nb_persons
a mettre en français
nb_persons = menage.nb_persons() | ||
gardes_alternee = menage.sum(menage.members('garde_alternee', period.first_month)) | ||
|
||
adj_nb = nb_persons - 0.5 * gardes_alternee |
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.
Transformer adj_nb
en quelque chose de plus explicite
@guillett : j'ai mis quelques suggestions mais j'ai approuvé sans faire exprès. |
@benjello merci pour la revue sur la forme. Pour le fond, je vais regarder la branche chez @thomasdouenne. Nous avons mis à disposition ce développement à des personnes du MTES qui ont fait des retours positifs, donc je suis confiant sur le fond. Au pire, on corrigera le tir avec un patch (j'ai quand même ajouté pas mal de tests). |
Pour référence :
Je considère que c'est bon 🙂 |
CHANGELOG.md
Outdated
@@ -1,5 +1,14 @@ | |||
# Changelog | |||
|
|||
|
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.
extra space
@@ -11,6 +11,7 @@ class unites_consommation(Variable): | |||
value_type = float | |||
entity = Menage | |||
label = u"Unités de consommation du ménage, selon l'échelle de l'INSEE" | |||
reference = u"https://insee.fr/fr/metadonnees/definition/c1802" |
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.
🙌
|
||
class UCChequeEnergie(Enum): | ||
__order__ = 'une_uc une_uc_a_deux_uc plus_de_deux_uc' # Needed to preserve the enum order in Python 2 | ||
une_uc = u'Une UC' |
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.
Dans la description, Serait-il plus compréhensible de mettre 'une unité de consommation (UC)' ?
setup.py
Outdated
@@ -7,7 +7,7 @@ | |||
|
|||
setup( | |||
name = 'OpenFisca-France', | |||
version = '20.3.0', | |||
version = '20.3.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.
20.4 --> Ajout de fonctionnalité
CHANGELOG.md
Outdated
@@ -1,5 +1,14 @@ | |||
# Changelog | |||
|
|||
|
|||
### 20.3.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.
20.4 --> ajout de fonctionnalité
th = baremes.thresholds | ||
montants = baremes.montants | ||
|
||
uc_nb = menage('cheque_energie_unites_consommation', 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.
uc_menage ?
definition_period = MONTH | ||
|
||
def formula_2017(menage, period, parameters): | ||
return menage('cheque_energie_montant', period.this_year) * menage('cheque_energie_eligibilite_logement', 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.
Ne faudrait-il pas une ligne vide à la fin du fichier ?
[UCChequeEnergie.une_uc, UCChequeEnergie.une_uc_a_deux_uc, UCChequeEnergie.plus_de_deux_uc] | ||
) | ||
|
||
return (base < th.un) * montants[uc].un + (th.un <= base < th.deux) * montants[uc].deux + (th.deux <= base < th.trois) * montants[uc].trois |
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.
proposition:
return (
+ (base < th.un) * montants[uc].un
+ (th.un <= base < th.deux) * montants[uc].deux
+ (th.deux <= base < th.trois) * montants[uc].trois
)
Je changerais aussi le nom des baremes ainsi :
return (
+ (base_revenus < seuil.une_uc) * montants[uc].une_uc
+ (seuil.une_uc <= base_revenus < seuil.deux_uc) * montants[uc].deux_uc
+ (seuil.deux_uc <= base_revenus < seuil.trois_uc) * montants[uc].trois_uc
)
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.
Merci beaucoup @Anna-Livia, j'ai pris la première proposition (multiligne) mais la seconde n'est pas utilisable.
On ne peut pas utiliser une_uc, deux_uc car cela ne correspond pas au modèle (cf. https://github.com/openfisca/openfisca-france/pull/924/files#diff-ee2c2a6c119744fb4009faf34543d10eR15)
uc_nb = menage('cheque_energie_unites_consommation', period) | ||
rfr = menage.personne_de_reference.foyer_fiscal('rfr', period.n_2) | ||
|
||
base = rfr / uc_nb |
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.
base_revenus
entity = Menage | ||
value_type = float | ||
reference = "https://chequeenergie.gouv.fr" | ||
label = u"Chèque énergie" |
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.
Qu'est ce que retourne cette variable ?
'Montant auquel le ménage peut prétendre au titre du chèque energie' ?
* Also rename variable to prefix with cheque_energie_
* From adj_nb to nb_personnes_ajuste
72ee621
to
fadaf5b
Compare
fadaf5b
to
8b0a64c
Compare
Merci à vous deux @Anna-Livia et @benjello ! |
prestations/cheque_energie.py