Skip to content

Instantly share code, notes, and snippets.

@guillett
Created October 22, 2018 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save guillett/f125db8b7d6246f7a13eeb2546beeb51 to your computer and use it in GitHub Desktop.
Save guillett/f125db8b7d6246f7a13eeb2546beeb51 to your computer and use it in GitHub Desktop.
Mise en évidence du problème de cycles
# -*- coding: utf-8 -*-
import openfisca_france
from openfisca_core.simulations import Simulation
tax_benefit_system = openfisca_france.CountryTaxBenefitSystem()
situation = {
"individus": {
"demandeur": {
"echelon_bourse": {
"2018-10": -1,
"2018-09": -1,
"2018-08": -1,
"2018-07": -1
},
"enfant_a_charge": {
"2018": False
},
"enfant_place": {
"2018-10": False,
"2018-09": False,
"2018-08": False,
"2018-07": False
},
"tns_autres_revenus_type_activite": {
"2018-10": "bic",
"2018-09": "bic",
"2018-08": "bic",
"2018-07": "bic"
},
"tns_micro_entreprise_type_activite": {
"2018-10": "bic",
"2018-09": "bic",
"2018-08": "bic",
"2018-07": "bic"
},
"tns_auto_entrepreneur_type_activite": {
"2018-10": "bic",
"2018-09": "bic",
"2018-08": "bic",
"2018-07": "bic"
},
"date_naissance": {
"2018-10": "1952-01-05",
"2018-09": "1952-01-05",
"2018-08": "1952-01-05",
"2018-07": "1952-01-05"
},
"statut_marital": {
"2018-10": "celibataire",
"2018-09": "celibataire",
"2018-08": "celibataire",
"2018-07": "celibataire"
},
"gir": {
"2018-10": "gir_6",
"2018-09": "gir_6",
"2018-08": "gir_6",
"2018-07": "gir_6"
},
"age": {
"2018-10": 66,
"2018-09": 66,
"2018-08": 66,
"2018-07": 66
},
"age_en_mois": {
"2018-10": 801,
"2018-09": 801,
"2018-08": 801,
"2018-07": 801
},
"date_arret_de_travail": {
"2018-10": "2018-10-18",
"2018-09": "2018-10-18",
"2018-08": "2018-10-18",
"2018-07": "2018-10-18"
},
"handicap": {
"2018-10": False,
"2018-09": False,
"2018-08": False,
"2018-07": False
},
"taux_incapacite": {
"2018-10": False,
"2018-09": False,
"2018-08": False,
"2018-07": False
},
"inapte_travail": {
"2018-10": False,
"2018-09": False,
"2018-08": False,
"2018-07": False
},
"salaire_de_base": {
"2017-10": 1282.051282051282,
"2017-11": 1282.051282051282,
"2017-12": 1282.051282051282,
"2018-01": 1282.051282051282,
"2018-02": 1282.051282051282,
"2018-03": 1282.051282051282,
"2018-04": 1282.051282051282,
"2018-05": 1282.051282051282,
"2018-06": 1282.051282051282,
"2018-07": 1282.051282051282,
"2018-08": 1282.051282051282,
"2018-09": 1282.051282051282,
"2018-10": 1282.051282051282,
"2016-01": 1282.0512820512818,
"2016-02": 1282.0512820512818,
"2016-03": 1282.0512820512818,
"2016-04": 1282.0512820512818,
"2016-05": 1282.0512820512818,
"2016-06": 1282.0512820512818,
"2016-07": 1282.0512820512818,
"2016-08": 1282.0512820512818,
"2016-09": 1282.0512820512818,
"2016-10": 1282.0512820512818,
"2016-11": 1282.0512820512818,
"2016-12": 1282.0512820512818
},
"salaire_imposable": {
"2017-10": 1036.5288461538462,
"2017-11": 1036.5288461538462,
"2017-12": 1036.5288461538462,
"2018-01": 1036.5288461538462,
"2018-02": 1036.5288461538462,
"2018-03": 1036.5288461538462,
"2018-04": 1036.5288461538462,
"2018-05": 1036.5288461538462,
"2018-06": 1036.5288461538462,
"2018-07": 1036.5288461538462,
"2018-08": 1036.5288461538462,
"2018-09": 1036.5288461538462,
"2018-10": 1036.5288461538462,
"2016-01": 1036.528846153846,
"2016-02": 1036.528846153846,
"2016-03": 1036.528846153846,
"2016-04": 1036.528846153846,
"2016-05": 1036.528846153846,
"2016-06": 1036.528846153846,
"2016-07": 1036.528846153846,
"2016-08": 1036.528846153846,
"2016-09": 1036.528846153846,
"2016-10": 1036.528846153846,
"2016-11": 1036.528846153846,
"2016-12": 1036.528846153846
},
"salaire_net": {
"2017-10": 1000,
"2017-11": 1000,
"2017-12": 1000,
"2018-01": 1000,
"2018-02": 1000,
"2018-03": 1000,
"2018-04": 1000,
"2018-05": 1000,
"2018-06": 1000,
"2018-07": 1000,
"2018-08": 1000,
"2018-09": 1000,
"2018-10": 1000,
"2016-01": 1000,
"2016-02": 1000,
"2016-03": 1000,
"2016-04": 1000,
"2016-05": 1000,
"2016-06": 1000,
"2016-07": 1000,
"2016-08": 1000,
"2016-09": 1000,
"2016-10": 1000,
"2016-11": 1000,
"2016-12": 1000
},
"aah": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"asi": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
}
}
},
"familles": {
"_": {
"proprietaire_proche_famille": {
"2018-10": False,
"2018-09": False,
"2018-08": False,
"2018-07": False
},
"parents": ["demandeur"],
"enfants": [],
"bourse_college": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"ass": {
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"ppa": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"aide_logement": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"rsa": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"paje_base": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"asf": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"cf": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"af": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"acs": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
},
"aspa": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
}
}
},
"foyers_fiscaux": {
"_": {
"declarants": ["demandeur"],
"personnes_a_charge": []
}
},
"menages": {
"_": {
"loyer": {
"2018-10": 500,
"2018-09": 500,
"2018-08": 500,
"2018-07": 500
},
"coloc": {
"2018-10": False,
"2018-09": False,
"2018-08": False,
"2018-07": False
},
"logement_chambre": {
"2018-10": False,
"2018-09": False,
"2018-08": False,
"2018-07": False
},
"depcom": {
"2018-10": "35238",
"2018-09": "35238",
"2018-08": "35238",
"2018-07": "35238"
},
"statut_occupation_logement": {
"2018-10": "locataire_vide",
"2018-09": "locataire_vide",
"2018-08": "locataire_vide",
"2018-07": "locataire_vide"
},
"personne_de_reference": ["demandeur"],
"enfants": [],
"cheque_energie": {
"2018-09": 0,
"2018-08": 0,
"2018-07": 0,
"2018-06": 0,
"2018-05": 0,
"2018-04": 0,
"2018-03": 0,
"2018-02": 0,
"2018-01": 0,
"2017-12": 0,
"2017-11": 0,
"2017-10": 0
}
}
}
}
allMonths = ['2018-09']
calculs = [
{'variable': 'rfr', 'periods': ['2016']},
{'variable': 'ass', 'periods': allMonths},
{'variable': 'rfr', 'periods': ['2016']},
{'variable': 'logement_social_eligible', 'periods': allMonths},
{'variable': 'rni', 'periods': ['2016']},
{'variable': 'rfr', 'periods': ['2016']},
]
for computation in calculs:
simulation_actuelle = Simulation(
tax_benefit_system=tax_benefit_system,
simulation_json=situation)
for period in computation['periods']:
data = simulation_actuelle.calculate(computation['variable'], period)
print computation['variable']
print data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment