Skip to content

Commit

Permalink
feat: ajout de l'aide au permis des yvelines
Browse files Browse the repository at this point in the history
  • Loading branch information
baptou12 authored and Allan-CodeWorks committed Nov 27, 2023
1 parent 06be123 commit 83491e9
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
31 changes: 31 additions & 0 deletions openfisca_france_local/departements/yvelines/aide_permis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
from openfisca_france.model.base import Variable, Individu, MONTH


class yvelines_aide_permis(Variable):
value_type = float
entity = Individu
definition_period = MONTH
label = "Montant de l'aide au permis de conduire pour le département des Yvelines"
reference = 'https://www.78-92.fr/annuaire/aides-et-services/detail/laide-au-financement-du-permis-de-conduire'

def formula(individu, period, parameters):
params = parameters(period).departements.yvelines.aide_permis

individus_age = individu('age', period)

age_maximum = params.age.maximum_inclusif
age_minimum = params.age.minimum_inclusif
eligibilites_age = (individus_age >= age_minimum) * (individus_age <= age_maximum)

eligibilite_residentielle = individu.menage('yvelines_eligibilite_residence', period)

rbg = individu.foyer_fiscal('rbg', period.last_year)
nb_pac = individu.foyer_fiscal('nb_pac', period.last_year)

eligibilite_revenu = (
(rbg - params.revenu_global_brut.deduction_fixe) / nb_pac
) <= params.revenu_global_brut.marginal_par_personne

montant = params.montant

return eligibilites_age * eligibilite_residentielle * eligibilite_revenu * montant
13 changes: 13 additions & 0 deletions openfisca_france_local/departements/yvelines/eligibilite.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from openfisca_france.model.base import Variable, Menage, MONTH

from numpy.core.defchararray import startswith


class yvelines_eligibilite_residence(Variable):
value_type = bool
entity = Menage
definition_period = MONTH
label = "Éligibilité résidentielle d'un ménage aux dipositifs dans les Yvelines"

def formula(menage, period):
return startswith(menage('depcom', period), str.encode('78'))
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
age:
maximum_inclusif:
values:
2010-01-01:
value: 25
minimum_inclusif:
values:
2010-01-01:
value: 18

revenu_global_brut:
deduction_fixe:
values:
2010-01-01:
value: 6400
marginal_par_personne:
values:
2010-01-01:
value: 3200

montant:
values:
2010-01-01:
value: 500
23 changes: 23 additions & 0 deletions tests/departements/yvelines/aide_permis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
- period: 2023-02
name: Éligibilité d'age et de résidence
input:
age: [17, 18, 25, 32, 22]
depcom: ['78000', '78000', '78000', '78000', '13000']
rbg:
2022: ['9000','9000','9000','9000', '9000']
nb_pac:
2022: ['1', '1','1','1', '1']
output:
yvelines_aide_permis: [0, 500, 500, 0, 0]

- period: 2023-02
name: Montant en fonction du quotient familial
input:
age: [18, 18, 18, 18, 18, 18]
depcom: ['78000','78000','78000','78000','78000', '78000']
rbg:
2022: ['9600', '12800', '16000', '19200', '22400', '12800']
nb_pac:
2022: ['1', '2', '3', '4', '3', '1']
output:
yvelines_aide_permis: [500, 500, 500, 500, 0, 0]

0 comments on commit 83491e9

Please sign in to comment.