Feature: metadata helpers for pipeline integration (tested for egon-data) - #152
Merged
Conversation
…reignKeys stub v1.5/v1.6 OEMetadata stores `primaryKey` as a comma-separated string (e.g. "id, scn_name"). The v1.6->v2 populator iterated it with enumerate(), splitting the string character by character into ['i','d',',',' ',...] and emitting an invalid primaryKey. It also leaked the v2 template placeholder into `foreignKeys` when the source declared none. - primaryKey: coerce a string to a list (split on commas, strip); map the "none" sentinel and empty values to []; pass lists through unchanged. - foreignKeys: emit [] when the source has none; fix the always-true isinstance(fk, object) guard to isinstance(fk, dict). - add 8 regression tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Generic, project-agnostic capabilities supporting external metadata stores (e.g. eGon-data) with the OMI-first split: - sources.py: build external / internal-cross-reference source entries and append them to a resource's `sources` list non-destructively (deduped). - coverage.py: compare a caller-supplied expected resource-name list against a split-YAML store -> missing / skeleton / complete / orphan. - init.py: update_resource_from_db_skeleton / update_resource_yaml_from_db -- reusable non-destructive merge of a DB-inspection skeleton into a resource. - cli.py: `omi add-source` and `omi coverage` commands. - tests for all three. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary of the discussion
We integrated the new functionality from omi into https://github.com/openego/eGon-data .
A Data pipeline for energy grid modelling. There are alot of datasets included (>180 tables grouped into n datasets) and there are more to come in future versions.
OMI replaces the full current metadata system which was alrady using oemetadata so conversion to a latest version and then extending OMI with functionality to also handle new table resources not only form CSV but also from a DB was added. Addtionally we added verification/validation functionality to make sure metadata and data source are in sync to also be able to provide things like CI/CD integration using Worflows.
Type of change (CHANGELOG.md)
Added
Updated
Removed
Workflow checklist
Automation
Closes #
PR-Assignee
Reviewer