-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #209 from openfisca/voiture-electrique-ile-france
Ajout de l'aide à l'achat d'une voiture electrique ile_de_france
- Loading branch information
Showing
5 changed files
with
121 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
52 changes: 52 additions & 0 deletions
52
openfisca_france_local/parameters/regions/ile_de_france/aide_achat_voiture_electrique.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
27 changes: 27 additions & 0 deletions
27
openfisca_france_local/regions/ile_de_france/aide_achat_voiture_electrique.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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=[ | ||
|
33 changes: 33 additions & 0 deletions
33
tests/regions/ile_de_france/aide_achat_voiture_electrique.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |