SPB Git

spb/wp45_uqo

Public
2.4 KB · 35 lines python
1"""Status + paper tables/figures generated from recorded data."""2from __future__ import annotations3import json4from pathlib import Path5import pandas as pd6from . import config7from .provenance import ROOT89def status_text() -> str:10    L = ["JoF-250 status"]11    man = config.manifests_dir() / "corpus_manifest.parquet"12    if man.exists():13        df = pd.read_parquet(man); inc = df[df.decision == "include"]; L.append(f"- corpus: {len(inc)} included / {len(df)} files; years {dict(inc.bib_year.value_counts().sort_index().astype(int))}; crossref ok {int(inc.get('crossref_ok', pd.Series(dtype=bool)).sum())}")14    else: L.append("- corpus: NOT audited (run `jof250 corpus audit`)")15    ps = config.derived_dir() / "parse_summary.parquet"16    if ps.exists(): d = pd.read_parquet(ps); L.append(f"- parsed: {len(d)} docs, mean confidence {d.confidence.mean():.3f}, {int((d.confidence < 0.8).sum())} below 0.8")17    else: L.append("- parsed: none")18    ad = ROOT / "data" / "annotations" / "documents"; n_ann = len(list(ad.glob("*.json"))) if ad.exists() else 019    at = ROOT / "data" / "annotations" / "annotations_table.parquet"20    if at.exists(): t = pd.read_parquet(at); L.append(f"- annotations: {n_ann} files, {int(t.schema_valid.sum())} schema-valid")21    else: L.append(f"- annotations: {n_ann} files (table not built)")22    pr = sorted((ROOT / "profiles").glob("*.yaml")); L.append(f"- profiles: {len(pr)} ({', '.join(p.stem for p in pr)})" if pr else "- profiles: none")23    im = ROOT / "data" / "derived" / "index" / "index_meta.json"24    if im.exists(): m = json.loads(im.read_text()); L.append(f"- index: {m['n_units']} units, {m['n_docs']} docs ({m['n_docs_with_annotation']} with annotation), {m['embedding_model']}")25    else: L.append("- index: not built (run `jof250 index`)")26    sp = ROOT / "data" / "splits" / "heldout_v1.json"27    if sp.exists(): s = json.loads(sp.read_text()); L.append(f"- split heldout_v1: train {s['n_train']} / heldout {s['n_heldout']}")28    try:29        from . import llm; L.append(f"- API spend (ledger): {llm.spent_usd()} USD of cap {config.load('models')['budget_usd_cap']}")30    except Exception as e: L.append(f"- API spend: n/a ({e})")31    ex = ROOT / "experiments" / "outputs"32    runs = list(ex.glob("*/runs.jsonl")) if ex.exists() else []33    L.append(f"- experiments: {', '.join(f'{r.parent.name} ({sum(1 for _ in open(r))} runs)' for r in runs) or 'none'}")34    return "\n".join(L)35
Files · abe8945aefffa0096080b1470e6c1c6a089f5faa
Menu

Theme