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#

  1. Request access to the BONSAI working data bundle if you do not already have it. Contact the BONSAI administrator.

  2. Set BONSAI_HOME to the directory containing your local copy of _bonsai.

  3. Set BONSAI_TOKEN to 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.json and versions/versions_20260615.txt

  • _b Next version/Use/20260615/value_added_proportions.pkl

  • _b Next version/Balanced/20260615/use_w_monetary_unit.csv

  • collect/gdp/unstat-gdp-countries-usd.xlsx

  • Classification 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.