Skip to content

Name every product of a SimaPro export after its maker - #936

Closed
ccomb wants to merge 1 commit into
mainfrom
simapro-ecoinvent-names
Closed

ccomb wants to merge 1 commit into
mainfrom
simapro-ecoinvent-names

Conversation

@ccomb

@ccomb ccomb commented Dec 2, 2026

Copy link
Copy Markdown
Owner

Summary

A SimaPro export now writes every product the way SimaPro's exports of ecoinvent do, on the maker's product row and on every row buying from it:

 Products
-Wheat grain;kg;1;100;not defined;...
+Wheat grain {FR}| wheat production | U;kg;1;100;not defined;...
 Materials/fuels
-Wheat grain;kg;2;Undefined;0;0;0;
+Wheat grain {FR}| wheat production | U;kg;2;Undefined;0;0;0;

Before, only a product several activities of the file made, or one bought from another database, carried its place and activity, ending in a bare bar.

row name = designation product (suppliedBy stated maker)
  maker in the file      -> its place, its name, U or S from its Type line
  maker in a dependency  -> its place, its name, U
  no maker               -> what the row states (place, claimed supplier), else the name alone
designation keeps the name alone when
  the maker states no place,
  the name already states one,
  or the parser would not read the written place back (a name holding braces of its own)
  • A row the database left without a supplier keeps the product's name. It no longer meets the maker's row, so it comes back without a supplier, as in the database; the export lists it. Before, a re-import linked it to the maker by name.
  • A supplier in a dependency that would be written as one of the file's own product rows is refused: SimaPro would buy it from the file.
  • Blocks of one name at one place now follow their product's name, so a second export writes the same bytes.
  • The reader is unchanged. It keeps a name holding {FR} whole, and the writer leaves a name that already states a place as it is, so names settle after one round trip.

Evidence

  • ./build.sh --test --werror: 5399 examples, 0 failures. fourmolu and hlint clean.
  • New tests in SimaProWriterSpec: load, write, load, write gives the same bytes, with Butter still bought from Cow milk supply; a maker without place keeps the name alone; a System process ends in S; a name with braces of its own is left alone; an unlinked input comes back unlinked, with its note; a dependency supplier colliding with a product row is refused.
  • Not run: an export of a real database. The release harness needed its round-trip key widened for the trailing letter; that change is in the deployment repository.

Merge Danger

Door: two-way

Blast Radius: SimaPro exports

A SimaPro export read back gives its products new names, and so new identifiers, where the source named them without a place. Linking another database to a re-imported export by the bare product name stops matching; indexing a designated product under its bare name is left to a separate change.

Each product row, and each row buying a product or sending a waste to a
treatment, is written as SimaPro's exports of ecoinvent write it:
"Wheat grain {FR}| wheat production | U". The letter is S for a process
whose Type line says System. One function names the maker on both sides,
so a row and its maker's product row stay one string and link.

A row the database left without a supplier keeps the product's name, so it
comes back without one; the export says so. A maker stating no place, or a
name the parser would not read the place back from, keeps the name alone.
A supplier in a dependency that the file's own product row would name is
refused, as SimaPro would buy it from the file.
@ccomb

ccomb commented Dec 2, 2026

Copy link
Copy Markdown
Owner Author

Replaced by #937, on a branch named after the format.

@ccomb ccomb closed this Dec 2, 2026
@ccomb
ccomb deleted the simapro-ecoinvent-names branch December 2, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant