File size: 8,310 Bytes
a8fb296
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
sidebar_position: 40
title: Batch analysis light vs full
description: Run all covers stages 1–5 (through reports light); analysis/reports full are opt-in with multi-select eligibility filters (#755).
---

# Batch analysis light vs full

Decision draft 2026-11-22. Parent issue
[#755](https://github.com/getcommunityone/open-navigator/issues/755). Builds on
[Jev-light cascade](./jev-light-cascade-design.md) and today’s Batch Job Status
stages / Run all.

## Problem

**Run all** and the stage list treat Gemini analysis + reports as one pass.
Operators want cheap **light** coverage on every captioned video in the funnel,
and expensive **full** analysis/reports only on a **chosen subset** (multi-select
filters such as has-decisions and interestingness). Full must not run by
default.

## Decision

### Stages (seven)

| # | Stage | Launch step (API) | In **Run all**? |
|---|--------|-------------------|-----------------|
| 1 | Discover | `discover` | Yes |
| 2 | Videos | `catalog` | Yes |
| 3 | Transcripts | `captions` | Yes |
| 4 | Analysis light | `analyze-light` | Yes |
| 5 | Reports light | `reports-light` | Yes |
| 6 | Analysis full | `analyze-full` | **No** |
| 7 | Reports full | `reports-full` | **No** |

**Run all** = stages 1–5 only (`discover`, `catalog`, `captions`,
`analyze-light`, `reports-light`), started **in parallel** as five separate
launches (#763) — each with its own log / Stop / VPN auto-resume — not a
sequential shell chain. Analysis/reports full stay opt-in.

**Discover's Last activity** is the latest of two stamps on the scraped-jurisdiction tables
(`bronze.bronze_jurisdictions_counties_scraped`, `bronze.bronze_jurisdictions_municipalities_scraped`):
`discovered_at`, when a channel was found, and `channel_checked_at`, the last time a Discover run tried that
jurisdiction, whatever came of it. `discover --load` stamps `channel_checked_at` after each county it searches
(`load_missing_county_channels.py`) and after each channel it loads (`load_youtube_for_jurisdiction.py`), so the
column moves while the run works (#770). Before #770 it read `discovered_at` only, which that run never writes, so it
could say "23h ago" while counties were loading.

**Each** (per-jurisdiction) stays catalog/captions/light-oriented unless we
explicitly extend it later; it does **not** run full by default.

### Light vs full (product meaning)

| | Light | Full |
|---|--------|------|
| Prompt | `policy_analysis_lite.md` (or successor short Part 1) | Current `policy_analysis_part_1.md` (deep) |
| Report | Short digest / lite Part 2 (or truncated Part 2) | Current `policy_analysis_part_2.md` |
| Model | DeepSeek (`deepseek-flash`, set by `LIGHT_MODEL`); no Gemini call (#774) | Paid Flash (or configured full model) |
| Stamp | Prefer distinct paths or metadata so stage counts split (see Contract) | Distinct from light |
| Who | Broad transcript set (Jev meeting gate still allowed) | Subset of videos that already have **analysis light**, matching filter checkboxes |

### Full eligibility — multi-select checkboxes

On **Analysis full** and **Reports full** Run controls, show a **multi-select
checkbox group** (not a single dropdown). Operator may check zero or more;
**OR** semantics across checked filters (match any). Unchecked filters are
ignored.

**v1 filter keys (checkbox labels):**

| Key | Checkbox label | Default checked? | Match rule (v1) |
|-----|----------------|------------------|-----------------|
| `has_decisions` | Has decisions | **Yes** | Jev `has_decisions_p ≥ 0.5` **or** light analysis already extracted ≥1 decision |
| `interestingness` | High interestingness | **Yes** | Among light-analyzed videos in scope, `interestingness_score` in top **20%** **or** score ≥ tunable floor (seed/env; document default in schema) |
| `data_center` | Data-center mention | Yes if Filter cohort is `data_centers`; else No | Jev `mentions_data_center_p ≥ 0.5` |
| `force` | (later) Force video list | No | Explicit IDs — out of v1 UI |

**Require light first:** full never selects a video without a successful
**analysis light** stamp (except a future force list).

**Reports full:** only videos with **analysis full** (and still satisfying the
same checkbox set if re-applied, or inherit the set from the last analyze-full
launch stored on the launch meta).

**Empty selection:** if the operator unchecks all boxes, disable Run (or no-op
with a clear message) — do not interpret as “everyone.”

### UI sketch (Batch Job Status)

- Stage list shows all seven rows; 6–7 have **Run** but are **not** driven by
  Run all.
- Expanding 6 or 7 reveals:
  - Checkbox group (multi-select) with the v1 filters above
  - Short helper: “Full runs only on videos that already have analysis light and
    match any checked filter.”
  - Run button for that step only
- Persist last checkbox set in `localStorage` (per browser) so re-clicks keep
  defaults; send selected keys on `POST /api/batch-jobs/launch` as
  `full_filters: string[]`.

### Launch contract

```http
POST /api/batch-jobs/launch
{
  "step": "analyze-full",
  "states": ["AL", ...],
  "cohort": "data_centers",
  "n": 25,
  "parallel": 4,
  "full_filters": ["has_decisions", "interestingness"]
}
```

- `full_filters` required (non-empty) when `step` is `analyze-full` or
  `reports-full`; ignored otherwise.
- `analyze-light` / `reports-light` ignore `full_filters`.
- Shell / CLI: map light to `--prompt-file …/policy_analysis_lite.md` and a
  light report prompt; full to current Part 1 / Part 2; apply SQL/Jev filter
  from `full_filters` before the video loop.

### Stage progress

- **Analysis light / reports light:** count `policy_analysis_at` /
  `policy_report_at` (lite Part 1 / Part 2). Denominator for analysis light =
  transcripts in scope; for reports light = analysis light in scope.
- **Analysis full / reports full:** count `policy_*_full_*` only. Denominator for
  analysis full = transcripts in scope (same grain as light — pre-split deep
  Part 1 rows often have no light stamp after #766 reclassify); for reports
  full = analysis full. New full runs still require light first at launch time.
- **Pre-split deep Part 1** (`prompts/policy_analysis_part_1.md`) that landed on
  light columns before #755 must be reclassified onto full stamps
  (`python -m llm.gemini.reclassify_policy_tier_stamps`, #766) so Analysis light
  % is not the old full-job coverage.
- Do **not** invent counts (No Fabricated Data).

### Out of scope (follow-ups)

- Blurb-only Jev stage (#705) as a separate stage 3.5
- Force-ID UI
- Auto-scheduling full after light
- Changing interestingness formula (use existing `item_interestingness`)

## Alternatives considered

1. **Single analyze step + mode flag** — easier to mis-click full; weaker stage
   progress. Rejected for operator clarity.
2. **Hard-coded Jev-only full gate** — no interestingness checkbox. Rejected;
   operators want multi-select choices.
3. **Keep today’s Part 1+2 as “light”** and add full later — faster ship but
   wrong names on the dashboard. Rejected once Run all is redefined as 1–5.

## Done when (implementation)

- [x] Design this page linked from #755
- [x] Seven stages on Batch Job Status; Run all = 1–5
- [x] Full Run UI = multi-select checkboxes with v1 defaults
- [x] Launch API accepts `full_filters`; full steps refuse empty selection
- [x] Light/full stamps distinguishable in stage report (`policy_*` vs `policy_*_full_*`, migration 114)
- [x] Docs + tests for filter OR semantics and Run all composition

## Update 2026-11-23 — light tier runs on DeepSeek (#774)

Analysis light and Reports light no longer call Gemini. `youtube_run_priority_states_last_n.sh`
passes `--model "$LIGHT_MODEL" --part-2-model "$LIGHT_MODEL"` to
`llm.gemini.meeting_transcript_policy` when the tier is `light`, and `LIGHT_MODEL` defaults to
`deepseek-flash`. The full tier is unchanged. When every model in a run is `deepseek-*`, the
policy script skips its Gemini key probe, so Gemini billing exhaustion (HTTP 402) cannot stop
a light run. The Jev gate (`--skip-jev-meeting-below`) still applies where it already did.

Needs `DEEPSEEK_API_KEY` in `.env`. To put light back on Gemini, set `LIGHT_MODEL=` (empty) or a
`gemini-*` id in the environment that launches the job.