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

LCA as Code

A domain-specific language for life-cycle analysis experts.
https://github.com/kleis-technology/lcaac

Category: Industrial Ecology
Sub Category: Life Cycle Assessment

Keywords

domain-specific-language environmental-impact-assessment lifecycle-analysis sustainability

Keywords from Contributors

transforms archiving routes conversion observation measur profiles animals compose names

Last synced: about 4 hours ago
JSON representation

Repository metadata

LCA as Code - Domain-Specific Language for Life-Cycle Analysis

README.md

LCA as Code

Repository Status
Tests

This is the official repository of LCA as Code language.

What is LCA as Code?

LCA as Code is a domain-specific language (DSL) for life-cycle analysis experts.
Its declarative approach allows to define parametrized and reusable LCA models.
See our book to learn more about the language.

LCA as Code

Table of Contents

  1. Getting started
  2. What's inside
  3. Documentation
  4. Related projects
  5. License
  6. About us

Getting started

Install

From the source

git checkout v1.7.10
./gradlew :cli:installDist
alias lcaac=$GIT_ROOT/cli/build/install/lcaac/bin/lcaac
lcaac version

From Homebrew

brew tap kleis-technology/lcaac
brew install lcaac-cli
lcaac version

Impact assessment

Check the sample file in $GIT_ROOT/cli/samples/main.lca.

process electricity_mix {
    params {
        from_fossil = 40 percent
        from_nuclear = 20 percent
        from_hydro = 40 percent
    }
    products {
        1 kWh electricity
    }
    inputs {
        from_fossil * 1 kWh electricity from fossil
        from_nuclear * 1 kWh electricity from nuclear
        from_hydro * 1 kWh electricity from hydro
    }
}
// rest of the file omitted

Now you can assess the process electricity_mix.

cd $GIT_ROOT/cli/samples
lcaac assess "electricity_mix"

The result is printed on the standard output in CSV format.

product,amount,reference unit,co2,co2_unit
electricity,1.0,kWh,5.4,kg

You can also run multiple assessments with an external data csv file providing values for the process parameters.

lcaac assess "electricity_mix" --file params.csv

Tests

The language allows to define tests as well. See the file $GIT_ROOT/cli/samples/test.lca.

test should_pass {
    given {
        1 kWh electricity from electricity_mix
    }
    assert {
        co2 between 0 kg and 10 kg
    }
}
// rest of the file omitted

Run the tests using

lcaac test --show-success

What's inside

This repository contains the core libraries to handle LCAAC code.

Package core

The package core contains:

  • the language's abstract syntax tree (AST)
  • the evaluator
  • analysis programs, namely, contribution analysis, and local sensitivity analysis

Package grammar

The package grammar contains:

  • a concrete ANTLR-based grammar
  • utilities to parse and load LCAAC files.

Package cli

The package cli contains the code for the command-line interface.

Documentation

For users

For developers

  • Core concepts [coming soon]
  • Contribution guide [coming soon]

Related projects

Cloud Assess

Cloud Assess

Cloud Assess is an open-source tool
to automate the assessment of the environmental impacts of cloud services.
It aims at defining a trusted library of LCA models, written in the LCAAC language,
which can be easily consulted via a REST API.

LCA as Code IDE

LCA as Code IDE

An integrated-development environment (IDE) is available.
This editor provides facilities to develop and interact with LCAAC models. E.g.

  • Automatic unit consistency check with syntax highlighting.
  • Integrated analysis and visualization.
  • Support for collaboration and code review.

License

This work is dual licensed:

  • For commercial use: commercial license. Reach out to [email protected] for more information.
  • For non-commercial use: AGPL v3. See LICENSE-AGPL.txt.

About us

Kleis

We are Kleis Technology.
Software craftsmen, thirsty for knowledge, with experience in complex subjects, we solve challenges in a pragmatic manner.
Backed by our core values of trust, commitment and continuous improvement, we love to make and create.


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 1,144
Total Committers: 11
Avg Commits per committer: 104.0
Development Distribution Score (DDS): 0.326

Commits in past year: 110
Committers in past year: 1
Avg Commits per committer in past year: 110.0
Development Distribution Score (DDS) in past year: 0.0

Name Email Commits
Peva Blanchard p****d@k****h 771
Philippe Kernevez p****e@k****t 122
Joachim Desroches j****s@k****h 108
sebdebros s****s@k****h 57
Alban Seurat a****t@m****m 42
Joachim Desroches jo@t****t 34
florian-bellotti f****i@v****r 4
Peva Blanchard p****d@g****m 3
dependabot[bot] 4****] 1
Julien ruiz j****z@k****h 1
GitHub Action a****n@g****m 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 1
Total pull requests: 41
Average time to close issues: N/A
Average time to close pull requests: about 6 hours
Total issue authors: 1
Total pull request authors: 1
Average comments per issue: 0.0
Average comments per pull request: 0.0
Merged pull request: 38
Bot issues: 0
Bot pull requests: 0

Past year issues: 1
Past year pull requests: 17
Past year average time to close issues: N/A
Past year average time to close pull requests: about 10 hours
Past year issue authors: 1
Past year pull request authors: 1
Past year average comments per issue: 0.0
Past year average comments per pull request: 0.0
Past year merged pull request: 15
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/kleis-technology/lcaac

Top Issue Authors

  • pevab (1)

Top Pull Request Authors

  • pevab (41)

Top Issue Labels

Top Pull Request Labels


Dependencies

build.gradle.kts maven
core/build.gradle.kts maven
  • io.arrow-kt:arrow-core * implementation
  • io.arrow-kt:arrow-optics * implementation
  • org.apache.logging.log4j:log4j-api $log4jVersion implementation
  • org.apache.logging.log4j:log4j-core $log4jVersion implementation
  • org.apache.logging.log4j:log4j-slf4j-impl $log4jVersion implementation
  • org.ejml:ejml-simple 0.43 implementation
  • org.jetbrains.kotlin:kotlin-reflect * implementation
  • org.jetbrains.kotlinx:kotlinx-serialization-json $kotlinxSerializationJSONVersion implementation
  • org.jetbrains.kotlinx:multik-core 0.2.2 implementation
  • org.jetbrains.kotlinx:multik-default 0.2.2 implementation
  • io.mockk:mockk 1.13.4 testImplementation
grammar/build.gradle.kts maven
  • org.apache.logging.log4j:log4j-api $log4jVersion implementation
  • org.apache.logging.log4j:log4j-core $log4jVersion implementation
  • org.apache.logging.log4j:log4j-slf4j-impl $log4jVersion implementation
  • io.mockk:mockk 1.13.4 testImplementation

Score: 4.882801922586371