Metadata-Version: 2.4
Name: materia-epd
Version: 0.8.0
Summary: Aggregate and normalize Environmental Product Declaration (EPD) datasets.
Author: pbaustert, tngTUDOR, glarreag, killileg
License-Expression: MIT
Project-URL: Homepage, https://github.com/pbaustert/materia-epd
Project-URL: Documentation, https://materia-epd.readthedocs.io/en/latest/
Project-URL: Repository, https://github.com/pbaustert/materia-epd
Project-URL: Issues, https://github.com/pbaustert/materia-epd/issues
Project-URL: Changelog, https://materia-epd.readthedocs.io/en/latest/changelog.html
Keywords: epd,ilcd,lca,life-cycle-assessment,environmental-product-declaration,sustainability
Classifier: Development Status :: 3 - Alpha
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering
Requires-Python: <3.13,>=3.10
Description-Content-Type: text/markdown
License-File: LICENSE.txt
Requires-Dist: click
Requires-Dist: numpy
Requires-Dist: pandas
Requires-Dist: pycountry
Requires-Dist: comtradeapicall
Requires-Dist: rich>=14.3.2
Requires-Dist: structlog>=25.5.0
Requires-Dist: matplotlib
Requires-Dist: reportlab
Provides-Extra: dev
Requires-Dist: black==23.9.1; extra == "dev"
Requires-Dist: flake8==6.1.0; extra == "dev"
Requires-Dist: pytest==7.4.2; extra == "dev"
Requires-Dist: pytest-cov==4.1.0; extra == "dev"
Requires-Dist: pre-commit==3.4.0; extra == "dev"
Requires-Dist: deptry; extra == "dev"
Requires-Dist: coverage-badge; extra == "dev"
Requires-Dist: sphinx; extra == "dev"
Requires-Dist: setuptools>=82.0.0; extra == "dev"
Dynamic: license-file

# Generic EPD Aggregator

[![Build](https://github.com/pbaustert/materia-epd/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/pbaustert/materia-epd/actions/workflows/ci.yml)
![Coverage](https://raw.githubusercontent.com/pbaustert/materia-epd/main/coverage.svg)
[![PyPI](https://img.shields.io/pypi/v/materia-epd.svg)](https://pypi.org/project/materia-epd/)
[![Python](https://img.shields.io/pypi/pyversions/materia-epd.svg)](https://pypi.org/project/materia-epd/)
[![Documentation](https://readthedocs.org/projects/materia-epd/badge/?version=latest)](https://materia-epd.readthedocs.io/en/latest/)
[![License](https://img.shields.io/github/license/pbaustert/materia-epd)](https://github.com/pbaustert/materia-epd/blob/main/LICENSE.txt)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://pre-commit.com/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Flake8](https://img.shields.io/badge/linting-flake8-blue)](https://flake8.pycqa.org/en/latest/)

---

# Features

- Parse ILCD process and flow XMLs
- Normalize material properties and LCIA modules
- Aggregate impacts and compute weighted averages
- Write new ILCD XML datasets

---

## Installation

Install via PyPI:

```console
pip install materia-epd
```

Requires Python 3.10+.

---

## Documentation

Full documentation is hosted on [Read the Docs](https://materia-epd.readthedocs.io/en/latest/).

It covers the EPD pipeline, module reference, contributing guidelines, and the changelog.

---

## Usage

### Run the aggregator

```console
python -m materia_epd <generic_processes_dir> <epd_processes_dir> -o <output_dir> -v
```

Note that you need to point to the root `processes` folders and need to provide a `matches` folder in the generic data folder to link generic products and EPDs.
Add the flag `--v` or `-v` for verbosity. Logs files with details will be automatically created in `<output_dir>`.

#### Run for specific processes only

By default, the pipeline runs for all processes with defined matches. To run only for specific processes, provide a JSON file containing an array of UUIDs via the `--process-list` or `-p` option:

```console
python -m materia_epd <generic_processes_dir> <epd_processes_dir> -p process_list.json -o <output_dir>
```

Example `process_list.json`:
```json
[
  "8a3b1c4d-5e6f-7g8h-9i0j-1k2l3m4n5o6p",
  "2d4e6f8a-9b1c-2d3e-4f5g-6h7i8j9k0l1m"
]
```
The `<generic_processes_dir>` folder should be structured like this:


```
<generic_process_dir>
├── flows
│   ├── <flow-uuid-1>.xml   # Reference flow of generic-uuid-1
│   ├── <flow-uuid-2>.xml
│   └── ...
├── matches
│   ├── <generic-uuid-1>.json   # Source EPDs for generic-uuid-1
│   ├── <generic-uuid-2>.json
│   └── ...
├── PDFs
├── processes
│   ├── <generic-uuid-1>.xml   # Skeleton process for generic-uuid-1
│   ├── <generic-uuid-2>.xml
│   └── ...
└── templates
    ├── GenPro_template.xml # Template with the EPD schema
    └── GenRef_template.xml # Template with the flow schema

```

#### Source EPDs (`<epd_processes_dir>`)

```
<epd_process_dir>
├── flows       # Reference flows for all source EPDs
└── processes   # All potential source EPD process XMLs
```

### Matches JSON

Files in `matches/` are named after the corresponding generic product UUID:

```json
{
  "type": "<aggregation_type>",
  "uuids": [
    "<uuid-1>",
    "<uuid-2>",
    "<uuid-3>",
    "... more UUIDs ..."
  ]
}
```

`type` is `"average"`, `"market-average"`, `"assembled"` or `"regression"`. The `uuids` list links to process files in the source EPD `processes/` folder.

---

## Development / running tests

See [DEVELOP.md](DEVELOP.md) for local setup, versioning, and PyPI release instructions.

For local development, install the package in editable mode with developer dependencies:

```console
python -m pip install -e ".[dev]"
```

Then run tests:

```console
pytest
```
