Skip to content

Commit

Permalink
Ajoute de premiers éléments de calculs
Browse files Browse the repository at this point in the history
  • Loading branch information
guillett committed Nov 19, 2024
1 parent 53aceb8 commit 3750153
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
74 changes: 69 additions & 5 deletions openfisca_nouvelle_caledonie/variables/aide_logement.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"


Expand All @@ -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)

0 comments on commit 3750153

Please sign in to comment.