156 lines
9.3 KiB
Python
156 lines
9.3 KiB
Python
"""ICAPS 2026 frozen official listing, with unresolved track membership explicit."""
|
|
import argparse
|
|
from collections import Counter
|
|
from datetime import datetime
|
|
import hashlib
|
|
import json
|
|
from pathlib import Path
|
|
|
|
from paper_atlas.io.html import Document, Node, clean
|
|
|
|
SOURCE = 'icaps_official_program'
|
|
ROOT = 'https://icaps26.icaps-conference.org/'
|
|
PAGES = {
|
|
'accepted.html': (ROOT+'program/accepted/', '235543c3e5917ecb3e10a1429a4754f9cb7fae9844b54404076254584da86443'),
|
|
'cfp.html': (ROOT+'calls/cfp/', 'bdcf5a5b3b4144d6c6ecf3e324c856363f4f4e992e592c1f63988980434ecd5d'),
|
|
'previously-published.html': (ROOT+'calls/previously_published_research/', 'ecd60c8c056c9aa73bac16eb11f220c756ddff562511f0ec42ada41919fb1946'),
|
|
}
|
|
MAIN = 'Papers accepted to the Main Tracks'
|
|
PREVIOUS = 'Previously Published Papers'
|
|
TRACK = 'main_tracks_unclassified'
|
|
|
|
|
|
def digest(raw):
|
|
return hashlib.sha256(raw).hexdigest()
|
|
|
|
|
|
def authors_from_literal(literal):
|
|
# This frozen listing uses commas between authors and a final "and".
|
|
# Preserve the complete literal too; never infer person-name aliases.
|
|
if literal.count(' and ') != 1 or ', and ' in literal:
|
|
raise ValueError('Unreviewed author-list punctuation')
|
|
first, last = literal.rsplit(' and ', 1)
|
|
authors = first.split(', ') + [last]
|
|
if any(not a or a != clean(a) or ',' in a or '@' in a or 'anonymous' in a.casefold() for a in authors):
|
|
raise ValueError('Incomplete or ambiguous author list')
|
|
if ', '.join(authors[:-1])+' and '+authors[-1] != literal:
|
|
raise ValueError('Author literal cannot be reconstructed')
|
|
return authors
|
|
|
|
|
|
def parse_listing(raw):
|
|
nodes = list(Document(raw).root.walk())
|
|
headings = [clean(n.text()) for n in nodes if n.tag == 'h1']
|
|
if headings != ['List of Papers Accepted to ICAPS 2026']:
|
|
raise ValueError('Unexpected official conference edition')
|
|
section = None; sections = []; rows = []; seen = set()
|
|
for n in nodes:
|
|
if n.tag == 'h2':
|
|
section = clean(n.text()); sections.append(section)
|
|
if n.tag != 'div' or 'paper' not in n.attrs.get('class', '').split():
|
|
continue
|
|
if section not in (MAIN, PREVIOUS):
|
|
raise ValueError('Paper belongs to an unreviewed section')
|
|
# Require the reviewed title and complete-author blocks; fail on layout drift.
|
|
blocks = [b for b in n.children if isinstance(b, Node)]
|
|
if len(blocks) != 2 or any(b.tag != 'div' for b in blocks):
|
|
raise ValueError('Changed paper metadata layout')
|
|
titles = [b for b in blocks[0].walk() if b.tag == 'strong']
|
|
if len(titles) != 1 or any(b.tag == 'a' for b in n.walk()):
|
|
raise ValueError('Changed paper title/link layout')
|
|
title = clean(titles[0].text()); literal = clean(blocks[1].text())
|
|
if not title or clean(blocks[0].text()) != title or title.casefold() in seen:
|
|
raise ValueError('Empty or repeated paper title')
|
|
seen.add(title.casefold())
|
|
rows.append({'section': section, 'title': title, 'authors': authors_from_literal(literal),
|
|
'authors_literal': literal})
|
|
if sections != [MAIN, PREVIOUS] or Counter(r['section'] for r in rows) != {MAIN: 90, PREVIOUS: 10}:
|
|
raise ValueError('Incomplete reviewed official listing')
|
|
return rows
|
|
|
|
|
|
def collect(out, *, snapshots):
|
|
out = Path(out)
|
|
if out.exists():
|
|
raise ValueError('Output exists; inspect previous operation before retrying')
|
|
out.mkdir(parents=True)
|
|
try:
|
|
root = Path(snapshots)
|
|
manifest_path = root/'manifest.json'
|
|
if manifest_path.is_symlink():
|
|
raise ValueError('Snapshot symlinks rejected')
|
|
receipt = json.loads(manifest_path.read_bytes())
|
|
observed = receipt['at']
|
|
if (receipt.get('status') != 'collected_not_parsed_not_imported'
|
|
or receipt.get('database_written') is not False
|
|
or datetime.fromisoformat(observed.replace('Z', '+00:00')).utcoffset() is None):
|
|
raise ValueError('Invalid reviewed snapshot receipt')
|
|
receipts = receipt['sources']
|
|
if len(receipts) != 3 or {r['file'] for r in receipts} != set(PAGES):
|
|
raise ValueError('Unexpected snapshot source set')
|
|
bodies = {}; evidence = {}; directory = out/'evidence'; directory.mkdir()
|
|
for name, (url, expected) in PAGES.items():
|
|
matches = [r for r in receipts if r['file'] == name]
|
|
if len(matches) != 1:
|
|
raise ValueError('Repeated snapshot receipt')
|
|
r = matches[0]; p = root/name
|
|
if p.is_symlink() or p.stat().st_size > 2*1024**2:
|
|
raise ValueError('Unsafe or oversized snapshot')
|
|
raw = p.read_bytes()
|
|
if digest(raw) != expected or r['sha256'] != expected or r['bytes'] != len(raw):
|
|
raise ValueError('Reviewed snapshot hash changed')
|
|
if r['url'] != url or r['final_url'] != url:
|
|
raise ValueError('Unexpected snapshot URL or redirect')
|
|
rel = f'evidence/{expected}.html'; (out/rel).write_bytes(raw)
|
|
bodies[name] = raw.decode('utf-8')
|
|
evidence[name] = {'url': url, 'file': rel, 'sha256': expected}
|
|
entries = parse_listing(bodies['accepted.html']); rows = []; previous = []
|
|
for entry in entries:
|
|
entry_key = digest(json.dumps([entry['title'], entry['authors_literal']], ensure_ascii=False, separators=(',', ':')).encode())
|
|
if entry['section'] == PREVIOUS:
|
|
previous.append({**entry, 'entry_key': entry_key,
|
|
'presentation_kind': 'previously_published_research',
|
|
'evidence_url': PAGES['accepted.html'][0], 'observed_at': observed,
|
|
'scope': 'Official presentation listing, not evidence of new archival publication or a new research-paper acceptance.'})
|
|
continue
|
|
rows.append({'source': SOURCE, 'external_id': '2026/main-tracks/'+entry_key,
|
|
'url': PAGES['accepted.html'][0], 'title': entry['title'], 'authors': entry['authors'],
|
|
'abstract': None, 'identifiers': {}, 'submission_identifiers': [],
|
|
'venue': 'ICAPS', 'year': 2026, 'track': TRACK, 'status': 'accepted',
|
|
'raw_decision': 'listed in official ICAPS 2026 Papers accepted to the Main Tracks',
|
|
'evidence_url': PAGES['accepted.html'][0], 'observed_at': observed, 'tags': [],
|
|
'metadata': {'official_listing': entry, 'source_evidence': evidence,
|
|
'source_entry_key': {'algorithm': 'sha256-json-title-and-literal-authors', 'value': entry_key,
|
|
'scope': 'Snapshot entry locator only; not an original submission ID, DOI, or cross-source work identity.'},
|
|
'track_assignment': 'Unresolved among main and four special tracks; do not relabel all records as main.',
|
|
'abstract_availability': 'not_on_official_listing',
|
|
'original_decision_signature_verified': False,
|
|
'scope': 'Official listing evidence only; requires current identity review before import. No absence-based rejection or new-paper inference.'}})
|
|
path = out/'icaps-official-program-2026-main-tracks-unclassified.jsonl'
|
|
payload = ''.join(json.dumps(r, ensure_ascii=False)+'\n' for r in rows).encode(); path.write_bytes(payload)
|
|
manifest = {'source': SOURCE, 'parser_version': 1, 'venue': 'ICAPS', 'year': 2026, 'track': TRACK,
|
|
'count': 90, 'file': str(path), 'file_sha256': digest(payload), 'list_url': PAGES['accepted.html'][0],
|
|
'status': 'partial', 'missing_abstract_count': 90}
|
|
path.with_suffix('.manifest.json').write_text(json.dumps(manifest, indent=2)+'\n')
|
|
sidecar = out/'previously-published-presentations.json'
|
|
sidecar.write_text(json.dumps({'records': previous, 'count': 10, 'ingestion_ready': False,
|
|
'scope': 'Presentation evidence retained separately; not emitted as new accepted research-paper records.'}, ensure_ascii=False, indent=2)+'\n')
|
|
report = {'status': 'collected_pending_identity_review', 'records': 90, 'previously_published_presentations': 10,
|
|
'files': [manifest], 'previously_published_file': sidecar.name, 'previously_published_sha256': digest(sidecar.read_bytes()),
|
|
'source_evidence': evidence, 'database_written': False, 'pdfs_downloaded': False,
|
|
'public_rejected_availability': 'unknown', 'missing_abstract_count': 90,
|
|
'scope': 'Partial official list; individual tracks and stable identities unresolved; no all-paper, public-negative or final-dedup claim.'}
|
|
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))
|