Skip to content

Merging and Metadata improvements#390

Merged
EvanDietzMorris merged 14 commits intomasterfrom
metadata-improvements
Apr 15, 2026
Merged

Merging and Metadata improvements#390
EvanDietzMorris merged 14 commits intomasterfrom
metadata-improvements

Conversation

@EvanDietzMorris
Copy link
Copy Markdown
Contributor

@EvanDietzMorris EvanDietzMorris commented Apr 15, 2026

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.

@github-actions github-actions bot added the Biological Context QC Require validation of biological context to ensure accuracy and consistency label Apr 15, 2026
@EvanDietzMorris EvanDietzMorris merged commit f91d73e into master Apr 15, 2026
3 checks passed
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Biological Context QC Require validation of biological context to ensure accuracy and consistency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant