Skip to content

feat: grant disease_context_qualifier to pinned EntityToDisease/PhenotypicFeature edge classes - #120

Merged
SkyeAv merged 1 commit into
mainfrom
feature/disease-context-qualifier-class-grant
Aug 25, 2026
Merged

feat: grant disease_context_qualifier to pinned EntityToDisease/PhenotypicFeature edge classes#120
SkyeAv merged 1 commit into
mainfrom
feature/disease-context-qualifier-class-grant

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Motivation

DAKP pins its contraindication/treats edges to EntityToDiseaseAssociation / EntityToPhenotypicFeatureAssociation via statement.category_override (#118), because only those classes declare FDA_regulatory_approvals. Biolink declares disease_context_qualifier only on the ChemicalEntityToDiseaseOrPhenotypicFeatureAssociation lineage — so one edge can natively carry one slot or the other, never both, and prune_to_class nulls the qualifier on the pinned rows (DAKP's graph.yaml documents the gap: "Revisit if Biolink widens either slot").

Change

New CLASS_FIELD_OVERRIDES table in biolink.py, following the DISABLED_EDGE_FIELDS / KNOWN_PENDING_EDGE_FIELDS policy-table precedent: disease_context_qualifier is granted to EntityToDiseaseAssociation and EntityToPhenotypicFeatureAssociation, deliberately ahead of the pinned model.

  • lib.prune_to_class: per-class acceptance now ORs the grant in, so granted rows keep the qualifier instead of nulling and rescuing it into the pruned column. The multivalued-wrap scan still keys on classes that declare the slot, so granted classes can't corrupt the wrap.
  • biolink._validation_record: granted fields the record's own class doesn't declare are stripped from the in-memory validation copy (mirroring the existing RetrievalSource.id alias shim), so the deliberate gap is not reported as extra_forbidden. Emitted files are unchanged.
  • Tripwire test: every granted field must still be absent from its class — a future biolink-model release that widens the slot fails the suite until the stale grant is removed.

Verification

  • New tests: prune_to_class keeps the qualifier on granted rows and still prunes it on ungranted classes; validate_record tolerates the grant on the granted class only; tripwire guards the grant against model releases.
  • Full suite: 1092 passed, 15 skipped. ruff check / ruff format --check clean.

…typicFeature edge classes

Biolink declares disease_context_qualifier only on the
ChemicalEntityToDiseaseOrPhenotypicFeatureAssociation lineage, while
FDA_regulatory_approvals lives only on the EntityToDisease /
EntityToPhenotypicFeature classes DAKP pins via category_override -- so a
contraindication edge could natively carry one slot or the other, never
both.

Add CLASS_FIELD_OVERRIDES (biolink.py): a class-scoped grant table in the
DISABLED_EDGE_FIELDS / KNOWN_PENDING_EDGE_FIELDS policy style. prune_to_class
keeps granted slots on rows resolved to a granted class instead of nulling
and rescuing them, and _validation_record strips granted fields from its
in-memory validation copy so the deliberate gap is not reported as
extra_forbidden. A tripwire test asserts every granted field stays absent
from its class, forcing removal of the stale grant when a biolink-model
release widens the slot.
@coderabbitai

coderabbitai Bot commented Aug 25, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 830fe3e4-1834-42af-89fc-6ffcf102484a


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@SkyeAv
SkyeAv merged commit 77f82ec into main Aug 25, 2026
5 checks passed
@SkyeAv
SkyeAv deleted the feature/disease-context-qualifier-class-grant branch August 25, 2026 17:45
SkyeAv added a commit that referenced this pull request Aug 25, 2026
Cut 15.1.0 and bump the package version in pyproject.toml, uv.lock, and
CITATION.cff.

Minor: one feature and one fix since 15.0.0, no breaking changes. A
class-scoped policy override (CLASS_FIELD_OVERRIDES) grants
disease_context_qualifier to the EntityToDisease /
EntityToPhenotypicFeature edge classes DAKP pins via category_override,
so prune_to_class keeps the qualifier instead of nulling and rescuing
it, with a tripwire test that fails the suite once an upstream Biolink
widening makes the grant stale (#120). Also fixes number_of_cases being
matched by STUDY_SIZE_PREFIX_PATTERN and coerced into study_size,
destroying the edge field; a new STUDY_SIZE_EXEMPT_PATTERN leaves the
exact Biolink slot alone (#119).

Changelog:
- Versioned the Unreleased section as 15.1.0, gave the #120 entry its
  PR link, and added a Fixed entry for the number_of_cases coercion fix.

Docs: none needed here. #120 shipped with no docs changes and #119 is a
coercion fix with no user-facing surface.

Testing:
- uv run pytest -q -> 1092 passed, 15 skipped (94% coverage)
- uv run ruff check . && uv run ruff format --check . && uv run pyright -> clean / 0 errors
- uv lock --check -> up to date
- uv run mkdocs build --strict -> clean
SkyeAv added a commit to glusman-team/dakp that referenced this pull request Aug 25, 2026
…, move FAERS count to number_of_cases

- Bump tablassert[qc] floor to >=15.1.0.
- Un-TODO the contraindication disease_context_qualifier: 15.1's
  CLASS_FIELD_OVERRIDES (SkyeAv/Tablassert#120) grants the slot to the
  pinned EntityToDisease/EntityToPhenotypicFeature classes, so the
  nullable Disease-guarded qualifier survives prune_to_class on the edge.
- Migrate the FAERS case count annotation from the evidence_count alias to
  the literal Biolink slot number_of_cases: 15.1's STUDY_SIZE_EXEMPT_PATTERN
  (SkyeAv/Tablassert#119) stops the study-size classifier from renaming the
  column onto Study.study_size; the kgx_end_to_end tripwire fired as designed.
  legacy_tsv N_cases reads number_of_cases accordingly.
- Regenerate tables/*.yaml from the generator; update RIG target
  consideration to note the grant pending upstream Biolink widening.
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