Skip to content

fix: leave number_of_cases alone instead of coercing it to study_size - #119

Merged
SkyeAv merged 1 commit into
mainfrom
bugfix/number-of-cases-not-study-size
Aug 25, 2026
Merged

fix: leave number_of_cases alone instead of coercing it to study_size#119
SkyeAv merged 1 commit into
mainfrom
bugfix/number-of-cases-not-study-size

Conversation

@SkyeAv

@SkyeAv SkyeAv commented Aug 25, 2026

Copy link
Copy Markdown
Owner

Bugfix

number_of_cases is a legitimate Biolink Association slot (declared on EntityToDiseaseAssociation / EntityToPhenotypicFeatureAssociation) that counts cases carrying the phenotype/disease — it is not the study population size.

However, STUDY_SIZE_PREFIX_PATTERN in src/tablassert/coerce.py matched it via the "number of cases" quantity+unit form, so coerce_study_size_columns renamed the column to study_size during the clean phase, silently destroying the edge field.

Fix

  • Added STUDY_SIZE_EXEMPT_PATTERN (src/tablassert/coerce.py): a whole-name, separator-tolerant match on the exact number_of_cases slot.
  • study_size_target now returns None for it before any study-size pattern runs, so the column passes through untouched.

Tests

  • New regression test test_study_size_target_leaves_number_of_cases_alone covering underscored/spaced/hyphenated/fused spellings and the full coerce_study_size_columns path.
  • Full tests/test_lib.py + tests/test_biolink.py: 284 passed.

number_of_cases is a legitimate Biolink Association slot (cases carrying
the phenotype/disease), but STUDY_SIZE_PREFIX_PATTERN matched it via
'number of cases' and coerce_study_size_columns renamed it to
study_size, destroying the edge field. Add STUDY_SIZE_EXEMPT_PATTERN so
study_size_target returns None for the exact 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: b0ceb2c8-ab02-495e-a346-d2d0966ffc7e


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 141aa0e into main Aug 25, 2026
5 checks passed
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