fix(citations): drop pre-publication citation buckets#339
Merged
Conversation
OpenAlex citing works sometimes carry bad publication years, producing citation counts in years before the paper existed (e.g. the BIDS 2016 paper showed a 2013 bucket). Floor each canonical paper's histogram at its earliest version publication year. - resolve_work returns the work id AND publication_year (ResolvedWork). - sync_citing_papers takes the minimum publication year across the version group (the preprint, when present) and drops any count in earlier years. Tests: pre-publication bucket dropped; floor uses the earliest version year.
- Use 'is not None' for publication_year filter (don't drop a year-0 edge). - Test that an over-high floor (bogus future year) leaves existing counts intact via the empty-counts guard rather than wiping them.
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.
Problem
OpenAlex citing works occasionally carry incorrect publication years, producing citation counts dated before the cited paper existed. The BIDS 2016 paper, for example, showed a
2013bucket — impossible. This applies both per paper and across a version group.Fix
Floor each canonical paper's per-year histogram at its earliest version publication year (the preprint, when one is aliased). Counts in years before that are dropped.
resolve_worknow returns the work id andpublication_year(ResolvedWork).sync_citing_paperstakesmin(publication_year)across the resolved version group and filterscountstoyear >= floor. The empty-counts guard still protects existing data.LSL (preprint 2024 / published 2025) is unaffected (its citations are 2024+); BIDS 2016 loses its spurious pre-2016 buckets.
Test plan
resolve_workreturns id + year; missing year -> None; 404 -> None.Deploy follow-up
Re-run
sync papers --community {eeglab,bids} --citationson dev and prod to refresh the floored histograms.