Repository navigation
Description
When OpenAlex points a work at the wrong document, the fetcher downloads that document and caches it as the work's full text. Nothing checks that the text belongs to the cited paper. Snippet validation is a substring match against the cached body, so a quote taken from the unrelated document would validate.
Two cases from dismech
Both were found in dismech's committed cache (monarch-initiative/dismech#7843).
DOI:10.1186/s12890-024-03371-5, Evolution of treatment strategies for solid tumors with RET rearrangement in China… (BMC Pulmonary Medicine, 2024). Cached in July 2026 as:
content_type: full_text_pdf
full_text_provider: openalex
full_text_url: "https://purehost.bath.ac.uk/ws/files/61926548/2014_02_07_Apereo_Europe_2014.pdf"The body was conference slides: "Cope, J 2014, 'Training researchers with Sakai', Esup Day 17 & Apereo Europe 2014…". OpenAlex has since corrected the record. On 2026-12-04 it returns the BMC PDF, and a --force re-fetch with 0.8.0 cached the right article. The fetcher had no way to notice the earlier mistake, though, and OpenAlex will make others.
PMID:31922885, Diverse Injury Pathways Induce Alveolar Epithelial Cell CCL2/12, Which Promotes Lung Fibrosis (Am J Respir Cell Mol Biol, 2020). It was cached with full_text_provider: openalex and full_text_url: "https://inria.hal.science/inria-00075378", and the body was a French-language INRIA report on human–computer-interface ergonomics. dismech has since re-fetched it, and it is now abstract_only.
Why a whole-file check is not enough
The second case had the correct PubMed abstract above the wrong body. Every title word appeared in the file, so a title-overlap check over the whole cache entry passed. A check has to look at the fetched body on its own.
Suggested check
Before stamping a fetched document full_text_*, confirm that it is the cited work, using the document's own text and not the metadata or abstract the cache adds around it. Possible signals, cheapest first:
- The DOI appears in the body. Most publisher PDFs and HTML pages print it.
- Failing that, most of the normalized title appears in the first part of the body.
- Optionally, the body's language matches the abstract's. This would have caught the French case.
When the check fails, keep the abstract and record the decline (for example declined="identity_mismatch", beside the existing landing_page_only), rather than caching the document. That matches how landing pages are handled since #65.
Related: #65 (landing pages stamped as full text) dealt with the other failure in the same dismech report: the right paper, but no article text.
Generated by Claude Code
Activity
github-actions commentedon Dec 4, 2026
Summary
OpenAlex can point a DOI at the wrong document (stale or mis-merged
best_oa_location.pdf_url). The fetcher downloads that file and stamps itfull_text_*. Because snippet validation is a substring match against the cached body, a quote from the unrelated document would validate. dismech hit this twice (monarch-initiative/dismech#7843). The issue proposes an identity check on the fetched body alone, before thefull_text_*stamp is applied. If the check fails, keep the abstract and recorddeclined="identity_mismatch".Where this lands in the code (read from
main)etl/fulltext/openalex.pylocate()returns aFullTextLocationwith the PDF URL and no identity check. The only decline there islanding_page_only(Landing-page fallback is stampedfull_text_html: a cache entry can claim full text while holding only the abstract #65).etl/reference_fetcher.py_apply_full_text_location(~L1277) is the one place every provider's location is accepted. It already has two gates: theMIN_FULL_TEXT_CHARSfloor and the "html text == abstract" check. It then writescontent.content = abstract + textand stampscontent_type. This is the natural spot for an identity gate, because it covers Unpaywall and custom providers as well as OpenAlex. The issue title only mentions OpenAlex, but the failure applies to any provider that follows a third-party URL.FullTextLocation.declined,content.full_text_declinedand the loop near L1146–1216. A decline raised from the apply step needs to feeddeclined_on_policy, so the chain tries the next provider before giving up. Today_apply_full_text_locationreturns only(applied, transient_error), so it would need a third return value or a small result object.textin_materializeis the body before the abstract is prepended, so the check can run ontextalone. That is the "body on its own" requirement from the issue, and it is what the second case needed (right abstract above, wrong body below).Design notes and suggestions
body_matches_reference(text, doi, title, abstract) -> Optional[str]returning a reason orNone). It is deterministic and easy to doctest, which fits the repo's TDD and doctest rules. The cases above become regression tests with no mocks, using the two bodies quoted in the issue as fixtures.https://doi.org/anddoi:. PDF extraction can break DOIs across lines or spaces, so remove whitespace in the first N and last N KB before matching. Match on the suffix as well as the full DOI, since some PDFs print only10.1186/s12890-....identity_check: doi|title), so false declines can be audited.html_full_text_versionandxml_extraction_version, so stale entries are re-validated on read, or avalidate/lintpass over an existing cache that applies the same function to## Contentbodies and reports mismatches. The second gives dismech a way to audit its 54k-entry cache without hitting the network. The issue doesn't mention this, and it is where the fix would be most useful to existing users.Related
full_text_html: a cache entry can claim full text while holding only the abstract #65 (closed): landing pages stamped as full text. Same dismech report, different failure. This issue reuses its decline mechanism.unavailablewhen the abstract exists outside Crossref and DataCite #194 (open): DOIs that come backunavailable. Its proposed PubMed/PMC-twin and OpenAlex-abstract fallbacks would make more entriesabstract_onlyafter a decline here, so the two interact well.identity_mismatchauditable (provider, URL, reason).I could not check the dismech issue (monarch-initiative/dismech#7843) from here, so the two cases above come from this issue's text.
If someone wants an implementation:
@dragon-ai-agent please implement an identity check (DOI in body, else title-token overlap in the head of the body) in_apply_full_text_locationinetl/reference_fetcher.py, declining withfull_text_declined="identity_mismatch"so the provider chain continues. Write doctests and tests first using bodies like the two dismech cases (conference slides and a French INRIA report), and add a cache-audit command that applies the same function to existing cache entries.