Merging and Metadata improvements#390
Merged
EvanDietzMorris merged 14 commits intomasterfrom Apr 15, 2026
Merged
Conversation
option to overwrite existing edge ids, record mappings of pre and post merge edge ids when they change
EvanDietzMorris
added a commit
to NCATSTranslator/translator-ingests
that referenced
this pull request
Apr 15, 2026
- improved normalization and merging metadata - allow edge_id passthrough and write edge_id mapping metadata - implemented merging handling of all dictionary properties see these ORION prs for more detail: RobokopU24/ORION#390 RobokopU24/ORION#377
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.
Metadata and Merging Improvements
Normalization metadata by prefix
KGXFileNormalizer now computes and records per-curie-prefix normalization stats (succeeded, failed, total, success_rate, normalized_to), sorted by prevalence, under normalization_metadata. Logs warnings on prefixes below 50% success and logs errors on prefixes that fail outright.
Edge-id preservation and pre-merge mapping
New overwrite_edge_ids flag on GraphSpec (default True, preserves existing behavior). When add_edge_id=True and overwrite_edge_ids=False, unmerged edges keep their original ids, and merged edges get the generated merge key as their new id while the mapping from new id → original pre-merge ids is recorded. DiskGraphMerger streams this mapping to a file as merges finalize instead of buffering it in memory.
Dict-shaped biolink slot merging
entity_merging_function now merges dict-valued slots (e.g. has_supporting_study_result) instead of silently keeping entity_1's dict.
Truthy-prefer scalar collision policy
Scalar/scalar merges now prefer the truthy value: falsy values (None, 0, "", False) lose to any populated value on the other side. Only two genuinely different truthy values count as a collision. Also fixed a latent bug where a None in entity_2 could clobber an existing value in entity_1.
Merge warnings in merge_metadata
Collisions surface as metadata and logs: merge_metadata['merge_warnings'] contains mismatched_properties (a dict slot on one side, non-dict on the other) and dropped_properties (genuine collisions). Collected per merger, flushed at generator completion, unioned across node and edge mergers.