Skip to content

Add CI validation for the cross-reference mapping files - #63

Merged
KrishnaTO merged 2 commits into
mainfrom
claude/ci-workflows-mapping-files-c93916
Aug 16, 2026
Merged

Add CI validation for the cross-reference mapping files#63
KrishnaTO merged 2 commits into
mainfrom
claude/ci-workflows-mapping-files-c93916

Conversation

@KrishnaTO

Copy link
Copy Markdown
Owner

Adds .github/scripts/validate_mappings.py and two workflows. No data changes.

Why these checks

Every rule here comes from something that already reached main:

Seen in Problem
#49, #52 mesh:null, DOID:null — the editor wrote a missing id as a literal placeholder, caught by hand in review one row at a time
#57 ICD-9 codes filed under the icd10cm prefix, retired from the source list but not from the data
#51 MONDO:MONDO:0014523 — the prefix concatenated onto a value that already carried it
#60 140 ids curators had flagged wrong were still stored in the ontology and still served
throughout the two exports drifting when a row round-trips through a spreadsheet: 362.50362.5, 0111157111157

Catching these by eye does not scale across three curators submitting through the editor.

What it checks

  • Structure — header schema, column counts, stray tabs, mixed line endings, a byte-order mark, a prefix missing from the SSSOM curie_map.
  • Identifiers — placeholders, doubled prefixes, ids that do not fit their vocabulary's shape, ICD-9 under icd10cm.
  • Contradictions — the same pair recorded as both confirmed and flagged wrong, duplicate rows, one disease under two labels, future dates, unattributed edits.
  • Agreement between the two exports, row for row.
  • Agreement with the ontology — unknown disease id, stale label, an id flagged wrong that is still stored and still served, a confirmed id that was never stored.

Two workflows

Workflow Trigger Scope
Validate mappings PRs touching mappings/ or ontologies/ only rows the branch added or rewrote — fails the check, findings land as annotations on the changed line
Audit mappings Mondays 07:00 UTC, or on demand every row

The gate is diff-scoped deliberately. A curator submitting one disease should not be blocked by debt they did not introduce, and main should not go red on every merge. The weekly audit is where the standing backlog lives.

Standard library only, so CI needs no install step, and it runs locally unchanged:

python .github/scripts/validate_mappings.py

Current state of the backlog

Against main as it stands: 193 errors, 17 warnings, all pre-existing. #61 and #62 clear the two bulk groups mechanically, taking it to 25 errors, 17 warnings.

What remains after those needs a curator rather than a script — 18 literal null ids, the MONDO:MONDO:0014523 double prefix, two MONDO values stored with a prefix where the other 55 are bare, the ICD-10 range I00-I02, and one drift where the SSSOM export has DOID:0111157 against the equivalencies export's DOID:111157.

Test plan

  • Clean tree in diff-scoped mode reports zero, so pre-existing debt does not block a PR
  • A synthetic PR carrying mesh:null, an ICD-9 code, a rejected-but-still-stored SNOMED id, a nonexistent ARI id, a stale label, a future date, a malformed author handle, a stray tab, and a row present in only one file — all caught, exit 1
  • Both workflow files parse as YAML

Advances #23 ("Validate all diseases with database xrefs"); referenced rather than closed.

🤖 Generated with Claude Code

Every check here comes from a problem that already reached main: the
mesh:null and DOID:null ids caught by hand in review on #49 and #52, the
ICD-9 codes #57 retired from the source list but not from the data, the
MONDO:MONDO:0014523 double prefix, and the flagged-but-still-stored ids
#60 had to clear out. Catching them by eye does not scale across three
curators submitting through the editor.

validate_mappings.py checks ari.sssom.tsv and ari.equivalencies.tsv for
structural damage, malformed identifiers and internal contradictions,
that the two exports agree row for row, and that both agree with the
cross-references ari_t1d.owl actually serves. Standard library only, so
CI needs no install step and it runs locally unchanged.

Two workflows run it. The pull request gate reports only rows a branch
added or rewrote, so a curator submitting one disease is not blocked by
debt they did not introduce, and findings land as annotations on the
changed line. A weekly audit runs the same checks over every row so the
standing backlog stays visible without turning every merge red.

That backlog is currently 193 errors and 17 warnings, all pre-existing
and none corrected here, since each fix is a curation decision.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@KrishnaTO
KrishnaTO merged commit 08a97e2 into main Aug 16, 2026
1 check passed
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