A public, national (US) site that tracks the issues most impacting the country as living figures, not posts. Each tracker shows a current number, whether it is moving, how fresh the data is, and community-submitted actions people can take. The promise: you can see whether the number moved, and whether the public's effort had anything to do with it.
Spec: see the product & technical spec this was built from. Build order was followed as
written: adapters were run live before any UI was built (docs/source_reality.md).
backend/ FastAPI + SQLAlchemy + Alembic. Adapters, nightly job, ranking, auth, admin.
frontend/ React + Vite + TypeScript. Feed, tracker cards, action modals, forms, admin.
docs/ source_reality.md: what each upstream feed actually returns and how stale it is.
cp .env.example .env # fill in keys you have; none are required for dev
cd backend
uv sync --extra dev
uv run alembic upgrade head
ADMIN_EMAIL=you@example.com ADMIN_PASSWORD='pick one' uv run python -m app.cli seed
uv run uvicorn app.main:app --reload # http://localhost:8000 (docs at /docs)
cd ../frontend
npm install
npm run dev # http://localhost:5173, proxies /api -> :8000seed creates the starting sources and trackers, fetches each source once, backfills the
publisher's own back-series so trends and sparklines are real, and publishes only the trackers
that got a number. Sources whose key is missing (Census, FBI) or that are manual-entry
(Mapping Police Violence) stay approved and unpublished: no source, no number, no card.
cd backend && uv run python -m app.cli nightlyFor each source: fetch, compare with the last recorded figure, append to figure_history
only if it changed, update the source's freshness fields (last_checked_at,
last_changed_at, last_fetch_status, staleness_reason), then recompute ranking. Run it
from cron, or set SCHEDULER_ENABLED=1 to run it in-process at NIGHTLY_HOUR_UTC.
figure_history rows can never be updated or deleted (enforced in the ORM).
Other commands: probe-source <adapter> '<json config>', backfill <source_id>,
create-admin <email> <password>, list-adapters, init-db.
- Cards show the publisher's release date and the period the figure covers, never our fetch
date.
staleness_reasonexplains why a figure hasn't moved, including overdue releases. - A failed fetch keeps the last good figure and shows "Couldn't reach {source} on {date}".
- Adapters never compute a number the source didn't publish. Census uses published rates, not count ratios. Manual sources say they were entered by hand.
- Publishing requires a source, an editorial reason, a direction of harm, and a fetched figure.
- Write an adapter in
backend/app/adapters/subclassingSourceAdapter, register it, and run it live withprobe-source. Record what it returns indocs/source_reality.md. - In the admin UI (Source health), add the source with its adapter config, fetch it, and backfill if the publisher offers a back-series.
- Attach it to the tracker in the issue queue, set the editorial reason and direction of harm, publish.
If a source has no API, use the manual adapter: an admin enters the value, period, release
date, and provenance, and the card says so.
score = w_harm·harm_norm + w_trend·trend_term + w_fresh·freshness_norm + w_signal·signal_norm
over published trackers. Weights live in backend/ranking.toml (env RANKING_W_* overrides).
Worsening figures rank up, improving ones drift down. The admin ranking audit shows every
component of every score.
cd backend && uv run pytest # offline: fixtures, trend matrix, nightly, privacy, admin gate
cd backend && uv run pytest -m live # hits real APIs; skips cleanly without keys or quota
cd frontend && npm test && npm run buildSubmitters choose: publish my name, publish as a named nominee, or anonymous (default: unattributed). Public endpoints and public API responses never carry account data; admin views do. Users change attribution any time from their submissions page.