From 37501536c858ec482e1faea2b76b157768508ba6 Mon Sep 17 00:00:00 2001 From: Thomas Guillet Date: Tue, 19 Nov 2024 11:41:42 +0100 Subject: [PATCH] =?UTF-8?q?Ajoute=20de=20premiers=20=C3=A9l=C3=A9ments=20d?= =?UTF-8?q?e=20calculs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../excedent_pour_charges.yaml | 6 ++ .../loyer_mensuel_plafond/pourcentage.yaml | 6 ++ .../loyer_mensuel_reference.yaml | 25 +++++++ .../variables/aide_logement.py | 74 +++++++++++++++++-- 4 files changed, 106 insertions(+), 5 deletions(-) create mode 100644 openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_plafond/excedent_pour_charges.yaml create mode 100644 openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_plafond/pourcentage.yaml create mode 100644 openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_reference.yaml diff --git a/openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_plafond/excedent_pour_charges.yaml b/openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_plafond/excedent_pour_charges.yaml new file mode 100644 index 0000000..0c6e880 --- /dev/null +++ b/openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_plafond/excedent_pour_charges.yaml @@ -0,0 +1,6 @@ +description: Loyer mensuel de référence +metadata: + reference: Article 10 de la délibération n° 286 du 18 avril 2007 +values: + 2015-12-01: + value: 0.15 diff --git a/openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_plafond/pourcentage.yaml b/openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_plafond/pourcentage.yaml new file mode 100644 index 0000000..f267381 --- /dev/null +++ b/openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_plafond/pourcentage.yaml @@ -0,0 +1,6 @@ +description: Loyer mensuel de référence +metadata: + reference: Article 11 de la délibération n° 286 du 18 avril 2007 +values: + 2015-12-01: + value: 0.20 diff --git a/openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_reference.yaml b/openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_reference.yaml new file mode 100644 index 0000000..aec69c2 --- /dev/null +++ b/openfisca_nouvelle_caledonie/parameters/benefits/aide_logement/loyer_mensuel_reference.yaml @@ -0,0 +1,25 @@ +description: Loyer mensuel de référence +metadata: + reference: Article 10 de la délibération n° 286 du 18 avril 2007 + unit: currency-FCP +chambre: + 2015-12-01: + value: 27000 +f1: + 2015-12-01: + value: 54000 +f2: + 2015-12-01: + value: 68000 +f3: + 2015-12-01: + value: 81000 +f4: + 2015-12-01: + value: 90000 +f5p: + 2015-12-01: + value: 99000 +maisonderetraite: + 2015-12-01: + value: 54000 diff --git a/openfisca_nouvelle_caledonie/variables/aide_logement.py b/openfisca_nouvelle_caledonie/variables/aide_logement.py index b51e795..3965592 100644 --- a/openfisca_nouvelle_caledonie/variables/aide_logement.py +++ b/openfisca_nouvelle_caledonie/variables/aide_logement.py @@ -3,6 +3,8 @@ from openfisca_core.variables import Variable from openfisca_nouvelle_caledonie.entities import Household +from openfisca_core.model_api import select + class TypologieLogement(Enum): __order__ = "chambre f1 f2 f3 f4 f5p maisonderetraite" @@ -11,7 +13,7 @@ class TypologieLogement(Enum): f2 = "F2" f3 = "F3" f4 = "F4" - f5p = "F5 et plus" + f5p = "F5 et suivants" maisonderetraite = "Maison de retraite" @@ -24,15 +26,77 @@ class typologie_logement(Variable): label = "Legal housing situation of the household concerning their main residence" -class aide_logement(Variable): +class loyer(Variable): value_type = float entity = Household definition_period = MONTH - label = "Aide au logement" + label = "Loyer de base hors charges" -class loyer(Variable): +class charges_locatives(Variable): + value_type = float + entity = Household + definition_period = MONTH + label = "Charges locatives" + + +class loyer_mensuel_de_base(Variable): + value_type = float + entity = Household + definition_period = MONTH + label = "Loyer mensuel de base" + + def formula(household, period, parameters): + loyer_mensuel_reference = household('loyer_mensuel_reference', period) + loyer = household('loyer', period) + + # Clarification nécessaire + # Prise en compte ou non de l'excédent de loyer pour charges importantes ? + return min(loyer, loyer_mensuel_reference) + + +class loyer_mensuel_reference(Variable): + value_type = float + entity = Household + definition_period = MONTH + label = "Loyer mensuel de référence" + + def formula(household, period, parameters): + typologie_logement = household('typologie_logement', period) + return parameters(period).benefits.aide_logement.loyer_mensuel_reference[typologie_logement] + + +class loyer_mensuel_plafond(Variable): + value_type = float + entity = Household + definition_period = MONTH + label = "Loyer mensuel de référence" + + def formula(household, period, parameters): + loyer_mensuel_reference = household('loyer_mensuel_reference', period) + params = parameters(period).benefits.aide_logement.loyer_mensuel_plafond + pourcentage_plafond = params.pourcentage + + excedent_pour_charges = params.excedent_pour_charges + + charges = household('charges_locatives', period) + excedent_pour_charges_montant = max(0, charges - loyer_mensuel_reference * excedent_pour_charges) + + # Clarification nécessaire + # return loyer_mensuel_reference * (1 + pourcentage_plafond) + excedent_pour_charges_montant + # OU + # return (loyer_mensuel_reference + excedent_pour_charges_montant) * (1 + pourcentage_plafond) + return (loyer_mensuel_reference + excedent_pour_charges_montant) * (1 + pourcentage_plafond) + + +class aide_logement(Variable): value_type = float entity = Household definition_period = MONTH - label = "Aide au sogement" + label = "Aide au logement" + + def formula(household, period, parameters): + loyer = household('loyer', period) + loyer_mensuel_plafond = household('loyer_mensuel_plafond', period) + return select([loyer > loyer_mensuel_plafond], [0], default = 1) +