Repository navigation
feat(schema): structured source tag on processes (schema 0.2.0) - #4
Merged
Merged
Conversation
Rows were tagged with their upstream dataset only in free text (the ToU citation in `comment`), so a consumer could not select by source and sentier-brightway imported the whole inventory as "bafu-2026". This adds: - processes.parquet: `source` (required, datasource id, edition only, e.g. bafu-2026) and `source_version` (optional, e.g. v1), after process_type. Exchanges inherit through process_id. - metadata.json: required `sources` list; schema_version 0.2.0. - scripts/validate.py: `sources` must equal the distinct processes.source values, both directions, so consumers can select folders by metadata without opening parquet. - data/: all 11 sectors regenerated by sentier-importers (run_bafu_local.py at 732ba80) with source=bafu-2026, source_version=v1. Every pre-existing column and row is unchanged; exchanges.parquet files are byte-identical to main. - README, data/README.md: provenance rule and source-id convention.
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
Which upstream source supplied a row was recorded only as free text (the sector
descriptionand the citation sentence incomment). That is the BAFU ToU citation, not a machine-readable tag: a consumer could not select rows by source, and sentier-brightway concatenated every folder into a database namedbafu-2026. That is correct only while the inventory is 100 % BAFU.Sector-based storage stays (decision of 2026-08-07, no source-named folders or files). This adds per-row provenance so folders can mix sources and consumers can select by it.
What (schema 0.2.0)
processes.parquet:source(required, lower-kebab<publisher>-<edition>, e.g.bafu-2026) andsource_version(optional, e.g.v1), placed afterprocess_type. Exchanges inherit provenance throughprocess_id, soexchange.yamlonly gains a header note.metadata.json: requiredsourceslist (pattern-checked, unique, non-empty);schema_version0.2.0.scripts/validate.py: the distinctprocesses.sourcevalues must equalsources, both directions. This makesmetadata.jsona trustworthy index, so a consumer can pick folders without opening parquet.data/: all 11 sectors regenerated by sentier-importers (run_bafu_local.pyat sentier-importers732ba80) withsource = bafu-2026,source_version = v1. Every pre-existing column and row is unchanged; theexchanges.parquetfiles are byte-identical to main (same hashes in sentier-brightway's pin file).data/README.md: provenance rule rewritten, source-id convention documented.Verification
With a throwaway folder whose
sourcessaysother-1but whose parquet saysbafu-2026, the validator reports both directions:Compatibility
Breaking for a reader that rejects unknown columns or requires the 0.1.0 metadata shape. Known reader: sentier-brightway, pinned by commit and updated in its own
feat/source-columnbranch. Please merge without squash so the pinned commit2837e1bstays reachable; otherwise the brightway PR re-pins to the squash commit.Landing order
feat/source-column(emits the columns)feat/source-column