Skip to content

Commit

Permalink
Merge pull request #166 from openfisca/msa_master_integ_master
Browse files Browse the repository at this point in the history
Intégration des développements de l'iMSA.
  • Loading branch information
JoDuGa authored Oct 14, 2024
2 parents 1af1766 + 76e595f commit f2e63f3
Show file tree
Hide file tree
Showing 24 changed files with 425 additions and 411 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,9 @@ values:
value: 1180.0
2019-01-01:
value: 1210.0
2020-01-01:
value: 1220.00
2021-10-01:
value: 1240.00
2022-09-01:
value: 1330.00

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
description: plafond des ressources mensuelles pour une personne isolée ou un couple
sans enfant
description: plafond des ressources mensuelles pour une personne isolée ou un couple sans enfant
unit: currency
values:
2012-01-01:
Expand All @@ -10,3 +9,7 @@ values:
value: 1180.0
2019-01-01:
value: 1210.0
2020-01-01:
value: 1220.00
2022-09-01:
value: 1330.00
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ plafond:
value: 915.0
2019-01-01:
value: 980.0
2020-01-01:
value: 1015.0
2022-09-01:
value: 1077.0
en_couple:
unit: currency
values:
Expand All @@ -23,6 +27,10 @@ plafond:
value: 1453.0
2019-01-01:
value: 1553.0
2020-01-01:
value: 1608.0
2022-09-01:
value: 1683.0
montant:
unit: currency
values:
Expand Down
10 changes: 9 additions & 1 deletion openfisca_paris/parameters/paris/personnes_agees/psol.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ plafond:
value: 945.0
2019-01-01:
value: 980.0
2020-01-01:
value: 1015.0
2022-09-01:
value: 1077.0
couple:
unit: currency
values:
Expand All @@ -24,4 +28,8 @@ plafond:
2018-04-01:
value: 1498.0
2019-01-01:
value: 1553.0
value: 1553.0
2020-01-01:
value: 1608.0
2022-09-01:
value: 1683.0
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,29 @@ plafond:
personne_isolee:
unit: currency
values:
2012-01-01: 965.0
2019-01-01: 965.0
2012-01-01:
value: 965.0
2019-01-01:
value: 965.0
2020-01-01:
value: 1015.0
2022-09-01:
value: 1064.0
en_couple:
unit: currency
values:
2012-01-01: 1553.0
2019-01-01: 1553.0
2012-01-01:
value: 1553.0
2019-01-01:
value: 1553.0
2020-01-01:
value: 1608.0
2022-09-01:
value: 1683.0
montant:
unit: currency
values:
2012-01-01: 468.0
2019-01-01: 468.0
2012-01-01:
value: 468.0
2019-01-01:
value: 468.0
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ plafond:
value: 915.0
2019-01-01:
value: 965.0
2020-01-01:
value: 1015.0
2022-09-01:
value: 1064.0
couple:
unit: currency
values:
Expand All @@ -23,3 +27,7 @@ plafond:
value: 1498.0
2019-01-01:
value: 1553.0
2020-01-01:
value: 1608.0
2022-09-01:
value: 1683.0
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ values:
value: 1180.0
2019-01-01:
value: 1210.0
2020-01-01:
value: 1220.0
2022-09-01:
value: 1330.0
49 changes: 28 additions & 21 deletions openfisca_paris/paris.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,45 +18,53 @@ class paris_base_ressources_i(Variable):
definition_period = MONTH

def formula(individu, period, legislation):

last_year = period.last_year
last_3_months = period.last_3_months

ass = individu('ass', period)
aah = individu('aah', period)
asi = individu('asi', period)
caah = individu('caah', period)
#Salaires
salaire_imposable = individu('salaire_imposable', period)
revenus_stage_formation_pro = individu('revenus_stage_formation_pro', period)
chomage_imposable = individu('chomage_imposable', period)
retraite_imposable = individu('retraite_imposable', last_3_months, options = [ADD]) / 3

salaire_net = individu('salaire_net', period)

#indemnites:
indemnites_stage = individu('indemnites_stage', period)
smic = legislation(period).paris.smic_net_mensuel
indemnites_stage_imposable = where((smic >= indemnites_stage), indemnites_stage, 0)
revenus_stage_formation_pro = individu('revenus_stage_formation_pro', period)

chomage_net = individu('chomage_net', period)
allocation_securisation_professionnelle = individu('allocation_securisation_professionnelle', period)
indemnites_journalieres = individu('indemnites_journalieres', period)
indemnites_chomage_partiel = individu('indemnites_chomage_partiel', period)
indemnites_volontariat = individu('indemnites_volontariat', period)

#pensions
ass = individu('ass', period)
aah = individu('aah', period)
asi = individu('asi', period)
caah = individu('caah', period)
allocation_securisation_professionnelle = individu('allocation_securisation_professionnelle', period)
prestation_compensatoire = individu('prestation_compensatoire', period)
retraite_nette = individu('retraite_nette', period)
pensions_invalidite = individu('pensions_invalidite', period)

def revenus_tns():
def revenus_rpns():
revenus_auto_entrepreneur = individu('rpns_auto_entrepreneur_benefice', period, options = [ADD])

# Les revenus TNS hors AE sont estimés en se basant sur le revenu N-1
tns_micro_entreprise_benefice = individu('rpns_micro_entreprise_benefice', last_year) / 12
tns_benefice_exploitant_agricole = individu('rpns_benefice_exploitant_agricole', last_year) / 12
tns_autres_revenus = individu('rpns_autres_revenus', last_year) / 12
# Les revenus RPNS hors AE sont estimés en se basant sur le revenu N-1
rpns_micro_entreprise_benefice = individu('rpns_micro_entreprise_benefice', last_year) / 12
rpns_benefice_exploitant_agricole = individu('rpns_benefice_exploitant_agricole', last_year) / 12
rpns_autres_revenus = individu('rpns_autres_revenus', last_year) / 12

return revenus_auto_entrepreneur + tns_micro_entreprise_benefice + tns_benefice_exploitant_agricole + tns_autres_revenus
return (
revenus_auto_entrepreneur + rpns_micro_entreprise_benefice + rpns_benefice_exploitant_agricole
+ rpns_autres_revenus
)

result = (
ass + aah + asi + caah
+ salaire_net + indemnites_stage_imposable + revenus_stage_formation_pro
+ chomage_net + allocation_securisation_professionnelle + indemnites_journalieres + indemnites_chomage_partiel + indemnites_volontariat
+ prestation_compensatoire + retraite_nette + pensions_invalidite
+ revenus_tns()
+ salaire_imposable + indemnites_stage_imposable + revenus_stage_formation_pro
+ chomage_imposable + allocation_securisation_professionnelle + indemnites_journalieres + indemnites_chomage_partiel + indemnites_volontariat
+ prestation_compensatoire + retraite_imposable+ pensions_invalidite
+ revenus_rpns()
)

return result
Expand Down Expand Up @@ -84,7 +92,6 @@ def formula(famille, period):
ressources_demandeur = famille.demandeur('paris_base_ressources_i', period)
ressources_conjoint = famille.conjoint('paris_base_ressources_i', period)
ressources_famille = famille('paris_base_ressources_famille', period)

return where(en_couple,
ressources_demandeur + ressources_conjoint + ressources_famille,
ressources_demandeur + ressources_famille)
Expand Down
47 changes: 31 additions & 16 deletions openfisca_paris/paris_logement.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ class paris_logement_pa_ph(Variable):
def formula(famille, period, legislation):
last_month = period.last_month

plafond_pl = legislation(period).paris.paris_logement.plafond_pl
plafond_pl_avec_enf = legislation(period).paris.paris_logement.plafond_pl_avec_enf
plafond_pl_personne_isolee = legislation(period).paris.paris_logement.plafond_pl_personne_isolee
plafond_pl_couple_sans_enf = legislation(period).paris.paris_logement.plafond_pl_couple_sans_enf
plafond_pl_couple_avec_enf = legislation(period).paris.paris_logement.plafond_pl_couple_avec_enf
aide_pers_isol = legislation(period).paris.paris_logement.aide_pers_isol
aide_couple_ss_enf = legislation(period).paris.paris_logement.aide_couple_ss_enf
aide_couple_sans_enf = legislation(period).paris.paris_logement.aide_couple_ss_enf
aide_couple_avec_enf = legislation(period).paris.paris_logement.aide_couple_avec_enf

base_ressources = famille('paris_base_ressources_foyer', last_month)
Expand All @@ -42,11 +43,16 @@ def formula(famille, period, legislation):
nb_enfants = famille('paris_nb_enfants', period)
paris_logement_ph_eligibilite = famille('paris_logement_ph_eligibilite', period)

plafond = select([(nb_enfants >= 1), (nb_enfants < 1)], [plafond_pl_avec_enf, plafond_pl])
couple_avec_enfant = personnes_couple * (nb_enfants == 1)
couple_sans_enfant = personnes_couple * (nb_enfants == 0)
personne_isolee = not_(personnes_couple) * (nb_enfants == 0)

plafond = select([couple_avec_enfant, couple_sans_enfant, personne_isolee],
[plafond_pl_couple_avec_enf, plafond_pl_couple_sans_enf, plafond_pl_personne_isolee])
condition_ressource = base_ressources <= plafond
montant_aide = select([personnes_couple * (nb_enfants > 0), personnes_couple,
((personnes_couple != 1) * (nb_enfants == 0)), ((personnes_couple != 1) * (nb_enfants >= 1))],
[aide_couple_avec_enf, aide_couple_ss_enf, aide_pers_isol, 0])

montant_aide = select([couple_avec_enfant, couple_sans_enfant, personne_isolee],
[aide_couple_avec_enf, aide_couple_sans_enf, aide_pers_isol])

result_montant = where((montant_aide > loyer_net), (montant_aide - (montant_aide - loyer_net)), montant_aide)

Expand Down Expand Up @@ -91,15 +97,15 @@ def formula(famille, period):

class paris_logement_fam(Variable):
value_type = float
label = u"Paris Logement pour les couples avec enfant(s)"
label = u"Paris Logement pour les couples avec enfant"
entity = Famille
definition_period = MONTH

def formula(famille, period, legislation):
last_month = period.last_month

plafond_pl_fam = legislation(period).paris.paris_logement.plafond_pl_fam
aide_pl_fam = legislation(period).paris.paris_logement.aide_pl_fam
plafond_pl_couple_avec_enf = legislation(period).paris.paris_logement.plafond_pl_couple_avec_enf
aide_couple_avec_enf = legislation(period).paris.paris_logement.aide_couple_avec_enf

base_ressources = famille('paris_base_ressources_foyer', last_month)
loyer_net = famille('paris_logement_charge_nette_mensuelle', period)
Expand All @@ -108,9 +114,10 @@ def formula(famille, period, legislation):
nb_enfants = famille('paris_nb_enfants', period)
paris_logement_elig_fam = famille('paris_logement_elig_fam', period)

condition_ressource = base_ressources <= plafond_pl_fam
condition_ressource = base_ressources <= plafond_pl_couple_avec_enf

montant_aide = where(personnes_couple * (nb_enfants > 0), aide_pl_fam, 0)
couple_avec_enfant = personnes_couple * (nb_enfants == 1)
montant_aide = where(couple_avec_enfant, aide_couple_avec_enf, 0)

result = where((montant_aide > loyer_net), (montant_aide - (montant_aide - loyer_net)), montant_aide)

Expand Down Expand Up @@ -145,21 +152,29 @@ class paris_logement_apd(Variable):
def formula(famille, period, legislation):
last_month = period.last_month

plafond = legislation(period).paris.paris_logement.plafond_pl_apd
aide_pl_apd_pers_isol = legislation(period).paris.paris_logement.aide_pl_apd_pers_isol
aide_pl_apd_couple = legislation(period).paris.paris_logement.aide_pl_apd_couple
plafond_pl_personne_isolee = legislation(period).paris.paris_logement.plafond_pl_personne_isolee
plafond_pl_couple_sans_enf = legislation(period).paris.paris_logement.plafond_pl_couple_sans_enf
aide_pers_isol = legislation(period).paris.paris_logement.aide_pers_isol
aide_couple_ss_enf = legislation(period).paris.paris_logement.aide_couple_ss_enf

base_ressources = famille('paris_base_ressources_foyer', last_month)

indemnite = famille('paris_indemnite_enfant', last_month)
loyer_net = famille('paris_logement_charge_nette_mensuelle', period)

personnes_couple = famille('en_couple', period)
nb_enfants = famille('paris_nb_enfants', period)
paris_logement_elig_apd = famille('paris_logement_elig_apd', period)

couple_sans_enfant = personnes_couple * (nb_enfants == 0)
personne_isolee = not_(personnes_couple) * (nb_enfants == 0)
plafond = select([couple_sans_enfant, personne_isolee],
[plafond_pl_couple_sans_enf, plafond_pl_personne_isolee])

condition_ressources = (base_ressources - indemnite) <= plafond

montant_aide = where(personnes_couple, aide_pl_apd_couple, aide_pl_apd_pers_isol)
montant_aide = select([couple_sans_enfant, personne_isolee],
[aide_couple_ss_enf, aide_pers_isol])

result = where((montant_aide > loyer_net), (montant_aide - (montant_aide - loyer_net)), montant_aide)

Expand Down
5 changes: 4 additions & 1 deletion openfisca_paris/personnes_agees/paris_logement.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ def formula(famille, period, parameters):
nb_enfants = famille('paris_nb_enfants', period)
param_montant = parameters(period).paris.personnes_agees.paris_logement.montant

couple_avec_enfant = en_couple * (nb_enfants >= 1)
couple_sans_enfant = en_couple * (nb_enfants == 0)
personne_isolee = not_(en_couple) * (nb_enfants == 0)
montant = select(
[not_(en_couple), nb_enfants < 1, nb_enfants >=1],
[personne_isolee , couple_sans_enfant, couple_avec_enfant],
[param_montant.personne_isolee, param_montant.couple_sans_enfant, param_montant.couple_avec_enfant]
)
charge_logement = famille('paris_logement_charge_nette_mensuelle', period)
Expand Down
Loading

0 comments on commit f2e63f3

Please sign in to comment.