feat: bill action pipeline, What Changed UI, citation backfill, admin panel
Backend:
- Add fetch_bill_actions task with pagination and idempotent upsert
- Add fetch_actions_for_active_bills nightly batch (4 AM UTC beat schedule)
- Wire fetch_bill_actions into new-bill creation and _update_bill_if_changed
- Add backfill_brief_citations task: detects pre-citation briefs by JSONB
type check, deletes them, re-queues LLM processing against stored text
(LLM calls only — zero Congress.gov or GovInfo calls)
- Add admin endpoints: POST /bills/{id}/reprocess, /backfill-citations,
/trigger-fetch-actions; add uncited_briefs count to /stats
Frontend:
- New BriefPanel component: wraps AIBriefCard, adds amber "What Changed"
badge for amendment briefs and collapsible version history with
inline brief expansion
- Swap AIBriefCard for BriefPanel on bill detail page
- Admin panel: Backfill Citations + Fetch Bill Actions buttons; amber
warning in stats when uncited briefs remain
- Add feature roadmap document with phased plan through Phase 5
Co-Authored-By: Jack Levy
This commit is contained in:
81
PocketVeto — Feature Roadmap.md
Normal file
81
PocketVeto — Feature Roadmap.md
Normal file
@@ -0,0 +1,81 @@
|
||||
## Roadmap
|
||||
|
||||
- [x] Docker Stack — PostgreSQL, Redis, FastAPI, Celery, Next.js, Nginx fully containerized
|
||||
- [x] Bill Polling — Congress.gov incremental sync every 30 min, filtered to legislation that can become law
|
||||
- [x] Document Fetching — GovInfo bill text retrieval with smart truncation for token budgets
|
||||
- [x] LLM Analysis — Multi-provider AI briefs (OpenAI, Anthropic, Gemini, Ollama) with amendment diffing
|
||||
- [x] News Correlation — NewsAPI + Google News RSS articles linked to bills via topic tags
|
||||
- [x] Trend Scoring — Composite zeitgeist score (0–100) from NewsAPI + Google News + Google Trends, nightly
|
||||
- [x] Full-text Search — PostgreSQL tsvector search across bills and members
|
||||
- [x] Follows — Per-user follows for bills, members, and topics
|
||||
- [x] Dashboard — Personalized feed + trending bills
|
||||
- [x] Multi-user Auth — JWT email/password auth, admin role, user management panel
|
||||
- [x] Admin Panel — LLM provider switching, pipeline stats, manual task triggers
|
||||
- [x] Citations — Every AI brief key point and risk cites the section + verbatim quote from bill text
|
||||
- [x] Citation UI — § chips expand inline to show quote + GovInfo source link
|
||||
- [x] Party Badges — Solid red/blue/slate badges readable in light and dark mode
|
||||
- [x] Nginx DNS Fix — Resolver directive prevents stale-IP 502s after container restarts
|
||||
- [x] Sponsor Linking — Poller fetches bill detail for sponsor; backfill task fixes existing bills
|
||||
- [x] Member Search — "First Last" and "Last, First" both match via PostgreSQL split_part()
|
||||
- [x] Search Spaces — Removed .trim() on keystroke that ate spaces in search inputs
|
||||
- [x] Mobile UI — Responsive layout: sidebar collapses, cards stack, touch-friendly controls
|
||||
- [x] Member BIO & Photo — Display member headshots (photo_url already stored, not yet shown in UI)
|
||||
- [x] Bill Action Fetching — BillAction table populated via Congress.gov actions endpoint; nightly batch + event-driven on bill change
|
||||
- [x] What Changed (Amendment Briefs) — BriefPanel surfaces amendment briefs with "What Changed" badge and collapsible version history
|
||||
- [x] Source Viewer — "View source" link in § citation popover opens GovInfo document in new tab (Option A; Option B = in-app highlighted viewer deferred pending UX review)
|
||||
- [x] Admin Reprocess — POST /api/admin/bills/{bill_id}/reprocess queues document + action fetches for a specific bill
|
||||
|
||||
---
|
||||
|
||||
## To Do
|
||||
|
||||
---
|
||||
|
||||
### Phase 1 — Notifications Plumbing *(prerequisite for Alerts and Weekly Digest)*
|
||||
|
||||
- [ ] `notification_events` table — `(user_id, bill_id, event_type, payload, dispatched_at)`
|
||||
- [ ] ntfy dispatch — Celery task POSTs to user's ntfy topic URL; user supplies their own topic URL (public ntfy.sh or self-hosted ntfy server with optional auth token)
|
||||
- [ ] RSS feed — tokenized per-user feed at `/api/feed/{token}.xml`; token stored on user row
|
||||
- [ ] User settings UI — ntfy topic URL field + optional ntfy auth token + RSS feed link/copy button
|
||||
|
||||
---
|
||||
|
||||
### Phase 2 — High Impact *(can run in parallel after Phase 1)*
|
||||
|
||||
- [ ] **Change-driven Alerts** — emit `notification_event` from poller/document fetcher on material changes: new doc version, substitute text, committee report, vote scheduled/result. Filter out procedural-only action text. Fan out to ntfy + RSS.
|
||||
- [ ] **Fact vs Inference Labeling** — add `label: "cited_fact" | "inference"` + optional `confidence` field to each `key_point` and `risk` in the LLM JSON schema. Prompt engineering change + BillBrief schema migration. UI: small badge on each bullet (no color politics — neutral labels only).
|
||||
|
||||
---
|
||||
|
||||
### Phase 3 — Personal Workflow
|
||||
|
||||
- [ ] **Collections / Watchlists** — `collections` (id, user_id, name, slug, is_public) + `collection_bills` join table. UI to create/manage collections and filter dashboard by collection. Shareable via public slug URL (read-only for non-owners).
|
||||
- [ ] **Personal Notes** — `bill_notes` table (user_id, bill_id, content, stance, tags, pinned). Shown on bill detail page. Private; optionally pin to top of the bill detail view.
|
||||
- [ ] **Shareable Links** — UUID token on briefs and collections → public read-only view, no login required. Same token system for both. No expiry by default. UUID (not sequential) to prevent enumeration.
|
||||
- [ ] **Weekly Digest** — Celery beat task (weekly), queries followed bills for changes in the past 7 days, formats a low-noise summary, dispatches via ntfy + RSS.
|
||||
|
||||
---
|
||||
|
||||
### Phase 4 — Accountability
|
||||
|
||||
- [ ] **Votes & Committees** — fetch roll-call votes and committee referrals/actions from Congress.gov. New `bill_votes` table. UI: timeline entries for committee actions (already partially populated from bill actions) + vote results filterable by followed members and topics.
|
||||
- [ ] **Member Effectiveness Score** — nightly Celery task; transparent formula: sponsored bills count, bills advanced through stages, co-sponsored, committee participation, "bills enacted" metric. Stored in `member_scores` table. Displayed on member profile with formula explanation.
|
||||
- [ ] **Representation Alignment View** — for each followed member, show how their votes and actions align with the user's followed topics. Based purely on followed members (no ZIP/district storage). Neutral presentation — no scorecard dunking.
|
||||
|
||||
---
|
||||
|
||||
### Phase 5 — Polish *(slot in anytime, independent)*
|
||||
|
||||
- [ ] **Search Improvements** — filters on global search (bill type, status, chamber, date range); search within a member's sponsored bills; topic-scoped search.
|
||||
- [ ] **Desktop View** — wider multi-column layout optimized for large screens (sticky sidebar, expanded grid, richer bill detail layout).
|
||||
- [ ] **Brief Regeneration UI** — admin button to delete existing briefs for a bill and re-queue LLM processing. Useful for improving citation/diff logic without a full re-poll. (Backend reprocess endpoint already exists.)
|
||||
- [ ] **first_name / last_name Backfill** — Celery task to populate empty first/last from stored "Last, First" `name` field via split.
|
||||
|
||||
---
|
||||
|
||||
### Later / Backlog
|
||||
|
||||
- [ ] **Notification Channels v2** — email (SMTP), Discord webhook, Telegram bot (after ntfy + RSS v1 ships)
|
||||
- [ ] **Source Viewer Option B** — in-app bill text viewer with cited passage highlighted and scroll-to-anchor. Deferred pending UX review of Option A (GovInfo link).
|
||||
- [ ] **Raw Diff Panel** — Python `difflib` diff between stored document versions, shown as collapsible "Raw Changes" below amendment brief. Zero API calls. Deferred — AI amendment brief is the primary "what changed" story.
|
||||
- [ ] **Shareable Collection Subscriptions** — "Follow this collection" mechanic so other users can subscribe to a public collection and get its bills added to their feed.
|
||||
Reference in New Issue
Block a user