Files
paper-atlas/paper_atlas/collectors/eccv2026_publications.py
T
codex-bot 6d35a2e567
Metadata integrity checks / metadata (push) Successful in 7m51s
Collect verified ECCV 2026 Springer proceedings metadata
2026-11-18 18:30:01 +08:00

185 lines
9.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Normalize frozen ECCV 2026 Springer proceedings and preserve publisher evidence."""
import argparse
import fcntl
import hashlib
import json
from pathlib import Path
import re
import tempfile
from paper_atlas.io.html import Document, clean
from paper_atlas.io.springer import parse_chapter, read_page, snapshot_index
SOURCE = 'eccv2026_springer'
ORIGIN = 'https://link.springer.com'
BOOK_TITLE = 'Computer Vision – ECCV 2026'
LIST_URL = ORIGIN + '/conference/eccv'
BOOK = re.compile(r'10\.1007/978-3-032-\d{5}-[\dXx]')
CHAPTER = re.compile(BOOK.pattern + r'_[1-9]\d*')
VOLUMES = set(range(17001, 17079))
PUBLICATIONS = 2835
def fingerprint(raw):
return hashlib.sha256(raw).hexdigest()
def toc_page(html, book_doi, volume):
tree = Document(html).root
text = clean(tree.text())
if BOOK_TITLE not in text or 'Malmö' not in text or f'(LNCS, volume {volume})' not in text:
raise ValueError('Unexpected Springer ECCV volume scope')
entries = {}
for node in tree.walk():
if node.tag != 'li' or node.attrs.get('data-test') != 'chapter':
continue
headings = [n for n in node.walk() if n.tag == 'h3']
if len(headings) != 1:
raise ValueError('Ambiguous Springer contents heading')
heading, = headings
title = clean(heading.text())
links = [n.attrs.get('href', '') for n in heading.walk() if n.tag == 'a']
if title in ('Front Matter', 'Back Matter') and not links:
continue
if len(links) != 1 or not title:
raise ValueError('Authored contents entry lacks one chapter link')
link, = links
doi = link.removeprefix('/chapter/')
if (not link.startswith('/chapter/') or not CHAPTER.fullmatch(doi)
or not doi.startswith(book_doi + '_') or doi in entries):
raise ValueError('Unexpected or duplicate Springer chapter DOI')
entries[doi] = title
if not entries:
raise ValueError('Empty Springer contents page')
return entries
def publisher_inventory(root):
root = Path(root).resolve()
receipt_bytes = (root / 'receipts.jsonl').read_bytes()
inventory_bytes = (root / 'volume-checkpoint.json').read_bytes()
summary = json.loads((root / 'summary.json').read_bytes())
volumes = json.loads(inventory_bytes)
receipt_rows = [json.loads(line) for line in receipt_bytes.splitlines()]
receipts = {row['file']: row for row in receipt_rows}
if (summary['raw_receipts_sha256'] != fingerprint(receipt_bytes)
or summary['volume_checkpoint_sha256'] != fingerprint(inventory_bytes)
or set(volumes) != {str(n) for n in VOLUMES}
or len(receipts) != len(receipt_rows)):
raise ValueError('Incomplete or inconsistent Springer contents snapshot')
entries, used = {}, set()
for number, volume in sorted(volumes.items()):
book_url = volume['book']
book_doi = book_url.removeprefix(ORIGIN + '/book/')
if not BOOK.fullmatch(book_doi) or book_url != ORIGIN + '/book/' + book_doi:
raise ValueError('Unexpected Springer volume URL')
if set(volume['files']) != {'1', '2'}:
raise ValueError('Missing reviewed Springer contents page')
volume_dois = set()
for index, file in volume['files'].items():
receipt = receipts[file]
path = root / file
page_url = book_url + ('?page=2' if index == '2' else '')
if (file in used or Path(file).name != file or not path.resolve().is_relative_to(root)
or receipt['url'] != page_url or receipt['status'] != 200
or not 0 < receipt['bytes'] <= 3_000_000):
raise ValueError('Unsafe, reused or mismatched Springer contents receipt')
raw = path.read_bytes()
if len(raw) != receipt['bytes'] or fingerprint(raw) != receipt['sha256']:
raise ValueError('Springer contents bytes disagree with receipt')
used.add(file)
page_entries = toc_page(raw.decode(), book_doi, int(number))
if entries.keys() & page_entries.keys():
raise ValueError('Springer chapter repeats across contents pages')
volume_dois.update(page_entries)
entries.update({doi: {'title': title, 'lncs_volume': int(number), 'book_doi': book_doi,
'evidence_url': page_url, 'evidence_sha256': receipt['sha256']}
for doi, title in page_entries.items()})
if volume_dois != set(volume['chapter_dois']) or len(volume_dois) != len(volume['chapter_dois']):
raise ValueError('Springer volume chapter set differs from checkpoint')
if used != receipts.keys() or len(entries) != PUBLICATIONS or summary['chapter_link_count'] != PUBLICATIONS:
raise ValueError('Springer contents chapter total differs from the reviewed archive')
return entries
def publisher_row(chapter, toc, evidence):
doi = chapter['doi']
if clean(chapter['title']) != toc['title']:
raise ValueError('Chapter title differs from Springer contents, review the version')
url = ORIGIN + '/chapter/' + doi
return {
'source': SOURCE, 'external_id': doi, 'url': url,
'venue': 'ECCV', 'year': 2026, 'track': 'main',
'title': chapter['title'], 'authors': chapter['authors'], 'abstract': chapter['abstract'],
'status': 'accepted', 'identifiers': {'doi': doi},
'submission_identifiers': [{'scheme': 'publication_doi', 'value': doi}],
'evidence_url': url, 'observed_at': evidence['observed_at'],
'raw_decision': 'Chapter published in the refereed ECCV 2026 conference proceedings.',
'tags': [{'namespace': SOURCE + ':publication_format', 'value': 'proceedings_chapter'}],
'metadata': {
'book_title': BOOK_TITLE, 'book_doi': toc['book_doi'], 'lncs_volume': toc['lncs_volume'],
'authors_citation_raw': chapter['authors_citation_raw'], 'first_page': chapter['first_page'],
'last_page': chapter['last_page'], 'publisher_chapter_evidence': evidence,
'publisher_contents_evidence': {'url': toc['evidence_url'], 'sha256': toc['evidence_sha256']},
'scope': 'Refereed conference proceedings, LNCS 17001–17078.',
'original_decision_signature_verified': False,
},
}
def collect(out, *, toc_snapshots, chapter_snapshots):
contents = publisher_inventory(toc_snapshots)
chapters = snapshot_index(chapter_snapshots)
urls = {ORIGIN + '/chapter/' + doi: doi for doi in contents}
if not chapters or not chapters.keys() <= urls.keys():
raise ValueError('No chapter snapshots or chapter outside reviewed ECCV proceedings')
rows, raw = [], {}
for url in sorted(chapters):
doi = urls[url]
body, evidence = read_page(chapters, url)
chapter = parse_chapter(body.decode(), doi, book_title=BOOK_TITLE, publication_year=2026)
rows.append(publisher_row(chapter, contents[doi], evidence))
raw[evidence['file']] = body
out = Path(out)
out.mkdir(parents=True, exist_ok=True)
lock_path = out / 'eccv2026-publications.collect.lock'
filename = 'eccv2026-springer-main.jsonl'
with lock_path.open('a') as lock:
fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
if any(p != lock_path for p in out.iterdir()):
raise FileExistsError('Existing output must be inspected, not overwritten')
with tempfile.TemporaryDirectory(prefix='.eccv2026-publications-', dir=out) as temporary:
stage = Path(temporary)
(stage / 'evidence').mkdir()
for path, body in raw.items():
(stage / path).write_bytes(body)
data = ''.join(json.dumps(row, ensure_ascii=False) + '\n' for row in rows).encode()
(stage / filename).write_bytes(data)
manifest = {
'source': SOURCE, 'venue': 'ECCV', 'year': 2026, 'track': 'main', 'parser_version': 1,
'file': str(out / filename), 'file_sha256': fingerprint(data), 'count': len(rows),
'list_url': LIST_URL, 'source_expected_count': PUBLICATIONS, 'status': 'partial',
'missing_abstract_count': sum(not r['abstract'] for r in rows),
}
report = {
'status': 'collected_pending_identity_review', 'records': len(rows), 'files': [manifest],
'toc_chapters': len(contents), 'chapter_details_missing': len(contents) - len(rows),
'database_written': False,
}
metadata = Path(filename).with_suffix('.manifest.json')
(stage / metadata).write_text(json.dumps(manifest, indent=2) + '\n')
(stage / 'collection-report.json').write_text(json.dumps(report, indent=2) + '\n')
for item in ('evidence', filename, metadata, 'collection-report.json'):
(stage / item).replace(out / item)
return report
def main(argv=None, *, prog=None):
parser = argparse.ArgumentParser(prog=prog)
parser.add_argument('--toc-snapshots', required=True)
parser.add_argument('--chapter-snapshots', required=True)
parser.add_argument('--out', required=True)
args = parser.parse_args(argv)
print(json.dumps(collect(args.out, toc_snapshots=args.toc_snapshots,
chapter_snapshots=args.chapter_snapshots), ensure_ascii=False))