"""Publish metadata-only external source audit and download checkpoint."""
import html,json
from pathlib import Path
R=Path(__file__).resolve().parents[1];O=R/'results/r112/external-reference-sources';a=json.loads((O/'metadata-audit.json').read_text());f=a['freshbar'];p=a['repod'];E=html.escape;names=''.join('<tr><th>'+E(name)+'</th><td>'+str(count)+'</td><td>'+('Yes' if name in p['diatom_exact_literal_matches_to_selected_ude_names'] else 'No exact string match')+'</td></tr>' for name,count in p['diatom_reference_names'].items());types=''.join('<li>'+E(k)+': '+str(v)+'</li>' for k,v in f['type_of_image_counts'].items());page='''<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>External diatom reference candidates</title><style>body{font:16px/1.55 system-ui;background:#f4f6f0;color:#193b37;margin:0}main{max-width:1100px;padding:24px;margin:auto}a{color:#076c59}.notice,section{background:white;border:1px solid #cbd8d1;padding:16px;margin:14px 0}.notice{border-left:5px solid #b88418}table{border-collapse:collapse}td,th{border:1px solid #cbd8d1;padding:8px;text-align:left}</style><main><nav><a href="/results/r112/">Synthetic training</a> · <a href="/results/r112/species-breadth/">Current source pool</a></nav><h1>External reference candidates</h1><p class="notice"><strong>Reserved candidates, not a validated independent benchmark.</strong> These collections come from separate projects, but biological sample independence, image duplication, specimen identity and model/pretraining exposure have not been established. Source names and microscope conditions require review. No image pixels were opened in this metadata audit.</p><section><h2>Swedish freshwater diatoms: FRESHBAR</h2><p>The <a href="https://researchdata.se/en/catalogue/dataset/2025-373">Swedish Research Data catalogue</a> describes CC0 images of living and prepared freshwater diatom strains, with culture and sample metadata. The <a href="https://research.slu.se/en/publications/new-dna-barcode-reference-data-of-freshwater-diatoms-bacillarioph/">associated study</a> reports 51 taxa across 17 genera and sequencing plus morphology; some labels require further taxonomic work. This could add a different optical and geographic source, but image suitability and independence must be checked specimen by specimen.</p><p>The downloaded <a href="/datasets/r112-external-candidates/freshbar/LM_pictures.tsv">image index</a> has 664 records across 48 literal folder-name strings. It includes the following reported image types:</p><ul>'''+types+'''</ul><p>Folder names are not necessarily verified species: some are genus-only, qualified, mixed or complex. There are 219 distinct nonempty culture strings, but these are not necessarily independent samples; daughter-strain relationships must be resolved before splitting. The archive <a href="/datasets/r112-external-candidates/freshbar/archive-notice-2026-12-03.html">returned a temporary frontend-closure notice</a> on 3 December 2026 UTC. Image availability may change. No FRESHBAR images were downloaded.</p><p><a href="/datasets/r112-external-candidates/freshbar/FRESHBAR_picture_images_SLU_archive.xlsx">Source workbook</a> · <a href="/datasets/r112-external-candidates/freshbar/mapfiles.txt">Archive handle map</a> · <a href="https://hdl.handle.net/20.500.12703/6822">Light-microscopy archive handle</a></p></section><section><h2>Polish freshwater phytoplankton references</h2><p>The <a href="https://doi.org/10.18150/YJJB05">RepOD dataset</a> lists expert reference identifications for 157 Stage 2 images. The reference table contains 17 diatom entries in three source-named taxa:</p><table><tr><th>Source name</th><th>Entries</th><th>Existing UDE label</th></tr>'''+names+'''</table><p>Repeated entries may show related specimens or the same organism; the table alone does not establish specimen independence. Stage 2 images were used in the publisher's prior GPT-5.6 Sol evaluation, and exposure of other models is unknown. The collection is small, unbalanced, and uses different microscopy preparation. It cannot establish Academy performance or a broad species benchmark.</p><p>The <a href="/datasets/r112-external-candidates/repod/holdout-policy.json">reservation policy</a> keeps all 157 Stage 2 and 30 Stage 1 cases out of training, augmentation, inference and visual selection until an evaluation protocol is frozen and sample independence, overlap and rights are reviewed. The downloaded archive is checked bytewise and cataloged without decoding its images. The dataset is published under <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a>; downstream derivative use must address attribution and share-alike obligations.</p><p id="download-status">Checking reserved archive status…</p><p><small>Displayed partial-file size is only a byte count, not evidence that a transfer is currently running. A partial archive must not be opened or used.</small></p><p><a href="/datasets/r112-external-candidates/repod/README_RepOD_phytoplankton_AI.txt">Source README</a> · <a href="/datasets/r112-external-candidates/repod/Supplementary_Table_S2.xlsx">Source reference workbook</a> · <a href="/datasets/r112-external-candidates/repod/record.json">Repository record</a></p></section><p><a href="metadata-audit.json">Full metadata audit</a> · <a href="metadata-verify.json">Metadata verification</a> · <a href="/datasets/r112-external-candidates/repod/archive-verification.json">Archive byte verification</a> · <a href="/datasets/r112-external-candidates/repod/archive-directory-verify.json">Reserved filename verification</a></p><script>async function poll(){let s=document.getElementById('download-status');try{let r=await fetch('/datasets/r112-external-candidates/repod/archive-verification.json?t='+Date.now(),{cache:'no-store'});if(r.ok){let x=await r.json();s.textContent='Reserved archive verified: '+x.bytes+' bytes; images remain uninspected and reserved.';return}}catch(e){}try{let r=await fetch('/datasets/r112-external-candidates/repod/stage2-images.zip.partial?t='+Date.now(),{method:'HEAD',cache:'no-store'});if(r.ok){let n=Number(r.headers.get('Content-Length'));s.textContent='Partial archive: '+(Number.isFinite(n)?n.toLocaleString():'unknown')+' / 974,816,827 bytes. Not yet verified or usable.';return}}catch(e){}s.textContent='No complete verified archive or readable partial file is currently visible.'}poll();setInterval(poll,15000)</script></main></html>''';(O/'index.html').write_text(page);print('published metadata-only external source review')
