#!/usr/bin/env bash # Monthly refresh (local only; nothing is uploaded or published by this script). # Re-collects every thread (states, comments and counts change), re-codes with keywords, # re-applies the manual judgements (keyed by url), and rebuilds data/threads.csv. # Needs: gh CLI logged in (read-only API use), python3. Runtime about 1-2 h, unattended. # Usage: scripts/refresh.sh (from the dataset folder) set -euo pipefail cd "$(dirname "$0")/.." month=$(date +%Y-%m) out="raw_full_$month" mkdir -p "$out" python3 -I scripts/collect.py scripts/repos_full.json "$out" 2> "$out/collect.log" python3 -I scripts/code.py "$out/threads.jsonl" "$out/coded_kw.jsonl" --drop-removed python3 -I scripts/build_dataset.py "$out/coded_kw.jsonl" data/threads.csv private/verification.csv \ manual/judgement.csv manual/judgement_full.csv manual/judgement_validation.csv \ manual/judgement_v4.csv manual/judgement_v4_precision.csv python3 -I scripts/stats.py data/threads.csv > "private/stats_$month.txt" # Rows the keywords cannot settle have a non-empty kw_unsure in private/verification.csv: judge them too # (relevance yes/no + thread_type, rules in decisions-2026-10-28.md) and append them to manual/judgement_v4.csv. # Human step (about 1-2 h a month): judge a random sample of 50 new rows for relevance + codes # python3 -I scripts/sample_for_review.py "$out/coded_kw.jsonl" 50 > private/review_$month.txt # then append the judgements to manual/judgement_full.csv (codes) / judgement_v4.csv (relevance, thread_type) # and re-run the build step above. Mark who judged in the judged_by column (person or agent). echo "done: data/threads.csv rebuilt from $out"