Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ajout de l'aide à l'achat d'une voiture electrique ile_de_france #209

Merged
merged 4 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [6.12.0] - 2024-04-17

_Pour les changements détaillés et les discussions associées, référencez la pull request [#209](https://github.com/openfisca/openfisca-france-local/pull/209)_

jenovateurs marked this conversation as resolved.
Show resolved Hide resolved
### Added

- Ajoute la variable `ile_de_france_aide_achat_voiture_electrique`

## [6.11.9] - 2024-03-12

_Pour les changements détaillés et les discussions associées, référencez la pull request [#208](https://github.com/openfisca/openfisca-france-local/pull/208)_
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
codes_communes_non_eligibles:
2024-01-01:
value:
- '95018' # Argenteuil
- '91200' # Athis-Mons
- '91260' # Juvisy-sur-Orge
- '91420' # Morangis
- '91479' # Paray-Vieille-Poste
- '91600' # Savigny-sur-Orge
- '91687' # Viry-Châtillon

departements_eligibles:
2024-01-01:
value:
- '77' # Seine-et-Marne
- '78' # Yvelines
- '91' # Essonne
- '95' # Val-d’Oise

montant_en_fonction_du_quotient_familial:
metadata:
type: single_amount
brackets:
- threshold:
2024-01-01:
value: 0
amount:
2024-01-01:
value: 9000
- threshold:
2024-01-01:
value: 6358
amount:
2024-01-01:
value: 7500
- threshold:
2024-01-01:
value: 14090
amount:
2024-01-01:
value: 4500
- threshold:
2024-01-01:
value: 30508
amount:
2024-01-01:
value: 2250

metadata:
reference:
2024-01-01:
href: https://www.iledefrance.fr/aides-et-appels-a-projets/acquisition-de-vehicules-propres-par-les-particuliers
jenovateurs marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from openfisca_france.model.base import Individu, MONTH, Variable
from numpy.core.defchararray import startswith
from numpy import logical_not as not_

class ile_de_france_aide_achat_voiture_electrique(Variable):
value_type = float
entity = Individu
label = "Aide à l'acquisition de voitures électriques"
reference = "https://www.iledefrance.fr/aides-et-appels-a-projets/acquisition-de-vehicules-propres-par-les-particuliers"
definition_period = MONTH

def formula(individu, period, parameters):
depcom = individu.menage('depcom', period)
codes_departements = parameters(period).regions.ile_de_france.aide_achat_voiture_electrique.departements_eligibles
eligibilite_geographique = sum([startswith(depcom, str.encode(code_departement)) for code_departement in codes_departements])

codes_communes = parameters(period).regions.ile_de_france.aide_achat_voiture_electrique.codes_communes_non_eligibles
exclusion_geographique = sum([depcom == str.encode(code_commune) for code_commune in codes_communes])

rfr = individu.foyer_fiscal('rfr', period.n_2)
nbptr = individu.foyer_fiscal('nbptr', period.n_2)
quotient_familial = rfr / nbptr

modalites = parameters(period).regions.ile_de_france.aide_achat_voiture_electrique.montant_en_fonction_du_quotient_familial
montant = modalites.calc(quotient_familial)

return montant * eligibilite_geographique * not_(exclusion_geographique)
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='OpenFisca-France-Local',
version='6.11.9',
version='6.12.0',
author='OpenFisca Team',
author_email='[email protected]',
classifiers=[
Expand Down
33 changes: 33 additions & 0 deletions tests/regions/ile-de-france/aide_achat_voiture_electrique.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
- period: 2024-01
input:
region: [ ile_de_france, ile_de_france, ile_de_france, ile_de_france, ile_de_france]
age: [18, 30, 21, 24, 22]
depcom: [77100, 78000, 78370, 78586, 78711]
statut_marital: [celibataire, marie, celibataire, marie, marie]
contrat_de_travail_type: [cdd, cdi, cdi, cdd, non_defini]
rfr:
2022:
[1, 39000, 6500, 40000, 10000]
nbptr:
2022:
[1, 2, 1, 3, 2]
activite: [actif, actif, actif, actif, etudiant]
output:
ile_de_france_aide_achat_voiture_electrique: [9000, 4500, 7500, 7500, 9000]

- period: 2024-01
input:
region: [ ile_de_france, haut_de_france ]
age: [22, 23]
depcom: [95018, 59000]
statut_marital: [marie, marie]
contrat_de_travail_type: [ cdi, cdi]
rfr:
2022:
[6500, 6500]
nbptr:
2022:
[2, 2]
activite: [actif, actif]
output:
ile_de_france_aide_achat_voiture_electrique: [0, 0]
Loading