Commit Graph

16 Commits

Author SHA1 Message Date
Jack Levy
b57833d4b7 fix(news): robust gnews URL extraction + smarter lazy trigger
- Replace fragile entry.get("link") with _gnews_entry_url() helper that
  checks entry.link attribute then falls back to entry.links[].href,
  fixing cases where feedparser puts the URL in a non-standard location
- Lazy news re-fetch on bill detail now only triggers when the stored
  trend score confirms gnews_count > 0, preventing endless re-queuing
  for bills with genuinely no news coverage

Co-Authored-By: Jack Levy
2026-03-01 00:49:02 -05:00
Jack Levy
50f93468db fix(news): per-bill URL dedup + lazy re-fetch on bill detail load
- Drop global unique constraint on news_articles.url; replace with
  (bill_id, url) so the same article can appear for multiple bills
- news_fetcher dedup now scoped to bill_id instead of global URL
- Bill detail endpoint triggers a background news fetch when no
  articles are stored, so gnews articles surface on next load

Migration 0009.

Co-Authored-By: Jack Levy
2026-03-01 00:43:10 -05:00
Jack Levy
a66b5b4bcb feat(interest): add public interest tracking for members of Congress
Adds Google Trends, NewsAPI, and Google News RSS scoring for members,
mirroring the existing bill interest pipeline. Member profiles now show
a Public Interest chart (with signal breakdown) and a Related News panel.

Key changes:
- New member_trend_scores + member_news_articles tables (migration 0008)
- fetch_gnews_articles() added to news_service for unlimited RSS article storage
- Bill news fetcher now combines NewsAPI + Google News RSS (more coverage)
- New member_interest Celery worker with scheduled news + trend tasks
- GET /members/{id}/trend and /news API endpoints
- TrendChart redesigned with signal breakdown badges and bar+line combo chart
- NewsPanel accepts generic article shape (bills and members)

Co-Authored-By: Jack Levy
2026-03-01 00:36:30 -05:00
Jack Levy
e21eb21acf feat(members): add full member bio, contact info, and service history
Lazy-enriches member profiles on first view via Congress.gov detail API.
Adds office address, phone, official website, congress.gov link, birth
year, terms history, leadership roles, and sponsored/cosponsored counts.
Includes DB migration 0007 for new member columns.

Co-Authored-By: Jack Levy
2026-03-01 00:14:16 -05:00
Jack Levy
37339d6950 feat(ui): add mobile-responsive layout with hamburger drawer
Adds MobileHeader with hamburger button (left-aligned) that opens a
slide-in sidebar drawer on mobile. Desktop layout is unchanged. All
hardcoded multi-column grids updated with responsive Tailwind breakpoints.

Co-Authored-By: Jack Levy
2026-02-28 23:58:28 -05:00
Jack Levy
a8bc20e187 docs: update architecture for v0.2.2 fixes
Documents sponsor linking fix, backfill task, member name search
split_part approach, search spaces fix, and eager loading fix.

Authored-By: Jack Levy
2026-02-28 23:31:35 -05:00
Jack Levy
13e1577968 fix(members): link sponsors to bills and fix member search
- Poller now fetches bill detail on insert to get sponsor (list endpoint
  has no sponsor data)
- Add backfill_sponsor_ids task + admin endpoint + UI button to fix the
  1,616 existing bills with NULL sponsor_id
- Member name search now matches both "Last, First" and "First Last"
  using split_part() on the stored name column; same fix applied to
  global search
- Load Bill.sponsor relationship eagerly in get_member_bills to prevent
  MissingGreenlet error during Pydantic serialization
- Remove .trim() on search onChange so spaces can be typed

Authored-By: Jack Levy
2026-02-28 23:29:58 -05:00
Jack Levy
795385dcba docs: add comprehensive architecture documentation
Covers full stack, database schema, API endpoints, Celery pipeline,
LLM service design, frontend structure, auth, deployment, and feature
history through v0.2.0.

Authored-By: Jack Levy
2026-02-28 23:07:43 -05:00
Jack Levy
a111731cb4 fix(tailwind): add lib/ to content scan so utils.ts classes aren't purged
Party badge colors defined in lib/utils.ts were being stripped from the
production CSS bundle because the lib/ directory was missing from the
Tailwind content glob.

Authored-By: Jack Levy
2026-02-28 22:59:36 -05:00
Jack Levy
5cc6d13b3b fix(ui): use solid party badge colors readable in light and dark mode
Replaces light/dark variant classes (which produced unreadable pale pink
in dark mode) with solid saturated colors: red-600 for Republicans,
blue-600 for Democrats, slate-500 for Independents — all with white text.

Authored-By: Jack Levy
2026-02-28 22:57:10 -05:00
Jack Levy
e91e202eb4 fix(nginx): add Docker DNS resolver to prevent stale upstream IPs
Without resolver 127.0.0.11, nginx caches upstream IPs at startup and
returns 502 after container restarts until manually reloaded.

Authored-By: Jack Levy
2026-02-28 22:51:46 -05:00
Jack Levy
8d6a55905c feat(citations): add per-claim citations to AI briefs
LLM prompts updated to output {text, citation, quote} objects for every
key_point and risk. govinfo_url stored on BillBrief (migration 0006) so
the frontend can link directly to the source document without an extra
query. AIBriefCard renders § citation chips that expand inline to show
the verbatim quote and a View source → GovInfo link. Old plain-string
briefs continue to render unchanged.

Authored-By: Jack Levy
2026-02-28 22:48:58 -05:00
Jack Levy
6a1b387dd2 Add analysis status panel to admin page
- GET /api/admin/stats returns total bills, docs fetched, briefs generated
  (full + amendment), and remaining count
- Admin page shows stat cards + progress bar, auto-refreshes every 30s

Authored-By: Jack Levy
2026-02-28 22:25:49 -05:00
Jack Levy
c48241fe2f Limit bills to last 2 months + filter out procedural resolutions
- Drop hres/sres/hconres/sconres (simple/concurrent resolutions) from poller;
  only track hr, s, hjres, sjres (legislation that can become law)
- On first run, seed from 60 days back instead of full congress history,
  keeping the bill count to ~1,600 instead of 13,000+

Authored-By: Jack Levy
2026-02-28 22:21:34 -05:00
Jack Levy
5b73b60d9e Add multi-user auth system and admin panel
- User model with email/hashed_password/is_admin/notification_prefs
- JWT auth: POST /api/auth/register, /login, /me
- First registered user auto-promoted to admin
- Migration 0005: users table + user_id FK on follows (clears global follows)
- Follows, dashboard, settings, admin endpoints all require authentication
- Admin endpoints (settings writes, celery triggers) require is_admin
- Frontend: login/register pages, Zustand auth store (localStorage persist)
- AuthGuard component gates all app routes, shows app shell only when authed
- Sidebar shows user email + logout; Admin nav link visible to admins only
- Admin panel (/settings): user list with delete + promote/demote, LLM config,
  data source settings, and manual celery controls

Authored-By: Jack Levy
2026-02-28 21:44:34 -05:00
Jack Levy
e418dd9ae0 Initial commit 2026-02-28 21:08:19 -05:00