Restrict label demotion to chemicals only#725
Draft
gaurav wants to merge 1 commit intoadd-pipeline-tests-for-shared-identifiersfrom
Draft
Restrict label demotion to chemicals only#725gaurav wants to merge 1 commit intoadd-pipeline-tests-for-shared-identifiersfrom
gaurav wants to merge 1 commit intoadd-pipeline-tests-for-shared-identifiersfrom
Conversation
The previous config had a single global `demote_labels_longer_than: 25` that applied to every Biolink type. This caused legitimate disease and phenotype labels like "postural orthostatic tachycardia syndrome" and "Failure to thrive" to be dropped in favour of shorter, less informative alternatives from UMLS. Change `demote_labels_longer_than` to a per-type dict (same pattern as `preferred_name_boost_prefixes`). Only `biolink:ChemicalEntity: 25` is set, so demotion now applies only to chemicals and their subtypes via ancestor traversal. Types with no entry are never demoted. Extract the inline label-selection block from `write_compendium()` into a standalone `_select_preferred_label()` helper and add unit tests in `tests/babel_utils/test_write_compendia.py` with regression cases from the linked issues. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
gaurav
added a commit
that referenced
this pull request
Apr 18, 2026
Drives write_compendium() against curated cliques and asserts on the JSONL output's preferred_name. Covers the regressions fixed in PR #725 (#711, #714, #723) and the chemical demotion path. Tests run offline by patching bmt.Toolkit to read pinned local Biolink Model files; a network freshness test fails loudly when the fixture and config.yaml's biolink_version drift apart. Co-Authored-By: Claude Opus 4.7 <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.
The previous config had a single global
demote_labels_longer_than: 25that applied to every Biolink type. This caused legitimate disease and phenotype labels like "postural orthostatic tachycardia syndrome" and "Failure to thrive" to be dropped in favour of shorter, less informative alternatives from UMLS.Change
demote_labels_longer_thanto a per-type dict (same pattern aspreferred_name_boost_prefixes). Onlybiolink:ChemicalEntity: 25is set, so demotion now applies only to chemicals and their subtypes via ancestor traversal. Types with no entry are never demoted.Extract the inline label-selection block from
write_compendium()into a standalone_select_preferred_label()helper and add unit tests intests/babel_utils/test_write_compendia.pywith regression cases from the linked issues.Fixes #597, fixes #711, fixes #714, fixes #723