Conversation
Collapse mixed text/MathJax scrape duplicates in arXiv titles and other metadata at seed time and on startup backfill, without rewriting unrelated prose. Adds regression tests for the issue aiming-lab#16 fixtures. Co-authored-by: Lxr-max <Lxr-max@users.noreply.github.com>
6 tasks
This was referenced Sep 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Some arXiv mirror titles were scraped with mixed text/MathJax extraction, so the same math fragment was stored twice (
\gtrsim 100\times\gtrsim 100\times,z=1.37z=1.37,\mathbb{P}^1\mathbb{P}^1, and similar).This change adds a conservative cleanup helper that only collapses clear adjacent duplicates. It does not rewrite unrelated titles, does not convert TeX to Unicode, and does not touch display templates.
sites/arxiv/metadata_cleaning.pyshared by seed-time import and startup backfillseed_database()cleans title/abstract/comments/journal-ref while importingpapers.jsonnormalize_paper_metadata()backfills already-packaged DB rows on startup (no-op commit when nothing changed)sites/arxiv/tests/Example (
/abs/2604.07983):becomes
Fixes #16.
Checklist
K_{11,11}, “Cone Conjecture”, “Command and Control”, …)^{\prime\prime}and\log \logis preserveddb.session.commit()when no fields change (byte-identical reset on an already-clean DB)sites/arxiv/tests/Test notes
Result: 10 tests, all OK (stdlib unittest; no extra deps).
Covered:
2604.07983,\mathbb{P}^1,\mathcal{N}=1,GL(d_1)\times GL(d_2),\mathrm{GL}_4, isotope/ion fragments)papers.jsontitles/abstracts/commentsseed_databaseandnormalize_paper_metadata()both call the helper; normalize runs beforebackfill_paper_gaps()python3 -m py_compile sites/arxiv/app.py sites/arxiv/metadata_cleaning.pysucceeded.Flask/Docker render of
/abs/2604.07983was not exercised in this environment (Flask stack not installed; no running site container). The helper was checked against the livepapers.jsonrow for that id and produces the expected cleaned title.Note: packaged
instance_seed/arxiv.dbrows stay dirty until the asset bundle is regenerated. Startup backfill rewrites those rows so the running site is clean; after a cleaned seed DB is shipped, the backfill becomes a no-op and reset byte-identity holds.