Back to blog
·2 min read·Tristan Méneret
Tutorial: calculate a company's ESG impact with the EaaC GitHub
tutorialGitHubtechnicalPython
Prerequisites
To follow this tutorial, you need:
- Python 3.10 or higher
- Git
No API key is required: all data sources are open.
Installation
git clone https://github.com/tmegit/economy-as-a-code.git
cd economy-as-a-code
pip install -e .
Prepare company data
Create a JSON file containing the company information:
{
"name": "My Company Ltd",
"country": "FR",
"revenue": 2000000,
"employees": 25,
"taxes": 60000,
"sector": "6201Z"
}
The required fields are: name, country, revenue, employees, taxes, and sector (NAF or NACE code).
CLI computation
The simplest mode: you provide a JSON file with the company data and the EaaC engine handles the rest.
eaac compute --data company.json
The output displays four sections:
EaaC Impact Report: My Company Ltd (N/A)
================================================================================
MACRO INDICATORS
Economic: 940.2k EUR
Social: 7.4 ETP
Fiscal: 55.1k EUR
Carbon: 6.6 tCO2e
IMPACT MATRIX
Indicator Direct Indirect Induced Total
------------------------------------------------------------------------
Economic 2.0M EUR 800.0k EUR 140.2k EUR 940.2k EUR
Social 25.0 ETP 5.2 ETP 2.2 ETP 7.4 ETP
Fiscal 60.0k EUR 35.0k EUR 10.1k EUR 55.1k EUR
Carbon 3.2 tCO2e 2.6 tCO2e 0.8 tCO2e 6.6 tCO2e
MULTIPLIER EFFECTS
Economic: 1 EUR of revenue generates 1.47 EUR in the economy
Social: 1 direct job generates 1.30 total jobs
Fiscal: 1 EUR of revenue generates 0.0276 EUR in taxes
COUNTRY BREAKDOWN (1 countries)
Country Economic Social Fiscal Carbon
----------------------------------------------------------------------------
France 940.2k EUR 7.4 ETP 55.1k EUR 6.6 tCO2e
----------------------------------------------------------------------------
Total 940.2k EUR 7.4 ETP 55.1k EUR 6.6 tCO2e
Precise calculation (with supplier data)
For a more detailed report, you can provide your supplier list:
eaac compute --data company.json --suppliers suppliers.csv
The CSV file contains the following columns:
supplier_siren,country,amount,revenue,employees,name
123456789,FR,150000,0,0,French Supplier
,ES,22000,500000,12,Spanish Supplier
- French suppliers: provide
supplier_siren, data is fetched automatically - International suppliers: provide
country,amount,revenue,employees
Python usage
You can also use the Python API directly:
from eaac import EaaCEngine
engine = EaaCEngine()
company_data = {
"name": "My Company Ltd",
"country": "FR",
"revenue": 2_000_000,
"employees": 25,
"taxes": 60_000,
"sector": "6201Z",
}
impact = engine.compute(company_data=company_data)
print(impact.summary())
Exporting results
# JSON export
eaac compute --data company.json --format json --output report.json
# CSV export
eaac compute --data company.json --format csv --output report.csv
Or via Python:
impact.to_json("report.json")
impact.to_csv("report.csv")
Next steps
- Check the full documentation on the GitHub repository
- To understand the formulas in detail, get the book Economy as a Code on Amazon