CoolFace
Apppublic

VAILL/legislation-tracker

sourceHugging Faceupdated 1d agoView on Hugging Face
0likes
App README

AI Legislation Tracker (v2)

A modern Next.js + FastAPI rebuild of the Vanderbilt AI Law Lab's Streamlit legislation tracker. Tracks state and federal AI-related bills across the US, with an admin panel for running the weekly data pipeline and a subscriber newsletter.

What's inside

ai-legislation-tracker-v2/
├── Dockerfile                    # Multi-stage build for HF Docker Space
├── README.md                     # This file (+ HF Space frontmatter)
├── CLAUDE.md                     # Contributor rules
├── docs/                         # Long-form documentation
│   ├── ARCHITECTURE.md           # How the pieces fit together
│   ├── DEVELOPMENT.md            # Running the app locally
│   ├── DEPLOYMENT.md             # Pushing to the HF Space
│   ├── DATA.md                   # HF Dataset schema + sync behavior
│   ├── PIPELINE.md               # 14-step weekly data pipeline
│   └── API.md                    # HTTP endpoint reference
├── backend/                      # FastAPI + Python 3.11
│   ├── app/                      # Application code (routers, repos, services)
│   ├── data_updating_scripts/    # Pipeline scripts (get_data, summaries, …)
│   ├── vectorstore/              # Pinecone-backed bills vectorstore module
│   ├── update_data.py            # Pipeline orchestrator (CLI)
│   ├── scheduler.py              # Weekly Monday 7AM CT trigger
│   └── pyproject.toml
└── frontend/                     # Next.js 15 App Router + TypeScript
    ├── app/                      # Pages (public + admin)
    ├── components/               # Shared React components
    ├── lib/                      # API client + parsers
    └── package.json

Quick start (local)

bash
# Backend (Terminal 1)
cd backend
python -m venv .venv && source .venv/bin/activate
pip install -e .
cp .env.example .env    # fill in keys (see docs/DEVELOPMENT.md)
uvicorn app.main:app --reload --port 8000

# Frontend (Terminal 2)
cd frontend
npm install --legacy-peer-deps
cp .env.local.example .env.local
npm run dev             # http://localhost:3000

Admin login (local test password): ramanna / 123

See docs/DEVELOPMENT.md for details.

Docs at a glance

DocWhat's in it
ARCHITECTURE.mdFrontend/backend/Docker layout; request lifecycle; where HF Dataset fits in
DEVELOPMENT.mdLocal dev setup, .env variables, running the pipeline manually
DEPLOYMENT.mdDocker build; pushing to the HF Space; scheduler; secret management
DATA.mdHF Dataset files, sync behavior, adding new fields
PIPELINE.mdThe 14 pipeline steps in order, what each reads/writes
API.mdBackend endpoint reference (public + admin)
CLAUDE.mdContributor rules: no secrets, PR-only, branch naming

Feature list

Public site

  • Bills tab: 4,000+ tracked bills with state/status/year/category filters, fulltext search, CSV export, and a per-bill detail modal
  • Insights: choropleth map, top-N states, category breakdown, over-time charts
  • Calendar: monthly grid of legislative milestones; day cells open a full-day event modal; today is highlighted
  • Newsletter: weekly editorial digest with hero stat bar, Bill of the Week, Bills in Motion, Category Trends, State Spotlight, Coming Up · Next 7 Days
  • AI Tools: Q&A on individual bills, side-by-side compare, pre-generated reports, EU AI Act comparison
  • State Spotlight: featured state each week with key bills

Admin panel (/admin)

  • Overview stat cards
  • Users, Newsletter Subscribers, Feedback (with badge for unread)
  • Pipeline controls: full run, test mode, step range, single step, cancel, rebuild vectorstore manifest, live log tail, run history
  • Weekly Changes CSV viewer

Automation

  • Weekly pipeline runs every Monday at 7:00 AM US Central via a supervisord process inside the HF Space container
  • After each pipeline run, all data is uploaded back to the HF Dataset; on next container boot, the site pulls fresh data from HF

Stack

  • Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS, recharts, react-simple-maps, d3-scale
  • Backend: Python 3.11, FastAPI, Pydantic v2, LangChain, FAISS, Pinecone
  • Auth: file-based bcrypt (users.json synced from HF)
  • Data: HuggingFace Dataset (JSON files, weekly CSVs, snapshots)
  • AI: OpenAI (GPT-4o for report generation, text-embedding-3-small for vectors)
  • External APIs: LegiScan, SendGrid, HuggingFace Hub
  • Deploy: HuggingFace Docker Space (single container, supervisord)

Contributing

Read CLAUDE.md first. Short version: never commit secrets, never push to main, use feature/, fix/, chore/, docs/ branch prefixes, open a PR.