Skip to content

feat: carry DAKP prevention predicates ahead of pinned Biolink via PREDICATE_OVERRIDES - #193

Merged
SkyeAv merged 1 commit into
mainfrom
contraindicated_in_the_prevention_of
Sep 17, 2026
Merged

SkyeAv merged 1 commit into
mainfrom
contraindicated_in_the_prevention_of

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Adds a named predicate override (biolink.PREDICATE_OVERRIDES) so DAKP can author prevents, applied_to_prevent, and contraindicated_in_the_prevention_of today: three predicates the pinned biolink-model 4.4.4 (and upstream master) do not define, two of which DAKP's assertion pipeline already documents as deferred for exactly that reason.

Predicate Override

  • Vocabulary union: src/tablassert/biolink.py gains PREDICATE_OVERRIDES beside CATEGORY_OVERRIDES; _predicate_values() unions it into the model-derived related to slot hierarchy, so Predicates gains PREVENTS, APPLIED_TO_PREVENT, and CONTRAINDICATED_IN_THE_PREVENTION_OF. statement.predicate validates and emits the ordinary biolink: CURIE, and the TYPE_CHECKING stub is extended for the new members.
  • Drift tripwire: test_predicate_overrides_track_the_installed_model asserts every member is still absent from the installed slot hierarchy; the moment Biolink adopts one, the suite fails and the stale name is removed, restoring fully model-derived vocabulary (same philosophy as the CATEGORY_OVERRIDES / CLASS_FIELD_OVERRIDES tripwires).

Pending Validation Gap

  • Record-scoped exemption: validate_kgx's pending score (valid_excluding_pending) now forgives predicate: literal_error / predicate: enum failures only when the record's own predicate is an override member. Open-str classes (base Association, the EntityToDisease / EntityToPhenotypicFeature classes DAKP pins via category_override) accept the predicates natively and stay strictly valid; constrained vocabularies (e.g. ChemicalEntityToBiologicalProcessAssociation's exhaustive Literal, the GeneToDiseasePredicateEnum family) reject them and count as deliberate gaps, never malformed records. Strict valid is unchanged.
  • Scope guard: the exemption keys on PREDICATE_OVERRIDES membership plus the failing field, so a smuggled non-Biolink predicate under the identical error shape still fails both scores; covered by an explicit control edge.

Docs

  • CHANGELOG.md Unreleased entry; one-line note on the predicate row in docs/configuration/table.md.
  • No DAKP fixture/config changes; downstream opts in through the existing statement.predicate field.

Testing

  • uv run pytest tests/test_biolink.py tests/test_models.py tests/test_realworld_configs.py tests/test_agent_assembly.py tests/test_agent_derive.py tests/test_study.py -n 0 -q -> 254 passed, 17 skipped
  • uv run pytest tests/test_lib.py -n 0 -q -k 'predicate or edge_category or demot' -> 11 passed, 246 deselected
  • uv run ruff check + uv run ruff format --check on touched files -> clean
  • uv run pyright src/tablassert/biolink.py tests/test_biolink.py tests/test_models.py -> 0 errors, 0 warnings

Questions for the reviewer

  • Upstream issue. No biolink-model issue/PR exists yet for any of the three predicates. Acceptable to carry the local extension without one, or should filing one be a merge blocker?

…EDICATE_OVERRIDES

Adds a named predicate override (`biolink.PREDICATE_OVERRIDES`) so DAKP can
author `prevents`, `applied_to_prevent`, and `contraindicated_in_the_prevention_of`
today: three predicates the pinned biolink-model 4.4.4 (and upstream master) do
not define, two of which DAKP's assertion pipeline already documents as deferred
for exactly that reason.

- `PREDICATE_OVERRIDES` unions into the model-derived `related to` slot
  hierarchy, so `Predicates` gains the three members and `statement.predicate`
  validates and emits ordinary `biolink:` CURIEs.
- Drift tripwire asserts every member stays absent from installed slots; the
  moment Biolink adopts one, the suite fails and the stale name is removed.
- `validate_kgx`'s pending score forgives `predicate: literal_error` / enum
  failures only for override members on the failing record; strict `valid` is
  unchanged and unlisted predicates still fail both scores.
- Open-str classes (base `Association`, DAKP-pinned EntityToDisease /
  EntityToPhenotypicFeature) accept the predicates natively; constrained
  vocabularies (ChemicalEntityToBiologicalProcessAssociation Literal,
  GeneToDiseasePredicateEnum) count as deliberate pending gaps.
- CHANGELOG entry and one-line note in docs/configuration/table.md; no DAKP
  fixture/config changes.

Verified: 254 passed across test_biolink / test_models / test_realworld_configs /
test_agent_assembly / test_agent_derive / test_study; 11 lib predicate tests;
ruff clean; pyright 0 errors.
@coderabbitai

coderabbitai Bot commented Sep 17, 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: Advanced

Run ID: df6c6a96-5aab-46d6-ba29-008da054127a


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 changed the title contraindicated in the prevention of feat: carry DAKP prevention predicates ahead of pinned Biolink via PREDICATE_OVERRIDES Sep 17, 2026
@SkyeAv
SkyeAv merged commit f2a8ad6 into main Sep 17, 2026
5 checks passed
SkyeAv added a commit that referenced this pull request Sep 18, 2026
Cut 19.1.0 and bump package version in pyproject.toml, uv.lock, and
CITATION.cff.

Minor: add the `tablassert quick-map` fullmap term-inspection command
(#191) and carry the DAKP prevention predicate family ahead of the
pinned Biolink model via PREDICATE_OVERRIDES (#193). The README PyPI
downloads badge now serves from pepy instead of shields (#190, #192).

Changelog:
- Version the Unreleased section as 19.1.0, add the missing #191 entry
  under Added, add a Changed entry for #190/#192, and add the PR link
  to the existing #193 entry.

Docs: none needed here; #191 and #193 shipped their own docs.

Testing:
- make check -> pass: 1649 passed, 52 skipped; Rust tests 156 passed,
  1 ignored; lint, format, pyright, and clippy pass.
- uv lock --check -> pass.
- uv run mkdocs build --strict -> pass.
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