Expose compartment, location and unit on method factors - #216
Merged
Conversation
GET /method/{id}/factors returned only flow name, direction and value,
so a method's several CFs for one substance - emitted to air vs. water,
or one regionalized CF per location - listed as indistinguishable
duplicate rows. Each factor now carries its compartment path, consumer
location and CF unit; the bundled Python client model follows.
The fields added to GET /method/{id}/factors can be absent from the source
data, and two paths turned that absence into an empty string on the wire.
The SimaPro method parser built a compartment even when the compartment
column was empty — which also wrongly constrained flow matching — so it now
yields no compartment at all. And a factor whose source states no unit
(openLCA JSON-LD allows omitting it) rendered as unit "", so the field is
now nullable and empty units are dropped at the API boundary.
The Python client's field docs now say each axis is None when the source
method does not carry it.
Merged
ccomb
added a commit
that referenced
this pull request
Jul 15, 2026
## What Dates the changelog, bumps the version. Covers two gaps found while consolidating: `MethodFactor` gained `compartment`/`location`/`unit` (#216) and `aggregate` gained the `consumption` scope (#224) — both touched the pyvolca client without a changelog entry. ## Verification Full suite (259 passed, 7 skipped — live-engine tests), pyright clean, README API reference regenerated and drift-checked. ## After merge Tag `pyvolca-v0.8.2` on the squashed commit — PyPI trusted publishing fires on that tag.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
GET /method/{id}/factorsreturned only the flow name, direction and CF value. A characterization method routinely holds several factors for one substance name — the same substance emitted to air vs. water vs. soil, a long-term variant, or one regionalized factor per location — so consumers listing a method's factors saw rows that looked like exact duplicates, with no field to tell them apart.Final state
Each factor now carries the axes that distinguish it:
compartment— the compartment path with every non-empty axis kept ("air/urban air","water/unspecified/long-term"),nullwhen the source method has none;location— the consumer location for regionalized factors,nullfor universal ones;unit— the CF reference unit ("kg","kBq","m3").On the test method fixture, the three
Carbon dioxide, fossilfactors that previously rendered as duplicates now readair,air/indoorandsoil.The change is additive (no wire-version bump). The bundled Python client's
MethodFactormodel gains the same three optional fields and tolerates older engines that omit them; its generated API reference is regenerated.