#!/usr/bin/env bash
set -u
cd /home/mande/repo/quber
LOG=experiments/que259/out/som.log
: > "$LOG"
# targeted set: chart-heavy + image-table candidate + small controls
# (102174103 already done in pilot)
TARGETS="101425642 101230425 101644521 100377849 101215348"
for id in $TARGETS; do
  pdf=experiments/que259/inputs/$id.pdf
  if [[ -f experiments/que259/tables/$id.tables.json ]]; then
    echo "[$id] tables exist, skip" | tee -a "$LOG"; continue
  fi
  echo "[$id] START $(date +%T)" | tee -a "$LOG"
  uv run quber table --review -o experiments/que259/tables "$pdf" >>"$LOG" 2>&1
  echo "[$id] som rc=$? $(date +%T)" | tee -a "$LOG"
done
echo "SOM_COMPLETE $(date +%T)" | tee -a "$LOG"
