Skip to content

Commit

Permalink
Modélisation des montants
Browse files Browse the repository at this point in the history
  • Loading branch information
Allan-CodeWorks committed Nov 22, 2023
1 parent 94ababc commit f150056
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 5 deletions.
16 changes: 12 additions & 4 deletions openfisca_france_local/metropoles/lyon/revenu_solidaire_jeune.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ class revenu_solidaire_jeune(Variable):
reference = 'https://aides-jeunes.grandlyon.com/#c21886'

def formula(individu, period, parameter):
age_eligibles = parameter(period).metropoles.lyon.revenu_solidaire_jeune.age
modalites = parameter(period).metropoles.lyon.revenu_solidaire_jeune
age = individu('age', period)
eligibilite_age = (age >= age_eligibles.minimum_inclusif) * (age <= age_eligibles.maximum_inclusif)
eligibilite_age = (age >= modalites.age.minimum_inclusif) * (age <= modalites.age.maximum_inclusif)

reside_metropole_lyon = individu.menage('lyon_metropole_eligibilite_geographique', period)

Expand All @@ -22,7 +22,15 @@ def formula(individu, period, parameter):
aeeh = individu.famille('aeeh', period)
contrat_engagement_jeune = individu('contrat_engagement_jeune', period)
eligibilite_prestations = rsa + aah + aeeh + contrat_engagement_jeune == 0

pas_en_etude = individu('activite', period) != TypesActivite.etudiant

return 420 * eligibilite_age * reside_metropole_lyon * eligibilite_prestations * pas_en_etude
revenus_activite = (
individu('salaire_net', period)
+ individu('indemnites_stage', period)
+ individu.famille('ppa', period)
+ individu('revenus_stage_formation_pro', period)
)

montant = modalites.montant.calc(revenus_activite)

return montant * eligibilite_age * reside_metropole_lyon * eligibilite_prestations * pas_en_etude
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,26 @@ age:
maximum_inclusif:
values:
2021-06-01: 24
montant:
description: Montants du Revenu Solidaire Jeune
metadata:
type: single_amount
brackets:
- threshold:
2021-06-01:
value: 0
amount:
2021-06-01:
value: 420
- threshold:
2021-06-01:
value: 1
amount:
2021-06-01:
value: 315
- threshold:
2021-06-01:
value: 401
amount:
2021-06-01:
value: 0
18 changes: 17 additions & 1 deletion tests/metropoles/lyon/revenu_solidaire_jeune.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
- period: 2023-11
- name: 'Éligibilité'
period: 2023-11
reforms:
- openfisca_france_local.epci_test_factory.epci_reform
input:
Expand All @@ -11,3 +12,18 @@
activite: ['inactif', 'inactif', 'inactif', 'inactif', 'inactif', 'inactif', 'inactif', 'inactif', 'inactif', 'etudiant']
output:
revenu_solidaire_jeune: [420, 0, 0, 0, 420, 0, 0, 0, 0, 0]

- name: Montants
period: 2023-11
reforms:
- openfisca_france_local.epci_test_factory.epci_reform
input:
age: [18, 18, 18, 18]
depcom: [69003, 69003, 69003, 69003]
contrat_engagement_jeune: [0, 0, 0, 0]
salaire_net: [1, 400, 401, 101]
indemnites_stage: [0, 0, 0, 101]
ppa: [0, 0, 0, 101]
revenus_stage_formation_pro: [0, 0, 0, 101]
output:
revenu_solidaire_jeune: [315, 315, 0, 0]

0 comments on commit f150056

Please sign in to comment.