173 lines
11 KiB
Python
173 lines
11 KiB
Python
"""Normalize the frozen ICASSP 2026 Crossref census without network or database writes."""
|
||
import argparse
|
||
from datetime import datetime
|
||
import hashlib
|
||
import json
|
||
from pathlib import Path
|
||
import re
|
||
|
||
from paper_atlas.io.html import clean
|
||
|
||
SOURCE = 'crossref_icassp_registry'
|
||
TRACK = 'proceedings_unclassified'
|
||
SNAPSHOT = 'icassp2026-registry-capture-v1'
|
||
MANIFEST_SHA = '1f8ffa040b1f682a4b65f476f4115cb95629056d8de5c324c8417d823846ae93'
|
||
CONTAINER = 'ICASSP 2026 - 2026 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP)'
|
||
OTHER_CONTAINER = '2026 IEEE 6th International Conference in Power Engineering Applications (ICPEA)'
|
||
PREFIX = '10.1109/icassp55912.2026.'
|
||
NONPAPERS = {
|
||
PREFIX+'11463724': ('ICASSP 2026 Reviewers', 'xii-lxxxvi'),
|
||
PREFIX+'11464828': ('Author Index', 'A-1-A-152'),
|
||
PREFIX+'11464776': ('Title Page', 'i-ii'),
|
||
PREFIX+'11462944': ('ICASSP 2026 Committees', 'vi-xii'),
|
||
PREFIX+'11464852': ('ICASSP 2026 Organizing Committee', 'iii-iii'),
|
||
PREFIX+'11460797': ('ICASSP 2026 Cover Page', 'c1-c1'),
|
||
PREFIX+'11463523': ('Table of Contents', 'xlix-cdlxii'),
|
||
}
|
||
|
||
|
||
def digest(raw):
|
||
return hashlib.sha256(raw).hexdigest()
|
||
|
||
|
||
def load_snapshot(root):
|
||
root = Path(root); directory = root/SNAPSHOT; path = directory/'manifest.json'
|
||
if root.is_symlink() or directory.is_symlink() or path.is_symlink() or path.stat().st_size > 128*1024:
|
||
raise ValueError('Unsafe snapshot manifest')
|
||
raw = path.read_bytes()
|
||
if digest(raw) != MANIFEST_SHA:
|
||
raise ValueError('Reviewed manifest hash changed')
|
||
manifest = json.loads(raw)
|
||
if (manifest['status'] != 'registry_census_completed_not_import_approval'
|
||
or manifest['records_captured'] != 4645 or manifest['unique_dois'] != 4645
|
||
or manifest['database_written'] is not False or manifest['approved_for_import'] != 0
|
||
or len(manifest['pages']) != 10):
|
||
raise ValueError('Incomplete frozen census receipt')
|
||
files = {'manifest.json': raw}; rows = []
|
||
for index, receipt in enumerate(manifest['pages'], 1):
|
||
name = receipt['file']; path = directory/name
|
||
if (name != f'page-{index:03}.json' or path.is_symlink()
|
||
or path.stat().st_size > 4*1024**2):
|
||
raise ValueError('Unsafe snapshot page')
|
||
body = path.read_bytes()
|
||
if (receipt['http_status'] != 200 or receipt['url'] != receipt['final_url']
|
||
or not receipt['url'].startswith('https://api.crossref.org/works?')
|
||
or datetime.fromisoformat(receipt['at']).utcoffset() is None
|
||
or receipt['bytes'] != len(body) or receipt['sha256'] != digest(body)):
|
||
raise ValueError('Snapshot receipt/body disagree')
|
||
data = json.loads(body); message = data['message']
|
||
expected = 500 if index < 10 else 145
|
||
if data['status'] != 'ok' or message['total-results'] != 4645 or len(message['items']) != expected:
|
||
raise ValueError('Incomplete registry page')
|
||
files[name] = body
|
||
for original in message['items']:
|
||
rows.append((original, receipt))
|
||
return manifest, files, rows
|
||
|
||
|
||
def registry_papers(rows):
|
||
seen = set(); papers = []; nonpapers = []; other = []
|
||
for original, receipt in rows:
|
||
doi = original.get('DOI')
|
||
if not isinstance(doi, str) or doi in seen:
|
||
raise ValueError('Missing or repeated registry DOI')
|
||
seen.add(doi)
|
||
if original.get('container-title') == [OTHER_CONTAINER]:
|
||
if doi.startswith(PREFIX):
|
||
raise ValueError('Conference DOI/container conflict')
|
||
other.append(doi)
|
||
continue
|
||
if (original.get('container-title') != [CONTAINER]
|
||
or original.get('event', {}).get('name') != CONTAINER
|
||
or not re.fullmatch(re.escape(PREFIX)+r'[0-9]+', doi)
|
||
or original.get('publisher') != 'IEEE' or original.get('type') != 'proceedings-article'
|
||
or original.get('URL') != 'https://doi.org/'+doi
|
||
or original.get('published') != {'date-parts': [[2026, 5, 3]]}
|
||
or original.get('event', {}).get('start') != {'date-parts': [[2026, 5, 3]]}
|
||
or original.get('event', {}).get('end') != {'date-parts': [[2026, 5, 8]]}):
|
||
raise ValueError('Wrong registered conference, DOI, publisher or dates')
|
||
if doi in NONPAPERS:
|
||
title, page = NONPAPERS[doi]
|
||
if original.get('title') != [title] or original.get('page') != page or original.get('author'):
|
||
raise ValueError('Changed reviewed nonpaper evidence')
|
||
nonpapers.append({'doi': doi, 'title': title, 'page': page})
|
||
continue
|
||
titles = original.get('title')
|
||
if not isinstance(titles, list) or len(titles) != 1 or not isinstance(titles[0], str) or not clean(titles[0]):
|
||
raise ValueError('Missing registry title')
|
||
authors = original.get('author')
|
||
if not isinstance(authors, list) or not authors or original.get('abstract'):
|
||
raise ValueError('Missing authors or changed abstract availability')
|
||
names = []; flags = []
|
||
for position, author in enumerate(authors):
|
||
if (not isinstance(author, dict) or not isinstance(author.get('family'), str)
|
||
or not clean(author['family']) or ('given' in author and not isinstance(author['given'], str))
|
||
or author.get('sequence') != ('first' if position == 0 else 'additional')):
|
||
raise ValueError('Incomplete registry author or sequence')
|
||
name = clean(' '.join(x for x in (author.get('given'), author['family']) if x))
|
||
if not name or '@' in name or name.casefold() == 'anonymous':
|
||
raise ValueError('Unreviewed author identity')
|
||
if not author.get('given'):
|
||
flags.append({'kind': 'registry_single_name_field_not_split', 'author_position': position+1})
|
||
names.append(name)
|
||
papers.append({'original': original, 'receipt': receipt, 'title': clean(titles[0]), 'authors': names, 'review_flags': flags})
|
||
if len(seen) != 4645 or len(papers) != 4582 or len(other) != 56 or {r['doi'] for r in nonpapers} != set(NONPAPERS):
|
||
raise ValueError('Incomplete reviewed registry partition')
|
||
return sorted(papers, key=lambda p: p['original']['DOI']), nonpapers, other
|
||
|
||
|
||
def collect(out, *, snapshots):
|
||
out = Path(out)
|
||
if out.exists():
|
||
raise ValueError('Output exists; inspect previous operation before retrying')
|
||
out.mkdir(parents=True)
|
||
try:
|
||
manifest, files, items = load_snapshot(snapshots)
|
||
papers, nonpapers, other = registry_papers(items)
|
||
evidence_dir = out/'evidence'; evidence_dir.mkdir()
|
||
for name, body in files.items():
|
||
(evidence_dir/name).write_bytes(body)
|
||
rows = []
|
||
for paper in papers:
|
||
original = paper['original']; receipt = paper['receipt']; doi = original['DOI']
|
||
rows.append({'source': SOURCE, 'external_id': doi, 'url': original['URL'],
|
||
'title': paper['title'], 'authors': paper['authors'], 'abstract': None,
|
||
'identifiers': {'doi': doi}, 'submission_identifiers': [{'scheme': 'publication_doi', 'value': doi}],
|
||
'venue': 'ICASSP', 'year': 2026, 'track': TRACK, 'status': 'accepted',
|
||
'raw_decision': 'Publication registered in Crossref ICASSP 2026 proceedings; not an original signed decision.',
|
||
'evidence_url': receipt['url'], 'observed_at': receipt['at'], 'tags': [],
|
||
'metadata': {'registry_fields': original, 'review_flags': paper['review_flags'],
|
||
'source_evidence': {'file': 'evidence/'+receipt['file'], 'sha256': receipt['sha256'], 'url': receipt['url']},
|
||
'source_manifest': {'file': 'evidence/manifest.json', 'sha256': MANIFEST_SHA},
|
||
'original_decision_signature_verified': False,
|
||
'abstract_availability': 'Absent in frozen registry deposit; no abstract inferred or fused from program versions.',
|
||
'author_transform': 'Whitespace normalization of given + family in registered order; single fields retained, not guessed or split; all original author fields retained.',
|
||
'publication_dates': {k: original[k] for k in ('published', 'published-print', 'published-online') if k in original},
|
||
'date_scope': 'Registered event starts May 3; conference website says May 4–8. Source values preserved without substitution.',
|
||
'scope': 'Registered publication version only. Requires work/DOI/history review before import. No automatic program match, aliases, track/type or public-negative inference.'}})
|
||
path = out/'icassp-crossref-registry-2026-unclassified.jsonl'
|
||
raw = ''.join(json.dumps(r, ensure_ascii=False)+'\n' for r in rows).encode(); path.write_bytes(raw)
|
||
file_manifest = {'source': SOURCE, 'parser_version': 1, 'venue': 'ICASSP', 'year': 2026, 'track': TRACK,
|
||
'count': len(rows), 'file': str(path), 'file_sha256': digest(raw), 'list_url': manifest['pages'][0]['url'],
|
||
'status': 'partial', 'missing_abstract_count': len(rows)}
|
||
path.with_suffix('.manifest.json').write_text(json.dumps(file_manifest, indent=2)+'\n')
|
||
report = {'status': 'collected_pending_identity_review', 'records': len(rows), 'files': [file_manifest],
|
||
'filtered_registry_records': 4645, 'excluded_nonpaper_items': nonpapers, 'excluded_other_conference_dois': other,
|
||
'missing_abstract_count': len(rows), 'single_name_author_fields': sum(len(p['review_flags']) for p in papers),
|
||
'database_written': False, 'network_requests': 0, 'pdfs_downloaded': False, 'approved_for_import': 0,
|
||
'public_rejected_availability': 'unknown', 'source_manifest_sha256': MANIFEST_SHA,
|
||
'scope': 'Registry census, not completeness of program, abstracts, tracks, negative decisions or work identities. Official program has4589 titles;174 unmatched normalized title candidates remain separate source discrepancies, not rejection or withdrawal evidence.'}
|
||
part = out/'collection-report.json.part'; part.write_text(json.dumps(report, ensure_ascii=False, indent=2)+'\n'); part.replace(out/'collection-report.json')
|
||
return report
|
||
except Exception as error:
|
||
(out/'failed.json').write_text(json.dumps({'status': 'failed_not_complete', 'error_type': type(error).__name__, 'database_written': False})+'\n')
|
||
raise
|
||
|
||
|
||
def main(argv=None, *, prog=None):
|
||
parser = argparse.ArgumentParser(prog=prog, description=__doc__)
|
||
parser.add_argument('--snapshots', required=True)
|
||
parser.add_argument('--out', required=True)
|
||
args = parser.parse_args(argv)
|
||
print(json.dumps(collect(args.out, snapshots=args.snapshots), ensure_ascii=False))
|