OpenFisca-France-Data module to work with French survey data
Project description
OpenFisca France Data
[EN] Introduction
OpenFisca is a versatile microsimulation free software. You can check the online documentation for more details.
This repository contains the OpenFisca-France-Data module, to work with OpenFisca-France and French survey or population data (ERFS and ERFS-FPR).
Here is the list of the managed data:
- DADS, annual declaration of social data ;
- ERFS, tax and social incomes survey ;
- ERFS-FPR, ERFS production and research files ;
- FELIN, sampled file of the income tax.
To transform your survey data into OpenFisca-France-Data formatted data you need to start with openfisca-survey-manager repository.
[FR] Introduction
OpenFisca est un logiciel libre de micro-simulation. Pour plus d'information, vous pouvez consulter la documentation officielle.
Ce dépôt contient le module OpenFisca-France-Data. Il permet d'associer l'usage d'OpenFisca-France à des données d'enquête ou de population sur la France.
Ceci est la liste les données traitées :
- DADS, Déclaration Annuelle des Données Sociales ;
- ERFS, Enquête Revenus Fiscaux et Sociaux ;
- ERFS-FPR, ERFS fichiers de Production et de Recherche ;
- FELIN, fichier échantillonné de l'impôt sur le revenu.
Afin de transformer vos données d'enquête en des données au format OpenFisca-France-Data, vous aurez à débuter par le dépôt openfisca-survey-manager.
Environment
OpenFisca-France-Data runs runs on Python 3.7. More recent versions should work, but are not tested.
Backward compatibility with Python 2.7 has been dropped since January 1st, 2019.
Installation
You can follow this installation if you want to:
- run one of OpenFisca-France-Data scripts,
- develop and contribute to OpenFisca-France-Data source code. Please be welcomed! :)
You will need to download and install the module locally:
git clone https://github.com/openfisca/openfisca-france-data.git
cd openfisca-france-data
make install
This should not display any error and end with:
Successfully installed OpenFisca-France-Data...
Execution
Let's say that you would like to format ERFS-FPR
survey data into OpenFisca formatted data.
💡If you have other data managed by openfisca-france-data
(like FELIN
), change erfs_fpr
by your data name in the next steps description.
You have already used openfisca-survey-manager
. So, you have a config.ini
file configured for this survey and a HDF5 file generated in the directory that you defined under output_directory
in your config.ini
.
For more information, you can see the configuration steps of
openfisca-survey-manager
README.
To run openfisca_france_data
on ERFS-FPR
survey data:
-
In the survey directory
openfisca_france_data/erfs_fpr
, open the main script:openfisca_france_data/erfs_fpr/input_data_builder/__init__.py
-
At the end of the script, check
if __name__ == '__main__'
bloc and update its configured variables (likeyear
) to match your needs. -
Run the script with this command:
python openfisca_france_data/erfs_fpr/input_data_builder/__init__.py
The script should end without error and display these lines:
INFO:__main__:Script finished after... Closing remaining open files...
-
Check the script results:
openfisca_erfs_fpr.json
file generated in the directory you configured in yourconfig.ini
undercollections_directory
key.input.h5
file generated in the directory you configured in yourconfig.ini
underoutput_directory
key. This HDF5 file contains a group with two items:- an item with your data organised by OpenFisca-France
Individu
entity, - an item with your data organised by OpenFisca-France
Menage
entity.
- an item with your data organised by OpenFisca-France
- Specific to
ERFS-FPR
script:dummy_data.h5
if you keptexport_flattened_df_filepath
option's value inopenfisca_france_data/erfs_fpr/input_data_builder/__init__.py
.
The script also adds a
openfisca_erfs_fpr
key to yourconfig.ini
.
Testing
To run the entire test suite:
make test
Style
This repository adheres to a certain coding style, and we invite you to follow it for your contributions to be integrated promptly.
To run the style checker:
make check-style
To automatically style-format your code changes:
make format-style
To automatically style-format your code changes each time you commit:
touch .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit
tee -a .git/hooks/pre-commit << END
#!/bin/sh
#
# Automatically format your code before committing.
exec make format-style
END
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file OpenFisca_France_Data-0.15.0-py3-none-any.whl
.
File metadata
- Download URL: OpenFisca_France_Data-0.15.0-py3-none-any.whl
- Upload date:
- Size: 129.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/51.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7e9a32c7e401057b68f9d8bacacc0016134f6caa8973bf144bef74d57df7ef6 |
|
MD5 | 18ebad01e1c37da4bc84c52d5d1aefbb |
|
BLAKE2b-256 | b02511f8f295d59dc28fe0e8b8f1d48449eeb6eeabeffcd5cbac1bc01f51f205 |