Getting started#
Install BONSAI-IO and run one task on the 2016 balanced accounts. Use a local copy of the data bundle so the example writes to your own files.
Install BONSAI-IO#
Use Python 3.12, the version used by the project’s GitLab jobs. In an activated virtual environment, run:
git clone git@gitlab.com:bonsamurais/bonsai/build/hybrid_sut.git
cd hybrid_sut
python -m pip install -e packages/bonsai-io
Set up data access#
Request access to the BONSAI working data bundle if you do not already have it. Contact the BONSAI administrator.
Set
BONSAI_HOMEto the directory containing your local copy of_bonsai.Set
BONSAI_TOKENto your BONSAI API token. Create an account if you need one.
The example uses the 2016 inputs under run date 20260615. Check that your
bundle contains the following files relative to _bonsai:
accounts.jsonandversions/versions_20260615.txt_b Next version/Use/20260615/value_added_proportions.pkl_b Next version/Balanced/20260615/use_w_monetary_unit.csvcollect/gdp/unstat-gdp-countries-usd.xlsxClassification and other data/corrspondence/fao/FAOSTAT_country_vs_ISO_20240130.csv
The task also reads location classifications and correspondences from the BONSAI API.
Run the value-added task#
In Python, run:
from bonsai.io import Config, Workflow
config = Config()
config.year = 2016
config.date = "2026-06-15"
workflow = Workflow(config=config)
workflow.run_task("disaggregate_value_added_after_balance", force_run=True)
Open value_added_after_balance.csv for the available components and
value_added_reconciliation.csv for coverage and accounting gaps. Both are in
_bonsai/_b Next version/Balanced/20260615. The task also writes a regional GDP
comparison to _bonsai/_b Next version/check_data.
See the user guide to inspect dependencies, run a sequence of tasks, or find the execution log.