Backfill recent belief snapshots for hypotheses that lack current time-series state. Belief snapshots let SciDEX measure convergence, evidence accumulation, and confidence changes over time.
q-epistemic-rigor - Epistemic Rigor questscidex.core.database.get_db() before changing anything.belief_snapshots currently stores score, evidence_count, citations, and reviewer_count; the generated task wording mentioning market_price and confidence_score is ahead of the live schema.proposed / promoted / debated / open / archived; there is no active status in the current data.scripts/backfill_belief_snapshots.py to use the 7-day window, target non-archived hypotheses, default to a batch size of 30, and keep same-day inserts idempotent.python3 scripts/backfill_belief_snapshots.py --limit 30.archived / rejected / resolved): 548 -> 518.30 belief_snapshots rows were written on 2026-04-24 and 0 same-day duplicate hypothesis snapshots exist.hypotheses state: stored score matched composite_score, stored evidence_count matched live evidence array counts, and the sampled rows’ live market_price / confidence_score values were recorded during execution for audit context.score ← composite_score, evidence_count ← len(evidence_for)+len(evidence_against), citations ← citations_count, reviewer_count ← 0INSERT INTO belief_snapshots (hypothesis_id, score, evidence_count, citations, reviewer_count, snapshot_date)
SELECT h.id,
COALESCE(h.composite_score, 0.5),
COALESCE(jsonb_array_length(COALESCE(h.evidence_for, '[]'::jsonb)), 0) +
COALESCE(jsonb_array_length(COALESCE(h.evidence_against, '[]'::jsonb)), 0),
COALESCE(h.citations_count, 0),
0,
NOW()
FROM hypotheses h
WHERE NOT EXISTS (
SELECT 1 FROM belief_snapshots bs
WHERE bs.hypothesis_id = h.id AND bs.snapshot_date > NOW() - INTERVAL '30 days'
)
ORDER BY h.created_at DESC LIMIT 30;
-- Result: INSERT 0 30scripts/backfill_belief_snapshots.py with idempotent INSERT using WHERE NOT EXISTS clause-- Before/after counts
SELECT COUNT(*) FROM hypotheses h WHERE NOT EXISTS (SELECT 1 FROM belief_snapshots b WHERE b.hypothesis_id = h.id AND b.snapshot_date >= CURRENT_DATE - INTERVAL '7 days');
-- Verify 50 new snapshots with all required fields
SELECT bs.hypothesis_id, bs.score, bs.evidence_count, bs.citations, bs.reviewer_count, bs.snapshot_date
FROM belief_snapshots bs WHERE bs.snapshot_date::date = CURRENT_DATE ORDER BY bs.id DESC LIMIT 50;
-- Verify no duplicates today
SELECT hypothesis_id, COUNT(*) FROM belief_snapshots WHERE snapshot_date::date = CURRENT_DATE GROUP BY hypothesis_id HAVING COUNT(*) > 1;