Skip to content

Cache PMID:20301328 and keep the NICE guideline exempt after a re-fetch - #18833

Merged
ai4c-agent[bot] merged 1 commit into
mainfrom
fix-cache-followups
Nov 24, 2026
Merged

ai4c-agent[bot] merged 1 commit into
mainfrom
fix-cache-followups

Conversation

@cmungall

@cmungall cmungall commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

This fixes two reference-cache problems that came out of #18374.

PMID:20301328 had no cache file. Lesch-Nyhan_Syndrome cites it six times (GeneReviews, HPRT1 Disorders), but its references_cache/ file was never committed. Every validation run on a fresh checkout fetched it over the network, and offline runs could not verify those snippets. I fetched it with just fetch-reference. All 141 of the entry's snippets now verify against the local cache.

PMID:31909928 would fail the cache check after a re-fetch. It is a NICE guideline with a corporate author, so its cache carries neither authors: nor journal:. check-reference-cache-frontmatter treats that as the #1737 fabrication fingerprint unless the body shows it is a monograph, and this record passed on its National Institute for Health and Care Excellence: Guidelines. line (#6607). The current fetcher writes only the title and abstract, so that line is gone. I re-fetched with --force and confirmed the new file has no publisher line, no collection line, no authors and no journal, which leaves no body pattern to match.

The fix is a short vetted list in src/dismech/reference_cache_frontmatter.py. A record on it passes whatever its body format, and an entry is added only after checking PubMed by hand. It starts with PMID:31909928. The committed cache file is unchanged, still in the older format.

Not changed

  • The fetcher. The longer-term fix would be for linkml-reference-validator to write a book's publisher or collection title into the frontmatter, so the check could recognise these records from the data. That needs an upstream change and a release, so I left it out.
  • The two existing body patterns stay, since older-format caches still rely on them.

Validation

  • Two new tests in tests/test_reference_cache_frontmatter.py. The vetted record passes in the current fetcher format. An unvetted record in the same format still fails with the fabrication-fingerprint reason.
  • tests/test_reference_cache_frontmatter.py and tests/test_empty_reference_caches.py pass (37 tests).
  • just check-reference-cache-frontmatter and just lint-python pass.
  • just count-verified-snippets kb/disorders/Lesch-Nyhan_Syndrome.yaml: 141/141.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UDqeWsdcTfKeW7LriK6a9f

Lesch-Nyhan_Syndrome cites PMID:20301328 (GeneReviews, HPRT1 Disorders)
three times, but its cache file was never committed, so a fresh checkout
fetched it over the network on every validation run.

PMID:31909928 is a NICE guideline with no personal authors. The cache
check exempts it on the 'National Institute for Health and Care
Excellence: Guidelines.' line in its body, but the current fetcher no
longer writes that line, so a forced re-fetch would fail the check with
no body marker left to match. Add a short vetted list of corporate-author
monographs, checked by hand, that pass regardless of body format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UDqeWsdcTfKeW7LriK6a9f
@ai4c-reviewer

ai4c-reviewer Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Claude finished @cmungall's task in 5m 37s —— View job


PR review: approved ✅

I approved this PR. Both fixes work, and the checks I re-ran pass.

  • Schema validation would pass (no KB YAML changed)
  • All PMIDs verified as real (PMID:20301328 is the GeneReviews HPRT1 Disorders chapter, and its cache file came from the fetcher)
  • Evidence snippets are exact quotes: all 141 snippets in Lesch-Nyhan_Syndrome verify against the local cache
  • Ontology terms correct and specific (none touched)
  • evidence_source classifications correct (none touched)
  • No pathophysiology bundling (no curation content)

Vetted list. The list in src/dismech/reference_cache_frontmatter.py matches on the exact reference_id and only sets is_monograph. A listed record is still checked against the rest of the cache contract; only the missing-authors-and-journal check is waived. The two new tests cover the case that matters: a listed ID in the current fetcher format passes, and an unlisted ID in the same format still fails.

What I ran:

  • tests/test_reference_cache_frontmatter.py: 21 passed
  • just check-reference-cache-frontmatter: passed. It also printed notes about a literal --- inside a value in 5 cache files; those files are already on main.
  • just count-verified-snippets kb/disorders/Lesch-Nyhan_Syndrome.yaml: 141 of 141 verified

🔵 Suggestions, none blocking:

  • The PR description says the entry cites PMID:20301328 three times. It cites it six times (lines 45, 143, 149, 1291, 1430 and 1503). This changes nothing in the fix.
  • The authors: list in the new cache file starts with the five GeneReviews series editors, followed by the chapter author, Jinnah HA. The fetcher writes every Bookshelf chapter this way, so there is nothing to fix in this PR, but the list is not the chapter's authorship.

@ai4c-reviewer ai4c-reviewer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Schema validation would pass (no KB YAML changed)
  • All PMIDs verified as real (PMID:20301328 is the GeneReviews HPRT1 Disorders chapter; the cache came from the fetcher, not written by hand)
  • Evidence snippets are exact quotes: count-verified-snippets on Lesch-Nyhan_Syndrome gives 141/141 against the local cache
  • Ontology terms correct and specific (none touched)
  • evidence_source classifications correct (none touched)
  • No pathophysiology bundling (no curation content)

Approve. Both fixes do what the description says, and I re-ran the checks.

Cache file. references_cache/PMID_20301328.md has the fetcher's normal GeneReviews layout. The title matches the reference_title: HPRT1 Disorders. used in every citation in the entry, and the body is the chapter abstract the snippets quote.

Vetted-monograph list. src/dismech/reference_cache_frontmatter.py:74 is keyed on the exact reference_id, and it only sets is_monograph. That means a vetted record is still checked against every other part of the contract; only the authors/journal fingerprint is waived. The two new tests cover the important pair: the vetted ID passes in the title-plus-abstract format, and an unvetted ID in the same format still fails with the fabrication-fingerprint reason. The comment explains why the list exists and what to check before adding an entry.

What I ran:

  • uv run pytest tests/test_reference_cache_frontmatter.py: 21 passed
  • just check-reference-cache-frontmatter: OK. The 5 ----in-value notes it prints are already on main.
  • just count-verified-snippets kb/disorders/Lesch-Nyhan_Syndrome.yaml: 141/141

🔵 Suggestions, none blocking:

  • The PR body says the entry cites PMID:20301328 three times. It actually cites it six times (lines 45, 143, 149, 1291, 1430, 1503). The fix is the same either way; only the count is off.
  • The cached authors: list starts with the GeneReviews series editors (Adam MP, Bick S, Mirzaa GM, Wallace SE, Amemiya A) before the chapter author, Jinnah HA. That is how the fetcher handles every Bookshelf chapter, so it is not something to fix here. Just don't read that list as the chapter's authorship.

@ai4c-agent
ai4c-agent Bot added this pull request to the merge queue Nov 24, 2026
@ai4c-agent

ai4c-agent Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

🐑 PR Shepherd (deterministic sweep) — Added to the merge queue: approved, no human assignee, no conflicts, all checks green, and open longer than 0 days. GitHub will test this PR against current main and merge it if that passes; if it does not, this PR stops being eligible and needs a look.

Merged via the queue into main with commit cf6a26d Nov 24, 2026
10 checks 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.

2 participants