Embodied and end-of-life estimator service.
Project description
JUG LCA Buildings
jug_lca_buildings is a Sabu microservice that estimates building-level life-cycle carbon emissions from GeoJSON building data.
At a high level, the service accepts a GeoJSON FeatureCollection of buildings, runs a building life-cycle assessment workflow, and returns emissions results for the embodied and end-of-life stages. It can return either JSON results for API-to-API use or a CSV report for download and review.
All emission values returned by this service are expressed as kgCO2e per building unless stated otherwise.
This service is part of the broader Sabu project, where each "jug" is a focused microservice for a specific urban carbon or geospatial workflow. In that architecture, jug_lca_buildings covers the building LCA calculation step.
What The Service Does
- Accepts building data through
POST /emissionsas JSON orPOST /emissions/uploadas a GeoJSON file upload. - Validates the request structure before running the workflow.
- Calculates embodied and end-of-life emissions for each building.
- Can export results as JSON or as a CSV report with per-building rows and totals.
- Stores generated artifacts under
.runtime/jug_lca_buildingsunlessJUG_LCA_ARTIFACTS_DIRis set.
Units
opening_embodied_emissions,envelope_embodied_emissions, andcomponent_embodied_emissionsare reported inkgCO2e.opening_end_of_life_emissions,envelope_end_of_life_emissions, andcomponent_end_of_life_emissionsare reported inkgCO2e.- CSV totals such as
total_embodied_emissions,total_end_of_life_emissions, andtotal_lca_emissionsare also reported inkgCO2e. - These values are absolute totals for each building, not per-square-metre intensities and not tonnes.
Inputs Needed For Testing
For a basic test request, you need a GeoJSON FeatureCollection where each feature represents one building and includes:
typeidgeometryproperties.nameproperties.addressproperties.functionproperties.heightproperties.year_of_construction
The service also depends on bundled reference data used by the workflow:
src/jug_lca_buildings/data/nrcan_archetypes.jsonsrc/jug_lca_buildings/data/nrcan_constructions_cap_3.jsonsrc/jug_lca_buildings/data/nrcan_materials_dictionaries.jsonsrc/jug_lca_buildings/data/nrcan_transparent_surfaces_dictionaries.json
Example Test Data
Contract examples already exist in the repository and are the safest starting point for manual or integration testing:
contracts/examples/jug_lca_buildings/README.mdcontracts/openapi/jug_lca_buildings.yaml- External examples repository: https://github.com/demianAdli/sabu-test-data-and-examples/tree/main/services/jug_lca_buildings
The contract examples include:
- an example JSON body for
POST /emissions - an example JSON success response
- an example CSV export response
- example error payloads for invalid upload and validation failures
The test suite also shows the minimum valid request shape used in automated tests:
That minimum test payload is a single polygon building with basic metadata such as name, address, function, height, and year of construction.
Running A Simple Test
Once the service is running locally, you can test it by:
- Sending a JSON GeoJSON payload to
POST /emissions. - Sending the same payload with
?export=csvto download a CSV report. - Uploading a
.geojsonfile toPOST /emissions/upload.
External Test Data Reference
Additional example inputs and supporting test data are also available in the external repository:
https://github.com/demianAdli/sabu-test-data-and-examples/tree/main/services/jug_lca_buildings
Use that repository together with the local contract artifacts in this project when preparing manual tests or integration examples.
Usage Examples
Instructions on how to run jug_lca_buildings in different settings can be found in these example directories:
- API usage: https://github.com/demianAdli/sabu-test-data-and-examples/tree/main/services/jug_lca_buildings/examples/api
- Direct Python run: https://github.com/demianAdli/sabu-test-data-and-examples/tree/main/services/jug_lca_buildings/examples/direct-python
- Docker Compose run: https://github.com/demianAdli/sabu-test-data-and-examples/tree/main/services/jug_lca_buildings/examples/docker
Docker Image
The container image is intended to run the published PyPI package, not the local checkout.
- Runtime port inside the container:
5000 - Recommended host mapping:
-p 8080:5000or any other host port you prefer - Image tag should match the package version, for example
0.1.1 - Do not publish
latest; only publish versioned tags - Build args
JUG_LCA_BUILDINGS_VERSIONandSABU_CHASSIS_VERSIONare optional and default tolatest - If a package version build arg is omitted or set to
latest, Docker installs the latest available release from PyPI - If a package version build arg is provided, Docker pins that package to the exact version
Example build and run commands using the latest PyPI releases:
docker build \
--no-cache \
-f services/jug_lca_buildings/docker/Dockerfile \
-t demianadli/jug_lca_buildings:0.1.1 \
.
docker run --rm \
-p 8080:5000 \
-e JUG_LCA_ARTIFACTS_DIR=/app/data/jug_lca_buildings \
demianadli/jug_lca_buildings:0.1.1
Example pinned build:
docker build \
-f services/jug_lca_buildings/docker/Dockerfile \
--build-arg JUG_LCA_BUILDINGS_VERSION=0.1.1 \
--build-arg SABU_CHASSIS_VERSION=0.1.0 \
-t demianadli/jug_lca_buildings:0.1.1 \
.
Compose example:
docker compose -f services/jug_lca_buildings/docker-compose.yml build --no-cache
docker compose -f services/jug_lca_buildings/docker-compose.yml up -d
The compose file can build the image locally from the Dockerfile. By default it installs the latest available PyPI releases for jug_lca_buildings and sabu-chassis, so you can rebuild locally after publishing either package to PyPI without publishing a new Docker Hub image. Use --no-cache when you want Docker to check PyPI again instead of reusing the previous pip-install layer.
To pin versions in Compose, set environment variables before building:
JUG_LCA_BUILDINGS_VERSION=0.1.1 SABU_CHASSIS_VERSION=0.1.0 \
docker compose -f services/jug_lca_buildings/docker-compose.yml up -d --build
Versioned Publishing
The GitHub Actions workflow publishes the image from a version tag only.
- Tag format:
jug_lca_buildings-v0.1.1 - Docker Hub image tag:
0.1.1 - Workflow file:
.github/workflows/publish-jug-lca-buildings-docker.yml
Release flow:
- Publish
jug_lca_buildings==0.1.1to PyPI. - Create and push the git tag
jug_lca_buildings-v0.1.1. - GitHub Actions builds the Docker image with
JUG_LCA_BUILDINGS_VERSION=0.1.1. - The image is pushed to Docker Hub as
demianadli/jug_lca_buildings:0.1.1.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file jug_lca_buildings-0.1.1.tar.gz.
File metadata
- Download URL: jug_lca_buildings-0.1.1.tar.gz
- Upload date:
- Size: 89.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e9d33e8a8d34c4cb5f96c8c3f5ef326dc8cbbc87a881d70d1e8909522c0d6636
|
|
| MD5 |
5e11f365747a5f5295adc95b561e4161
|
|
| BLAKE2b-256 |
18e5ab07caf20d047f78a76b403aa3dcbb48dc7e78519c9ae4cf50593859de0a
|
File details
Details for the file jug_lca_buildings-0.1.1-py3-none-any.whl.
File metadata
- Download URL: jug_lca_buildings-0.1.1-py3-none-any.whl
- Upload date:
- Size: 94.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
667b173acc1a1e5840cc630d16e979d5ea9c0fd01c3364c84f126bafda2c103a
|
|
| MD5 |
f6a64866eb81d3b939fecc890b644b2a
|
|
| BLAKE2b-256 |
874eb8e79dc1eb563965250f135997872cd36d701fd5b5660a3aa08bc3b7243d
|