File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
scripts/restore-arxiv-preprint-date Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 1+ from datetime import datetime
2+ from inspirehep .curation .search_check_do import SearchCheckDo
3+
4+
5+ class RestoreArxivPreprintDate (SearchCheckDo ):
6+ """Restore the correct preprint_date which got overwritten due to an arXiv OAI-PMH bug."""
7+
8+ query = "da < 2025-06-16 and arxiv_eprints.value:* and preprint_date:2025-06-16->2025-07-01"
9+
10+ @staticmethod
11+ def check (record , logger , state ):
12+ return (
13+ record .created < datetime (2025 , 6 , 16 , 8 )
14+ and record .get ("preprint_date" , "0" ) >= "2025-06-16"
15+ )
16+
17+ @staticmethod
18+ def do (record , logger , state ):
19+ current_preprint_date = record ["preprint_date" ]
20+ for revision_id in range (2 , record .revision_id ):
21+ preprint_date = record .revisions [- revision_id ].get ("preprint_date" )
22+ if preprint_date and preprint_date != current_preprint_date :
23+ record ["preprint_date" ] = preprint_date
24+ return
25+ logger .warning ("Preprint date not modified" )
26+
27+
28+ RestoreArxivPreprintDate ()
You can’t perform that action at this time.
0 commit comments