A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

EOS-AYCE

Eaternity's software platform serving as an open-source environmental operating system (EOS) for all you can eat (AYCE) for climate.
https://gitlab.com/eaternity/eos

Category: Industrial Ecology
Sub Category: Life Cycle Assessment

Last synced: about 19 hours ago
JSON representation

Repository metadata

Environmental operating system

https://gitlab.com/eaternity/eos/blob/develop/

          
# Eaternity EOS

This project embodies Eaternity's mission of "Accelerating the World's Transition to a Sustainable Food System" by establishing the necessary infrastructure to calculate and publish the major environmental impacts of all foods. We have named this initiative "All You Can Eat" or AYCE, which represents a software platform serving as an open-source environmental operating system (EOS) to achieve our goals. The projects website is developed here: [http://ayce.earth](http://ayce.earth).

Our goal is to provide an accurate, affordable, and constructive environmental operating system for decision-making and communication across major food-providing business segments (producers, restaurants, and retailers)⁠. This includes:
- To make environmental information about food accessible to users in the restaurant and food industry⁠ through our existing API
- To calculate the complete life cycle of food products from cradle to kitchen gate, including aspects like packaging, disposal, processing, storage, and distribution⁠
- To automate calculations and reduce human labor costs, with the aim of achieving high quality calculations at a cost of just a few Euros per calculation⁠
- To serve as the backbone for the "All You Can Eat" (AYCE) project, making food environmental impacts free and accessible to everyone⁠
⁠​

Overall, EOS is central to Eaternity's mission by providing comprehensive, efficient, and accessible environmental impact data for food products.

#### Our strategy revolves around leveraging our core strengths, which include:

- Expertise in life cycle assessment, enabling us to consistently perform comprehensive and accurate impact calculations for individual food products.
- Proficiency in building software architectures, as demonstrated by our successful development of our CO2 calculation tool for numerous restaurants. Over the past decade, we have accumulated invaluable knowledge and experience in this field.
- Utilization of recurring revenue streams to finance this operation. Having established a break-even business model, we have the freedom to allocate our resources towards research and development in the years ahead.

#### To ensure the effectiveness of our platform, we place significant emphasis on data and software architecture, specifically focusing on:

- Computational efficiency, allowing for scalable, dynamic, and instantaneous impact recalculations through the utilization of matrix calculus and cloud architecture.
- Rapid development capabilities, achieved by providing a structured framework and generic components that facilitate the addition of complexity without unnecessarily complicating the system. One approach involves implementing independent gap-filling modules that can be executed and scheduled separately, relying on a glossary for dependencies rather than direct data connections.
- Transparency and accessibility, enabling non-IT individuals to easily review the calculation process. This is achieved by ensuring transparent, deterministic graph mutations that can be comprehended by a wider audience.

We document our progress and decisions on Notion, which you can find here: [http://eaternity.notion.site](https://www.notion.so/eaternity/Project-EOS-AYCE-kale-a8f5d9809b65416aa159adf83f0f459b) (not yet public).

**We actively seek collaborations with scientists and food retailers to enhance our models and share our results with the public. Please feel free to reach out to us if you are interested in collaborating.**

## Project Setup

You need to have docker installed on your system (preferably in rootless mode).

First, create a folder `secrets` in the root directory of the project and add the `service_account.json` file for the
Google Cloud service account.

Then copy the `.env.sample` file to `.env` and adjust the environment variables to your needs:

```bash
cp .env.sample .env
```

also make sure to create a temp folder for the data:

```bash
mkdir -p temp_data/location_gfm
```

There are two options how you can run EOS:

## Option 1: Python on host system

This option is most suitable for development, because it allows you to easily attach debugging tools while you develop gap-filling-modules.

If you want to contribute to the project by developing gap-filling modules,
we suggest to install PyCharm Community Edition or Visual Studio Code with the following extensions:

* Python
* PyLance
* PythonDebugger
* Black Formatter
* isort
* Ruff

Go through [CONTRIBUTING.md](CONTRIBUTING.md) for configuration.

### Requirements:

Please make sure to first install:

- docker >= 24.0.4
- python == 3.11.3
- poetry >= 1.8

### Linux x86_64

If you have multiple python versions installed, it might be necessary to first tell poetry to use the correct python
version by executing in the `eos` directory:

```bash
poetry env use /usr/local/bin/python3.11
```

If you use pyenv, first install the python version and then create a virtualenv to use in poetry:

```bash
pyenv install -v 3.11.3
pyenv virtualenv 3.11.3 eos_env
pyenv activate eos_env
pyenv virtualenv-prefix eos_env
poetry env use $(pyenv virtualenv-prefix eos_env)/bin/python3.11
```

To install the python dependencies of our project use poetry inside the project root folder:

```bash
poetry install
```

Note, that this will install all dependencies from the committed `poetry.lock` file in the root folder, which contains
also all the dependencies that are specified in the dependent poetry projects of sub-folders. Therefore, it
is **not** necessary to run `poetry install` inside the sub-folders (except you want to specifically update the version
of a sub-sub-dependency in one of the sub-folders).

### macOS aarch64

On linux x86_64, we use `pypardiso` sparse solver that depends on Intel openmp, tbb and mkl, none of which are available on aarch64, e.g. Apple Silicon M1.
On macOS aarch64 Docker Desktop will run the images as Linux on aarch64, making the pypardiso solver replacement necessary within the docker images too.
As a fallback, we use `scikit-umfpack` on aarch64.
Therefore, on aarch64 systems, it is necessary to install `SuiteSparse` and `swig`.
Further the python `tables` module is broken on aarch64, to build from source we need hdf5 dependencies.
Follow those steps on an aarch64 machine:

```bash
# make sure to install poetry for python 3.11
curl -sSL https://install.python-poetry.org | python3.11 -
# or with a homebrew install poetry: setup python environment
poetry env use $(which python3.11)

# install dependencies
brew install suite-sparse swig
brew install c-blosc hdf5 lzo
# export needed environment for building tables
export HDF5_DIR=/opt/homebrew/opt/hdf5
export BLOSC_DIR=/opt/homebrew/opt/c-blosc
export LZO_DIR=/opt/homebrew/opt/lzo
# install the dependencies
poetry install
# if the above fails you can try to
# rebuild all poetry.lock files on your aarch64 machine, the included one's are for x86_64
# this runs poetry install for you:
scripts/update_deps.sh
```

#### all OS and archictecture independent

Copy the provided sample env file and start the database service and seed the database with our schema:

```bash
docker compose up -d postgres rabbitmq gadm_cache
poetry run python -m database --reinit
poetry run python -m inventory_importer.bw_import_controller --edb_path ./temp_data/brightway --download_from_gdrive 1QGgJPHuz-m7MA5zIkerN1b2EsId8dnIu --import_using_airtable  --import_all_impact_assessments --import_glossary --import_matchings_from_airtable --gfm_import_data
```

Now you can run the python services on the host system:

```bash
poetry run python -m api
poetry run python -m legacy_api
```

PyCharm debug/run configurations for above python services are stored in `.idea/runConfigurations/` and can
easily be used to reset the database to a clean state and to start the api services in the PyCharm Debugger.

If you use VS Code, ask a workmate for corresponding launch configurations and store them as `.vscode/launch.json`

For these debug configurations to work, you should select the python interpreter of the poetry environment that was created by the above `poetry install`. By default, poetry created a new environment for eos in a path like this:

    $HOME/.cache/pypoetry/virtualenvs/eaternity-eos-Jmd7uH6u-py3.11/bin/python

If using PyCharm, select the interpreter in project settings.

If using VS Code, open the Command Palette (`Ctrl+Shift+P`) and search for `Python: Select Interpreter` to choose.


## Option 2: Everything in Docker

Alternatively, you can start all services in docker without having python installed on your system:
First build the image and seed the database:

```bash
docker compose build _image_build
docker compose up -d postgres rabbitmq
docker compose --profile initdb run --rm initdb
docker compose --profile inventory_importer run --rm inventory_importer
docker compose --profile inventory_importer_gfm_import_data run --rm inventory_importer_gfm_import_data
```

Now you can start the dockerized python services:

```bash
docker compose --profile api up -d
```

## What to try out

After you followed option 1 or 2 above, you should be able to access the swagger ui and do example requests:

- new API at [http://localhost:8040/docs](http://localhost:8040/v2/docs)
- legacy API at [http://localhost:8050/docs](http://localhost:8050/api/docs)

Please, also checkout the example requests in the `/scripts` folder to get started.

## Troubleshooting

We use multiprocessing in unittests of the `legacy_api` package to run the new api service in a separate process.
In order to be able to debug the multiprocessing code with PyCharm, you need to enable in the PyCharm settings
under `Python Debugger` the option `Gevent compatible`.

When adding a new Poetry dependency to sub-packages (for example, `core` or `api`), it is necessary to update
root folder dependencies file as well by running `poetry update *sub-package*` command in root folder.

## To check for updates of dependencies:

To show currently installed versions and available updated versions:

```bash
poetry show -l
```

        

Committers metadata

Last synced: 9 months ago

Total Commits: 751
Total Committers: 13
Avg Commits per committer: 57.769
Development Distribution Score (DDS): 0.731

Commits in past year: 448
Committers in past year: 10
Avg Commits per committer in past year: 44.8
Development Distribution Score (DDS) in past year: 0.598

Name Email Commits
Holger Finger h****r@p****m 202
schoi839 s****i@e****h 182
Holger Finger h****r@g****m 144
Alexei Glon a****n@e****h 74
Yannick Schubert y****t@e****h 67
Renaud Richardet r****t@e****h 38
Michael Kefeder m****r@e****h 17
Michael Kefeder m****r@g****m 14
Manuel Klarmann m****n@e****h 7
Philip Winkler p****1@d****k 3
Hrishikesh Nangare h****e@a****m 1
Jens Hinkelmann j****s@h****h 1
Renaud Richardet r****t@i****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 9 months ago

Total issues: 0
Total pull requests: 200
Average time to close issues: N/A
Average time to close pull requests: 7 days
Total issue authors: 0
Total pull request authors: 6
Average comments per issue: 0
Average comments per pull request: 1.98
Merged pull request: 0
Bot issues: 0
Bot pull requests: 0

Past year issues: 0
Past year pull requests: 78
Past year average time to close issues: N/A
Past year average time to close pull requests: 9 days
Past year issue authors: 0
Past year pull request authors: 5
Past year average comments per issue: 0
Past year average comments per pull request: 1.54
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://gitlab.com/eaternity/eos

Top Issue Authors

Top Pull Request Authors

  • holgerfinger (121)
  • alexei-eaternity (51)
  • renaudr (20)
  • schoi839 (4)
  • mike-kfed (3)
  • yschubert (1)

Top Issue Labels

Top Pull Request Labels


Dependencies

eos-ui/package-lock.json npm
  • 125 dependencies
eos-ui/package.json npm
  • @vitejs/plugin-vue ^3.1.0 development
  • vite ^3.1.0 development
  • vite-plugin-vuetify ^1.0.0-alpha.12 development
  • vue-cli-plugin-vuetify ~2.5.5 development
  • @braks/vue-flow ^0.4.38
  • @mdi/font 5.9.55
  • roboto-fontface *
  • vue ^3.2.37
  • vue-router ^4.1.5
  • vuejs-tree ^3.0.2
  • vuetify ^3.0.0-beta.0
  • webfontloader ^1.0.0
api/poetry.lock pypi
  • atomicwrites 1.4.1 develop
  • attrs 21.4.0 develop
  • debugpy 1.6.2 develop
  • iniconfig 1.1.1 develop
  • packaging 21.3 develop
  • pluggy 1.0.0 develop
  • py 1.11.0 develop
  • pyparsing 3.0.9 develop
  • pytest 7.1.2 develop
  • tomli 2.0.1 develop
  • anyio 3.6.1
  • asgiref 3.5.2
  • asyncpg 0.26.0
  • certifi 2022.6.15
  • charset-normalizer 2.1.0
  • click 8.1.3
  • colorama 0.4.5
  • core 0.1.0
  • database 0.1.0
  • fastapi 0.70.1
  • h11 0.13.0
  • httptools 0.2.0
  • idna 3.3
  • numpy 1.21.3
  • protobuf 3.20.1
  • pydantic 1.9.1
  • python-dotenv 0.20.0
  • pyyaml 6.0
  • requests 2.28.1
  • sniffio 1.2.0
  • starlette 0.16.0
  • structlog 21.5.0
  • typing-extensions 4.3.0
  • urllib3 1.26.11
  • uvicorn 0.15.0
  • uvloop 0.16.0
  • watchgod 0.8.2
  • websockets 10.3
api/pyproject.toml pypi
  • debugpy ^1.6.0 develop
  • pytest ^7.1.2 develop
  • core *
  • database *
  • fastapi ^0.70.0
  • python ~3.10.1
  • structlog ^21.5.0
  • uvicorn ^0.15.0
core/poetry.lock pypi
  • atomicwrites 1.4.1 develop
  • attrs 21.4.0 develop
  • colorama 0.4.5 develop
  • debugpy 1.6.2 develop
  • iniconfig 1.1.1 develop
  • packaging 21.3 develop
  • pluggy 1.0.0 develop
  • py 1.11.0 develop
  • pyparsing 3.0.9 develop
  • pytest 7.1.2 develop
  • tomli 2.0.1 develop
  • asyncpg 0.26.0
  • certifi 2022.6.15
  • charset-normalizer 2.1.0
  • database 0.1.0
  • idna 3.3
  • numpy 1.21.3
  • protobuf 3.20.1
  • requests 2.28.1
  • urllib3 1.26.11
core/pyproject.toml pypi
  • debugpy ^1.6.0 develop
  • pytest ^7.1.2 develop
  • database *
  • numpy 1.21.3
  • python ~3.10.1
database/poetry.lock pypi
  • atomicwrites 1.4.1 develop
  • attrs 21.4.0 develop
  • colorama 0.4.5 develop
  • debugpy 1.6.2 develop
  • iniconfig 1.1.1 develop
  • packaging 21.3 develop
  • pluggy 1.0.0 develop
  • py 1.11.0 develop
  • pyparsing 3.0.9 develop
  • pytest 7.1.2 develop
  • tomli 2.0.1 develop
  • asyncpg 0.26.0
  • certifi 2022.6.15
  • charset-normalizer 2.1.0
  • idna 3.3
  • protobuf 3.20.1
  • requests 2.28.1
  • urllib3 1.26.11
database/pyproject.toml pypi
  • debugpy ^1.6.0 develop
  • pytest ^7.1.2 develop
  • asyncpg ^0.26.0
  • protobuf 3.20.*
  • python ~3.10.1
  • requests ^2.28.1
legacy_api/poetry.lock pypi
  • atomicwrites 1.4.1 develop
  • attrs 21.4.0 develop
  • debugpy 1.6.2 develop
  • iniconfig 1.1.1 develop
  • packaging 21.3 develop
  • pluggy 1.0.0 develop
  • py 1.11.0 develop
  • pyparsing 3.0.9 develop
  • pytest 7.1.2 develop
  • tomli 2.0.1 develop
  • anyio 3.6.1
  • asgiref 3.5.2
  • asyncpg 0.26.0
  • certifi 2022.6.15
  • charset-normalizer 2.1.0
  • click 8.1.3
  • colorama 0.4.5
  • core 0.1.0
  • database 0.1.0
  • fastapi 0.70.1
  • h11 0.13.0
  • httptools 0.2.0
  • idna 3.3
  • numpy 1.21.3
  • protobuf 3.20.1
  • pydantic 1.9.1
  • python-dotenv 0.20.0
  • pyyaml 6.0
  • requests 2.28.1
  • sniffio 1.2.0
  • starlette 0.16.0
  • structlog 21.5.0
  • typing-extensions 4.3.0
  • urllib3 1.26.11
  • uvicorn 0.15.0
  • uvloop 0.16.0
  • watchgod 0.8.2
  • websockets 10.3
legacy_api/pyproject.toml pypi
  • debugpy ^1.6.0 develop
  • pytest ^7.1.2 develop
  • core *
  • database *
  • fastapi ^0.70.0
  • python ~3.10.1
  • structlog ^21.5.0
  • uvicorn ^0.15.0
poetry.lock pypi
  • atomicwrites 1.4.1 develop
  • autopep8 1.7.0 develop
  • debugpy 1.6.3 develop
  • httpcore 0.15.0 develop
  • httpx 0.23.0 develop
  • iniconfig 1.1.1 develop
  • packaging 21.3 develop
  • pluggy 1.0.0 develop
  • py 1.11.0 develop
  • pycodestyle 2.9.1 develop
  • pyparsing 3.0.9 develop
  • pytest 7.1.2 develop
  • pytest-asyncio 0.19.0 develop
  • rfc3986 1.5.0 develop
  • toml 0.10.2 develop
  • tomli 2.0.1 develop
  • aiohttp 3.8.1
  • aiosignal 1.2.0
  • anyio 3.6.1
  • api 0.1.0
  • asgiref 3.5.2
  • async-timeout 4.0.2
  • asyncpg 0.26.0
  • attrs 22.1.0
  • certifi 2022.6.15
  • charset-normalizer 2.1.1
  • click 8.1.3
  • colorama 0.4.5
  • core 0.1.0
  • database 0.1.0
  • fastapi 0.70.1
  • frozenlist 1.3.1
  • h11 0.12.0
  • httptools 0.2.0
  • idna 3.3
  • legacy-api 0.1.0
  • multidict 6.0.2
  • numpy 1.21.3
  • protobuf 3.20.1
  • pydantic 1.9.2
  • python-dotenv 0.20.0
  • pyyaml 6.0
  • requests 2.28.1
  • sniffio 1.2.0
  • starlette 0.16.0
  • structlog 21.5.0
  • typing-extensions 4.3.0
  • urllib3 1.26.12
  • uvicorn 0.15.0
  • uvloop 0.16.0
  • watchgod 0.8.2
  • websockets 10.3
  • yarl 1.8.1
pyproject.toml pypi
  • aiohttp ^3.8.1 develop
  • asyncpg ^0.26.0 develop
  • autopep8 ^1.6.0 develop
  • debugpy ^1.6.0 develop
  • httpx ^0.23.0 develop
  • pytest ^7.1.2 develop
  • pytest-asyncio ^0.19.0 develop
  • python-dotenv ^0.20.0 develop
  • aiohttp ^3.8.1
  • api *
  • core *
  • database *
  • legacy_api *
  • python ~3.10.1

Score: 4.174387269895637