Skip to content

Feature: metadata helpers for pipeline integration (tested for egon-data) - #152

Merged
jh-RLI merged 2 commits into
devfrom
feature-egon-metadata-helpers
Jul 16, 2026
Merged

Feature: metadata helpers for pipeline integration (tested for egon-data) #152
jh-RLI merged 2 commits into
devfrom
feature-egon-metadata-helpers

Conversation

@jh-RLI

@jh-RLI jh-RLI commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

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

  • Add a new class (#)

Updated

  • Update a definition (#)

Removed

  • Remove a broken link (#)

Workflow checklist

Automation

Closes #

PR-Assignee

Reviewer

  • 🐙 Follow the Reviewer Guidelines
  • 🐙 Provided feedback and show sufficient appreciation for the work done

jh-RLI and others added 2 commits July 16, 2026 12:56
…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>
@jh-RLI
jh-RLI merged commit 3aaa7ff into dev Jul 16, 2026
2 checks passed
@jh-RLI
jh-RLI deleted the feature-egon-metadata-helpers branch July 16, 2026 13:13
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