Show the current rendering of a work on the glossary reference list
The glossary reference list (/glossary/references/) now shows a corrected reference as soon as the Glossary BibTex Doc is fixed. Before, it waited for the term files to be regenerated.
Problem. _build_references.py builds the list from the formatted strings in the term files. Those strings change only when someone dispatches a glossary regeneration. A Doc fix reaches apa_lookup.json on the next data-processing run, but the list kept the old string. If no term file carried the current string any more, the builder fell back to the most-cited stale string. For #1314 that would have brought back "& others." on four entries.
Change. If no term file carries the current rendering of a work, the builder uses the single current apa_lookup.json rendering with the same work key (first author, year, opening of the title). It also requires the full title to match a title in the term files, ignoring case, punctuation and a closing bracket such as an edition. If two different current renderings share a key, or the titles differ, it keeps the old behaviour. Lookup keys with identical renderings count once, since they print the same reference. Four tests in scripts/tests/test_build_references.py cover these cases.
Effect, using the Doc as it stood after the #1314 fixes: 19 entries on the list change. The #1316 fixes, made since, add more for the same reason.
- 12 #1314 fixes: Simonsohn 2014, Tennant 2019, Merton 1942, Houtkoop 2018, Fletcher-Watson 2019, Gollwitzer 2020, Many Labs 2, Silberzahn 2018, Nichols 2017, Pernet 2020, Tierney 2020 and Bik 2016.
- 7 earlier Doc fixes that never reached the list: Etz, Fraser, Gorgolewski, Hunter, National Academies, Noy and EQUATOR. The Noy and EQUATOR URLs change from links that return 403 and 404 to links that return 200.
Limits.
- A fix that changes the first author, year or title opening also changes the work key, so the list still shows the old string until regeneration. From #1314 this covers the corporate authors, Villum, Ioannidis, Lindsay, Garson, COPE and EUDatasharing.
- Term pages are unchanged and show none of the fixes until regeneration.
- The title check is a heuristic, and some cases fall back to the old string, as on
main: a pages or volume fix to a title ending in "?" (the title then runs into the journal details), and spacing fixes within the work key. It can still mistake one work for another in one case: two works share the first author, the year and the title up to an internal full stop (e.g. "U.S.") or a closing bracket, and the work a term cites has also left the lookup.
Testing.
python3 -m unittest discover -s scripts/tests: 82 tests, all passing. On the committed data the guarded and unguarded versions produce the same page.- I regenerated
apa_lookup.jsonandreferences/index.mdlocally to produce the list above. This PR doesn't commit them, because the data-processing run writes both.
After merging: dispatch data-processing.yml on main. The scheduled run at 00:00 UTC would otherwise rebuild the list with the old builder.
Refs #1314
š¤ Generated with Claude Code