This package allows users to store and load various UK microdata sources for usage in openfisca-uk
, with different configurations (e.g. imputations between surveys).
To get this package working for OpenFisca-UK without access to the UKDA:
- Download
synth_frs_2018.h5
openfisca-uk-data synth_frs save synth_frs_2018.h5
To get this package working with the FRS microdata:
- Have the TAB .zip file ready (8633~~~.zip)
openfisca-uk-data raw_frs generate 2018 8633~~~.zip
openfisca-uk-data frs generate 2018
This package is designed to be simple to add new OpenFisca-UK-compatible datasets. To add a new dataset:
- Add a new Python module as a single file or folder with
__init__.py
(optional) - Create a class with the
@dataset
decorator (fromutils.py
) - Define a
generate(year)
method - Ensure the class is imported in
openfisca_uk/__init__.py
andopenfisca_uk/cli.py
All dataset classes can be imported from the package, and there is also a command line interface:
openfisca-uk-data [dataset_name] [method] [arg1] [arg2]
For example:
openfisca-uk-data raw_frs generate 2018 data.zip
This package uses a class decorator to ensure all datasets have the same loading/saving/querying interface. To use it, use the @
symbol:
@dataset
class CustomDataset:
input_reform_from_year: Callable[int -> Reform]
def generate(year):
...
...
- Not OpenFisca-UK-compatible
- Contains the tables from the raw microdata
- OpenFisca-UK-compatible
- Loads the named survey variables, and specifies how these should be transformed into the model's input variables using OpenFisca formulas
- OpenFisca-UK-compatible
- Skips loading the named survey variables like BaseFRS, instead loading the calculated input variables from using BaseFRS
- OpenFisca-UK-compatible
- Admin tax data
- OpenFisca-UK-compatible
- Inaccurate but gives ballpark-correct results without access to the full FRS (fields shuffled + random noise added)