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

Ajout du barème pour le chèque énergie #924

Merged
merged 9 commits into from
Mar 15, 2018
Merged

Ajout du barème pour le chèque énergie #924

merged 9 commits into from
Mar 15, 2018

Conversation

guillett
Copy link
Member

@guillett guillett commented Mar 5, 2018

  • Évolution du système socio-fiscal.
  • Périodes concernées : à partir de 2017
  • Zones impactées : prestations/cheque_energie.py
  • Détails :
    • Ajoute le calcul du montant du chèque énergie

@guillett guillett force-pushed the cheque_energie branch 2 times, most recently from b5bc7a1 to a98a2c3 Compare March 5, 2018 15:30
@benjello
Copy link
Member

benjello commented Mar 7, 2018

@thomasdouenne : tu ne l'as pas implémenté ailleurs ?

@guillett
Copy link
Member Author

guillett commented Mar 14, 2018

@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.

@benjello
Copy link
Member

@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()
Copy link
Member

Choose a reason for hiding this comment

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

Le premier nb_personsa 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
Copy link
Member

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

@benjello
Copy link
Member

@guillett : j'ai mis quelques suggestions mais j'ai approuvé sans faire exprès.

@guillett
Copy link
Member Author

@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).

@guillett
Copy link
Member Author

Pour référence :

Je considère que c'est bon 🙂

CHANGELOG.md Outdated
@@ -1,5 +1,14 @@
# Changelog


Copy link
Contributor

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"
Copy link
Contributor

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'
Copy link
Contributor

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',
Copy link
Contributor

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
Copy link
Contributor

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)
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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
)

Copy link
Member Author

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
Copy link
Contributor

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"
Copy link
Contributor

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' ?

@guillett guillett force-pushed the cheque_energie branch 2 times, most recently from 72ee621 to fadaf5b Compare March 14, 2018 16:27
@guillett
Copy link
Member Author

Merci à vous deux @Anna-Livia et @benjello !

@guillett guillett merged commit 15b482b into master Mar 15, 2018
@guillett guillett deleted the cheque_energie branch March 15, 2018 06:49
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