Skip to content

Instantly share code, notes, and snippets.

View Morendil's full-sized avatar

Laurent Bossavit Morendil

View GitHub Profile
This file has been truncated, but you can view the full file.
{"name": "simulation", "value": 3.9890100955963135, "children": [{"name": "ppa<2018-05>", "value": 3.9890100955963135, "children": [{"name": "ppa_eligibilite_etudiants<2018-05>", "value": 2.4416704177856445, "children": [{"name": "rsa_majore_eligibilite<2018-05>", "value": 1.052875280380249, "children": [{"name": "en_couple<2018-05>", "value": 0.00028967857360839844, "children": [{"name": "nb_parents<2018-05>", "value": 0.00017762184143066406, "children": []}]}, {"name": "rsa_isolement_recent<2018-05>", "value": 6.079673767089844e-05, "children": []}, {"name": "age<2018-05>", "value": 0.00018477439880371094, "children": [{"name": "date_naissance<2018-05>", "value": 4.124641418457031e-05, "children": []}]}, {"name": "autonomie_financiere<2018-05>", "value": 0.839031457901001, "children": [{"name": "salaire_net<2017-11>", "value": 0.4517393112182617, "children": [{"name": "salaire_imposable<2017-11>", "value": 0.45074033737182617, "children": [{"name": "salaire_de_base<2017-11>", "value": 5.91278076171875e-05,
This file has been truncated, but you can view the full file.
{"name": "simulation", "value": 13.282548189163208, "children": [{"name": "revenu_disponible<2017>", "value": 13.213572263717651, "children": [{"name": "pensions_nettes<2017>", "value": 0.47104573249816895, "children": [{"name": "chomage_net<2017-01>", "value": 0.426302433013916, "children": [{"name": "chomage_imposable<2017-01>", "value": 0.4256303310394287, "children": [{"name": "chomage_brut<2017-01>", "value": 6.246566772460938e-05, "children": []}, {"name": "csg_deductible_chomage<2017-01>", "value": 0.42541027069091797, "children": [{"name": "chomage_brut<2017-01>", "value": 2.6941299438476562e-05, "children": []}, {"name": "csg_imposable_chomage<2017-01>", "value": 0.0004298686981201172, "children": [{"name": "chomage_brut<2017-01>", "value": 2.47955322265625e-05, "children": []}]}, {"name": "taux_csg_remplacement<2017-01>", "value": 0.4244725704193115, "children": [{"name": "rfr<2015>", "value": 0.4200258255004883, "children": [{"name": "abattements_plus_values<2015>", "value": 0.00045013427734375, "c
This file has been truncated, but you can view the full file.
{"name": "root", "value": 3.793658971786499, "children": [{"name": "revenu_disponible<2017>", "value": 3.7249960899353027, "children": [{"name": "pensions_nettes<2017>", "value": 0.4288208484649658, "children": [{"name": "chomage_net<2017-01>", "value": 0.38701677322387695, "children": [{"name": "chomage_imposable<2017-01>", "value": 0.38640856742858887, "children": [{"name": "chomage_brut<2017-01>", "value": 4.673004150390625e-05, "children": []}, {"name": "csg_deductible_chomage<2017-01>", "value": 0.38626861572265625, "children": [{"name": "chomage_brut<2017-01>", "value": 1.811981201171875e-05, "children": []}, {"name": "csg_imposable_chomage<2017-01>", "value": 0.0004315376281738281, "children": [{"name": "chomage_brut<2017-01>", "value": 1.7404556274414062e-05, "children": []}]}, {"name": "taux_csg_remplacement<2017-01>", "value": 0.38537049293518066, "children": [{"name": "rfr<2015>", "value": 0.38170957565307617, "children": [{"name": "abattements_plus_values<2015>", "value": 0.0002639293670654297, "c
class Frame:
def __init__(self, tracer):
self.tracer = tracer
def __enter__(self):
set things up
return thing
def __exit__(self, type, value, traceback):
self.tracer.pop()
class StackTracer
Time for revenu_disponible was 5.119938373565674
Time for impots_directs was 9.012222290039062e-05
Time for revenu_disponible was 5.181142807006836
Time for impots_directs was 9.059906005859375e-05
Time for ass was 2.4069666862487793
Time for ass was 0.09560823440551758
Time for ass was 0.09212183952331543
Time for ass was 0.11110782623291016
Time for caah was 0.23575711250305176
Time for caah was 0.1710975170135498
Time for revenu_disponible was 4.306314468383789
Time for impots_directs was 9.870529174804688e-05
Time for revenu_disponible was 4.315067291259766
Time for impots_directs was 0.0001049041748046875
Time for ass was 1.1636996269226074
Time for ass was 0.00011420249938964844
Time for ass was 7.963180541992188e-05
Time for ass was 0.03228926658630371
Time for caah was 0.030699729919433594
Time for caah was 0.019005537033081055
{"individus":{"592daa923889d66bb4309e89":{"salaire_net":{},"boursier":{"2017-05":false,"2017-04":false,"2017-03":false,"2017-02":false},"date_naissance":{"2017-05":"1989-03-12","2017-04":"1989-03-12","2017-03":"1989-03-12","2017-02":"1989-03-12"},"echelon_bourse":{"2017-05":-1,"2017-04":-1,"2017-03":-1,"2017-02":-1},"enfant_a_charge":{"2017":false},"enfant_place":{"2017-05":false,"2017-04":false,"2017-03":false,"2017-02":false},"epargne_revenus_non_imposables":{"month:2012-01:120":0},"livret_a":{"month:2012-01:120":0},"statut_marital":{"2017-05":"celibataire","2017-04":"celibataire","2017-03":"celibataire","2017-02":"celibataire"},"taux_incapacite":{"2017-05":false,"2017-04":false,"2017-03":false,"2017-02":false},"tns_auto_entrepreneur_type_activite":{"2017-05":"bic","2017-04":"bic","2017-03":"bic","2017-02":"bic"},"tns_autres_revenus_type_activite":{"2017-05":"bic","2017-04":"bic","2017-03":"bic","2017-02":"bic"},"tns_micro_entreprise_type_activite":{"2017-05":"bic","2017-04":"bic","2017-03":"bic","2017-02":

When we talk about "entities" we talk about two different realities:

  • first, we talk in the abstract about what sort of "things" exist in our model - people, families, tax households - and what sort of relationships exist; for instance, people in a family are either parents or children
  • but also, when we start loading data, we talk about concrete people and families; how many people, how many families, how many parents and children are in the first and second family, and so on.

This is one of the strengths of OpenFisca, conceptually. The implementation… left a lot to be desired.

Previously we had this:

Figure 1

- version: 2
preprocess: [preprocessor_module1, preprocessor_module2]
name: Title of the situation
description: Description of the situation
period: 2015-02
relative_error_margin: 0.02
absolute_error_margin: 0.02
input:
- instance: individu
- id: ind1

An overview of the most important classes in OpenFisca Core, from an implementation perspective. This does not tell you what the classes are conceptually, but sketches what their collaboration looks like as of this writing.

Keep in mind that this being an implementation-level model, it may have room for improvement. For instance, if you want to know the Entity associated with a Variable, you cannot ask a TaxBenefitSystem directly, you have to have built a Simulation first.

TaxBenefitSystem

  • is a repository of Variable instances
  • is a repository of ParameterNode instances
  • is a repository of Entity types (not instances)

Variable