SlideShare a Scribd company logo
1 of 28
Download to read offline
Opening up the French
tax software
http://www.openfisca.fr/
https://framagit.org/openfisca
https://github.com/openfisca
@OpenFisca
Michel Blancard
michel.blancard@data.gouv.fr
PyData – June 14, 2016
I - What is OpenFisca?
Legislation
It's growing!
In French (that most French
people don't understand),
not in python!
Notices
Bulletin Officiel des Finances
Publiques-Impôts (BOFiP)
Décrets
How to compute the French tax and benefits?
It's complex!
4
How to compute the French tax and benefits?
It's complex, because the reality is complex.
Individuals
Housing
Family
Taxation
How to compute the French tax and benefits?
OpenFisca aims to :
●
cover both tax and benefits policies
●
be efficient
●
one family simulation
●
simulation on the whole country
●
be understandable
What is OpenFisca?
OpenFisca is used for :
●
improving readability
to the public
●
designing reforms
●
simulating one's
situation
●
understanding the tax
and social system
mes-aides.gouv.fr
Why compute the French tax and benefits?
OpenFisca is used for :
●
improving readability
to the public
●
designing reforms
●
simulating one's
situation
●
understanding the tax
and social system
How to compute the French taxes ?
tax difference
between/after marriage
OpenFisca is used for :
●
improving readability
to the public
●
designing reforms
●
simulating one's
situation
●
understanding the tax
and social system
How to compute the French taxes ?
personal simulation
ui.openfisca.fr
OpenFisca is used for :
●
improving readability
to the public
●
designing reforms
●
simulating one's
situation
●
understanding the
tax and social system
How to compute the French taxes ?
tax percentage as a
function of income
The history of OpenFisca
2011 2014 2016
2 economists
python scripts
with QT frontend
2 developers
join the project
tax calculator of
the DGFiP released
increasing
demand for an
open simulator
OpenFisca
reaches the sky
and beyond...
(see later)
France Stratégie
France Stratégie
IPP
Etalab
II – The French tax
calculator
●
demande gracieuse (aug 2014)
●
6 months later : seisine of the CADA
●
2 months later : positive notice from the CADA
●
2 months later : beginning of judicial proceedings
●
10 months later : the DGFiP releases the source code !
●
10 months later + ε : the court issues a positive decision
The quest for the source code
(want to speed up the process ? → ouvre-boite.org)
●
April 1-2, 2016 at the Mozilla Fundation
●
presence of 3 Ministers
●
developers, civil servants, economists,
citizens... all sitting at the same table !
A hackathon to celebrate :
CodeImpôt
Preparation by Etalab and DGFiP :
●
understand the Domain Specific
Language (DSL) : M
●
parse using Clean PEG (Igor
Dejanović's Arpeggio)
●
simplify the Abstract Syntax Tree
(AST)
→ Direct Acyclic Graph of trees
Preparation
regle 10214:
application : iliad,batch ;
CSGAC = max(0,CSGC ­ CICSG);
CSNET = max(0,(CSGC + PCSG ­ 
CICSG ­ CSGIM)) ;
RDSAC = max(0,RDSC ­ CIRDS);
RDNET = max(0,(RDSC + PRDS ­ 
CIRDS ­ CRDSIM));
PRSNET = max(0,(PRSC + PPRS ­ 
CIPRS ­ PRSPROV))  ;
CVNAC  =  CVNSALC;
CVNNET  =  max(0,(CVNSALC + PCVN 
­ COD8YT));
REGVNET  = BREGV + PREGV ;
CDISAC = CDISC ;
CDISNET = max(0,(CDISC + PCDIS ­ 
CDISPROV))  ;
CGLOAAC = CGLOA ;
CGLOANET = max(0,(CGLOA + PGLOA­
COD8YL ))  ;
Preparation by Etalab and DGFiP :
●
understand the Domain Specific
Language (DSL) : M
●
parse using Clean PEG (Igor
Dejanović's Arpeggio)
●
simplify the Abstract Syntax Tree
(AST)
→ Direct Acyclic Graph of trees
Preparation
comment = r'#.*'
symbol = r'w+'
symbol_enumeration = symbol 
("," symbol)*
float = r'd+.d+'
integer = r'd+'
string = '"' r'[^"]*' '"'
interval = symbol ".." symbol
brackets = "[" symbol "]"
...
Preparation by Etalab and DGFiP :
●
understand the Domain Specific
Language (DSL) : M
●
parse using Clean PEG (Igor
Dejanović's Arpeggio)
●
simplify the Abstract Syntax Tree
(AST)
→ Direct Acyclic Graph of trees
Preparation
Python object / JSON
●
Directed Acyclic Graph (DAG)
traversal (400ms)
●
Arithmetic computations at each
node (0.4ms in total for a single
simulation)
During the hackathon
Efficient computation
vs
400ms + 0.4ms = 400.4ms
for 1 simulation
400ms + 10.000x0.4ms = 4.4s
for 10.000 simulation
Long live Numpy and vectorized computations !
During the hackathon
Visualise
During the hackathon
Simplify the graph for common fiscal situations
During the hackathon
Transpile to other languages
var functionsMapping = {
    '+':function sumTab(tabValeurs){
         return tabValeurs.reduce(function(a,b){
            return a+b;
        });
    },
    '*':function mulTab(tabValeurs){
        return tabValeurs.reduce(function(a,b){
            return a*b;
        });
    },
    . . .
Step 1 : Define an implementation of the operations
During the hackathon
Transpile to other languages
function computeFormula(node, values){
    if(node.nodetype ==='symbol'){
        var value = values[node.name];
        if(typeof(value)==='undefined'){
            value = 0;
        };
        return value
    }else if(node.nodetype ==='float'){
        return node.value;
    }else if(node.nodetype==='call'){
        var name = node.name;
        var func = functionsMapping[name];
        var args = [];
        for(i in node.args){
            args.push(computeFormula(node.args[i],values));
        }
        return func(args);
    }
}
Step 2 : Code a DAG traversal
III – From code to data
II – The French tax
calculator
Tax rules vs implementation
Rule of least power
different concerns
storage
versioning
editing
speed
simplicity
(technologies
evolve fast)
Python Code
Quality Authority
Parsing the current code
Baron
Redbaron
Astroid Custom python
python → julia
2to3
The future
Tax rules
written in
DSL(s)
Unique internal
graph
representation
Implementation(s)
The glue ? Python ? A functional language ?
Take-away message
Language choice is not definitive !
(if you start with python)
Thank you !
http://www.openfisca.fr/
https://framagit.org/openfisca
https://github.com/openfisca
@OpenFisca
Michel Blancard
michel.blancard@data.gouv.fr
PyData – June 14, 2016
We are hiring !

More Related Content

Similar to Opening up the french tax software.

The City of Paris and Open Source Software, Paris Open Source Summit 2017
The City of Paris and Open Source Software, Paris Open Source Summit 2017The City of Paris and Open Source Software, Paris Open Source Summit 2017
The City of Paris and Open Source Software, Paris Open Source Summit 2017OW2
 
Foss4 G Slides V3
Foss4 G Slides V3Foss4 G Slides V3
Foss4 G Slides V3djayzen
 
French building of SDI : a bottom-up or a top-down process?
French building of SDI : a bottom-up or a top-down process?French building of SDI : a bottom-up or a top-down process?
French building of SDI : a bottom-up or a top-down process?Marc Leobet
 
AdmiSource - french e-government forge
AdmiSource - french e-government forgeAdmiSource - french e-government forge
AdmiSource - french e-government forgeAlexis Monville
 
Presentation by Christian Quest on Openstreetmap made at the OECD Conference ...
Presentation by Christian Quest on Openstreetmap made at the OECD Conference ...Presentation by Christian Quest on Openstreetmap made at the OECD Conference ...
Presentation by Christian Quest on Openstreetmap made at the OECD Conference ...OECD Governance
 
The reuse of open data: an opportunity for Spain
The reuse of open data: an opportunity for SpainThe reuse of open data: an opportunity for Spain
The reuse of open data: an opportunity for SpainAlberto Abella
 
Conférence INSPIRE de Rotterdam (2009) CNIG
Conférence INSPIRE de Rotterdam (2009) CNIGConférence INSPIRE de Rotterdam (2009) CNIG
Conférence INSPIRE de Rotterdam (2009) CNIGMarc Leobet
 
The use of FLOSS in Governments
The use of FLOSS in GovernmentsThe use of FLOSS in Governments
The use of FLOSS in GovernmentsNico Elema
 
José Manuel Leceta-La nueva revolución de la producción: la transformación di...
José Manuel Leceta-La nueva revolución de la producción: la transformación di...José Manuel Leceta-La nueva revolución de la producción: la transformación di...
José Manuel Leceta-La nueva revolución de la producción: la transformación di...Fundación Ramón Areces
 
Month of innovation 13 australian gov ct uinfoshare
Month of innovation 13 australian gov ct uinfoshare Month of innovation 13 australian gov ct uinfoshare
Month of innovation 13 australian gov ct uinfoshare christophe tallec
 
Cv jaime santos_20210105_1700english
Cv jaime santos_20210105_1700englishCv jaime santos_20210105_1700english
Cv jaime santos_20210105_1700englishJaime Santos Gonzalez
 
Local Weather Information and GNOME Shell Extension
Local Weather Information and GNOME Shell ExtensionLocal Weather Information and GNOME Shell Extension
Local Weather Information and GNOME Shell ExtensionSammy Fung
 
GeospatialWorlForum_Genève_090514
GeospatialWorlForum_Genève_090514GeospatialWorlForum_Genève_090514
GeospatialWorlForum_Genève_090514Marc Leobet
 
European Open Source Anchors in the Supply Chain
European Open Source Anchors in the Supply ChainEuropean Open Source Anchors in the Supply Chain
European Open Source Anchors in the Supply ChainOW2
 
Powering digital city tools with open source, OW2con'18, June 7-8, 2018, Paris
Powering digital city tools with open source, OW2con'18, June 7-8, 2018, ParisPowering digital city tools with open source, OW2con'18, June 7-8, 2018, Paris
Powering digital city tools with open source, OW2con'18, June 7-8, 2018, ParisOW2
 
Introduction to Caixa Magica Software
Introduction to Caixa Magica SoftwareIntroduction to Caixa Magica Software
Introduction to Caixa Magica Softwarejohngt
 
FreeGIS.net, INSPIRE, Open Source Software and OGC standards
FreeGIS.net, INSPIRE, Open Source Software and OGC standardsFreeGIS.net, INSPIRE, Open Source Software and OGC standards
FreeGIS.net, INSPIRE, Open Source Software and OGC standardsArnulf Christl
 
OSMC 2018 | Distributed Tracing FAQ by Gianluca Arbezzano
OSMC 2018 | Distributed Tracing FAQ by Gianluca ArbezzanoOSMC 2018 | Distributed Tracing FAQ by Gianluca Arbezzano
OSMC 2018 | Distributed Tracing FAQ by Gianluca ArbezzanoNETWAYS
 

Similar to Opening up the french tax software. (20)

The City of Paris and Open Source Software, Paris Open Source Summit 2017
The City of Paris and Open Source Software, Paris Open Source Summit 2017The City of Paris and Open Source Software, Paris Open Source Summit 2017
The City of Paris and Open Source Software, Paris Open Source Summit 2017
 
Foss4 G Slides V3
Foss4 G Slides V3Foss4 G Slides V3
Foss4 G Slides V3
 
French building of SDI : a bottom-up or a top-down process?
French building of SDI : a bottom-up or a top-down process?French building of SDI : a bottom-up or a top-down process?
French building of SDI : a bottom-up or a top-down process?
 
AdmiSource - french e-government forge
AdmiSource - french e-government forgeAdmiSource - french e-government forge
AdmiSource - french e-government forge
 
Presentation by Christian Quest on Openstreetmap made at the OECD Conference ...
Presentation by Christian Quest on Openstreetmap made at the OECD Conference ...Presentation by Christian Quest on Openstreetmap made at the OECD Conference ...
Presentation by Christian Quest on Openstreetmap made at the OECD Conference ...
 
Janus conf'19: janus client side
Janus conf'19:  janus client sideJanus conf'19:  janus client side
Janus conf'19: janus client side
 
The reuse of open data: an opportunity for Spain
The reuse of open data: an opportunity for SpainThe reuse of open data: an opportunity for Spain
The reuse of open data: an opportunity for Spain
 
Conférence INSPIRE de Rotterdam (2009) CNIG
Conférence INSPIRE de Rotterdam (2009) CNIGConférence INSPIRE de Rotterdam (2009) CNIG
Conférence INSPIRE de Rotterdam (2009) CNIG
 
The use of FLOSS in Governments
The use of FLOSS in GovernmentsThe use of FLOSS in Governments
The use of FLOSS in Governments
 
José Manuel Leceta-La nueva revolución de la producción: la transformación di...
José Manuel Leceta-La nueva revolución de la producción: la transformación di...José Manuel Leceta-La nueva revolución de la producción: la transformación di...
José Manuel Leceta-La nueva revolución de la producción: la transformación di...
 
Month of innovation 13 australian gov ct uinfoshare
Month of innovation 13 australian gov ct uinfoshare Month of innovation 13 australian gov ct uinfoshare
Month of innovation 13 australian gov ct uinfoshare
 
Cv jaime santos_20210105_1700english
Cv jaime santos_20210105_1700englishCv jaime santos_20210105_1700english
Cv jaime santos_20210105_1700english
 
Local Weather Information and GNOME Shell Extension
Local Weather Information and GNOME Shell ExtensionLocal Weather Information and GNOME Shell Extension
Local Weather Information and GNOME Shell Extension
 
GeospatialWorlForum_Genève_090514
GeospatialWorlForum_Genève_090514GeospatialWorlForum_Genève_090514
GeospatialWorlForum_Genève_090514
 
European Open Source Anchors in the Supply Chain
European Open Source Anchors in the Supply ChainEuropean Open Source Anchors in the Supply Chain
European Open Source Anchors in the Supply Chain
 
Powering digital city tools with open source, OW2con'18, June 7-8, 2018, Paris
Powering digital city tools with open source, OW2con'18, June 7-8, 2018, ParisPowering digital city tools with open source, OW2con'18, June 7-8, 2018, Paris
Powering digital city tools with open source, OW2con'18, June 7-8, 2018, Paris
 
Introduction to Caixa Magica Software
Introduction to Caixa Magica SoftwareIntroduction to Caixa Magica Software
Introduction to Caixa Magica Software
 
FreeGIS.net, INSPIRE, Open Source Software and OGC standards
FreeGIS.net, INSPIRE, Open Source Software and OGC standardsFreeGIS.net, INSPIRE, Open Source Software and OGC standards
FreeGIS.net, INSPIRE, Open Source Software and OGC standards
 
OSMC 2018 | Distributed Tracing FAQ by Gianluca Arbezzano
OSMC 2018 | Distributed Tracing FAQ by Gianluca ArbezzanoOSMC 2018 | Distributed Tracing FAQ by Gianluca Arbezzano
OSMC 2018 | Distributed Tracing FAQ by Gianluca Arbezzano
 
Vita actualized March 10th 2015 GPC
Vita actualized March 10th 2015 GPCVita actualized March 10th 2015 GPC
Vita actualized March 10th 2015 GPC
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 

Recently uploaded (20)

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Opening up the french tax software.

  • 1. Opening up the French tax software http://www.openfisca.fr/ https://framagit.org/openfisca https://github.com/openfisca @OpenFisca Michel Blancard michel.blancard@data.gouv.fr PyData – June 14, 2016
  • 2. I - What is OpenFisca?
  • 3. Legislation It's growing! In French (that most French people don't understand), not in python! Notices Bulletin Officiel des Finances Publiques-Impôts (BOFiP) Décrets How to compute the French tax and benefits?
  • 4. It's complex! 4 How to compute the French tax and benefits?
  • 5. It's complex, because the reality is complex. Individuals Housing Family Taxation How to compute the French tax and benefits?
  • 6. OpenFisca aims to : ● cover both tax and benefits policies ● be efficient ● one family simulation ● simulation on the whole country ● be understandable What is OpenFisca?
  • 7. OpenFisca is used for : ● improving readability to the public ● designing reforms ● simulating one's situation ● understanding the tax and social system mes-aides.gouv.fr Why compute the French tax and benefits?
  • 8. OpenFisca is used for : ● improving readability to the public ● designing reforms ● simulating one's situation ● understanding the tax and social system How to compute the French taxes ? tax difference between/after marriage
  • 9. OpenFisca is used for : ● improving readability to the public ● designing reforms ● simulating one's situation ● understanding the tax and social system How to compute the French taxes ? personal simulation ui.openfisca.fr
  • 10. OpenFisca is used for : ● improving readability to the public ● designing reforms ● simulating one's situation ● understanding the tax and social system How to compute the French taxes ? tax percentage as a function of income
  • 11. The history of OpenFisca 2011 2014 2016 2 economists python scripts with QT frontend 2 developers join the project tax calculator of the DGFiP released increasing demand for an open simulator OpenFisca reaches the sky and beyond... (see later) France Stratégie France Stratégie IPP Etalab
  • 12. II – The French tax calculator
  • 13. ● demande gracieuse (aug 2014) ● 6 months later : seisine of the CADA ● 2 months later : positive notice from the CADA ● 2 months later : beginning of judicial proceedings ● 10 months later : the DGFiP releases the source code ! ● 10 months later + ε : the court issues a positive decision The quest for the source code (want to speed up the process ? → ouvre-boite.org)
  • 14. ● April 1-2, 2016 at the Mozilla Fundation ● presence of 3 Ministers ● developers, civil servants, economists, citizens... all sitting at the same table ! A hackathon to celebrate : CodeImpôt
  • 15. Preparation by Etalab and DGFiP : ● understand the Domain Specific Language (DSL) : M ● parse using Clean PEG (Igor Dejanović's Arpeggio) ● simplify the Abstract Syntax Tree (AST) → Direct Acyclic Graph of trees Preparation regle 10214: application : iliad,batch ; CSGAC = max(0,CSGC ­ CICSG); CSNET = max(0,(CSGC + PCSG ­  CICSG ­ CSGIM)) ; RDSAC = max(0,RDSC ­ CIRDS); RDNET = max(0,(RDSC + PRDS ­  CIRDS ­ CRDSIM)); PRSNET = max(0,(PRSC + PPRS ­  CIPRS ­ PRSPROV))  ; CVNAC  =  CVNSALC; CVNNET  =  max(0,(CVNSALC + PCVN  ­ COD8YT)); REGVNET  = BREGV + PREGV ; CDISAC = CDISC ; CDISNET = max(0,(CDISC + PCDIS ­  CDISPROV))  ; CGLOAAC = CGLOA ; CGLOANET = max(0,(CGLOA + PGLOA­ COD8YL ))  ;
  • 16. Preparation by Etalab and DGFiP : ● understand the Domain Specific Language (DSL) : M ● parse using Clean PEG (Igor Dejanović's Arpeggio) ● simplify the Abstract Syntax Tree (AST) → Direct Acyclic Graph of trees Preparation comment = r'#.*' symbol = r'w+' symbol_enumeration = symbol  ("," symbol)* float = r'd+.d+' integer = r'd+' string = '"' r'[^"]*' '"' interval = symbol ".." symbol brackets = "[" symbol "]" ...
  • 17. Preparation by Etalab and DGFiP : ● understand the Domain Specific Language (DSL) : M ● parse using Clean PEG (Igor Dejanović's Arpeggio) ● simplify the Abstract Syntax Tree (AST) → Direct Acyclic Graph of trees Preparation Python object / JSON
  • 18. ● Directed Acyclic Graph (DAG) traversal (400ms) ● Arithmetic computations at each node (0.4ms in total for a single simulation) During the hackathon Efficient computation vs 400ms + 0.4ms = 400.4ms for 1 simulation 400ms + 10.000x0.4ms = 4.4s for 10.000 simulation Long live Numpy and vectorized computations !
  • 20. During the hackathon Simplify the graph for common fiscal situations
  • 21. During the hackathon Transpile to other languages var functionsMapping = {     '+':function sumTab(tabValeurs){          return tabValeurs.reduce(function(a,b){             return a+b;         });     },     '*':function mulTab(tabValeurs){         return tabValeurs.reduce(function(a,b){             return a*b;         });     },     . . . Step 1 : Define an implementation of the operations
  • 22. During the hackathon Transpile to other languages function computeFormula(node, values){     if(node.nodetype ==='symbol'){         var value = values[node.name];         if(typeof(value)==='undefined'){             value = 0;         };         return value     }else if(node.nodetype ==='float'){         return node.value;     }else if(node.nodetype==='call'){         var name = node.name;         var func = functionsMapping[name];         var args = [];         for(i in node.args){             args.push(computeFormula(node.args[i],values));         }         return func(args);     } } Step 2 : Code a DAG traversal
  • 23. III – From code to data
  • 24. II – The French tax calculator Tax rules vs implementation Rule of least power different concerns storage versioning editing speed simplicity (technologies evolve fast)
  • 25. Python Code Quality Authority Parsing the current code Baron Redbaron Astroid Custom python python → julia 2to3
  • 26. The future Tax rules written in DSL(s) Unique internal graph representation Implementation(s) The glue ? Python ? A functional language ?
  • 27. Take-away message Language choice is not definitive ! (if you start with python)
  • 28. Thank you ! http://www.openfisca.fr/ https://framagit.org/openfisca https://github.com/openfisca @OpenFisca Michel Blancard michel.blancard@data.gouv.fr PyData – June 14, 2016 We are hiring !