vccs
Vue 3용 차트 컴포넌트 모음, Recharts에서 포팅
대통령 지지율, 일반 투표, 상원 선거 평균을 추적하는 도구
A polling-average tracker for presidential approval, the generic ballot, and Senate races. More to come, but to learn more read here: https://policyypeaches.substack.com/
데이터Python · CSSGitHub @Hijodeagua온라인운영자 미확인
써 보셨어요? 한 번만 눌러 주세요. 로그인은 필요 없어요.
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기Housing my own kinda version of 538
저장소 README에서 가져옴
README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
A Python-based election modeling and forecasting system that ingests polling data from multiple sources, computes weighted polling averages, and models election outcomes.README 전문 보기 ↗A Python-based election modeling and forecasting system that ingests polling data from multiple sources, computes weighted polling averages, and models election outcomes.
web/) that reads static JSON exported from the Python pipelinegit clone https://github.com/Hijodeagua/Election-models-by-Tre.git
cd Election-models-by-Tre
# Core + dev tools
pip install -e ".[dev]"
# Add PyMC for the state-space model (optional, ~500MB)
pip install -e ".[bayesian]"
Python 3.11+ required.
cp .env.example .env
# No API keys required for offline/CSV mode
# Add VOTEHUB_BASE_URL etc. only if you want live data fetching
# Standard weighted-average output (fast, uses bundled CSV data — no internet needed)
python scripts/run_models.py --offline
# Add Jackman state-space estimates with house-effect breakdown (~2 min, requires PyMC)
python scripts/run_models.py --offline --state-space
# Force the small hand-curated CSV fallback (5 polls per model — useful for smoke testing)
python scripts/run_models.py --source csv
pytest # 147 tests, ~8 seconds
pytest tests/test_models.py -v # just the polling engine tests
All fallback data lives in data/fallback/ and is committed to the repo — no downloads needed:
| File | Contents | Polls |
|---|---|---|
votehub_approval.csv | VoteHub approval polls, Jan 2025 – May 2026 | 683 |
votehub_generic_ballot.csv | VoteHub generic ballot polls | 344 |
silverb_approval.csv | Silver Bulletin snapshot (CLI benchmark only — not on the site) | daily |
silverb_generic_ballot.csv | Silver Bulletin snapshot (CLI benchmark only) | daily |
approval.csv / generic_ballot.csv / senate.csv | Hand-curated samples | 5 each |
Election Oracle — 2026-05-24
Presidential Approval N=683: Approve 40.3% [38.8–41.4] Net -15.9
Generic Ballot N=344: D 46.4% / R 41.1% D+5.3 → D 247 / R 188 seats
Senate (5 races): AZ Gallego +4.4 · GA Collins +1.0 · MI Peters +3.0 ...
State-space Approve: 39.5% [37.8, 40.9] σ_α=0.23pp/day
House effects (40 pollsters with |δ|>1.5pp):
InsiderAdvantage +6.6pp pro-Approve
AP-NORC -4.1pp pro-Disapprove
Quinnipiac -4.0pp pro-Disapprove
...
web/)A deployable Next.js 14 (App Router) static site that presents the trackers —
presidential approval (with a toggleable multi-model comparison chart), generic
ballot, Senate race cards (vibes toggle + market-odds chips), a Senate-control
simulation page, and a methodology page. It reads the static JSON files in
web/public/data/, which are produced by the Python pipeline; it runs no
Python server itself.
# 1. Regenerate the static JSON from the offline pipeline
python scripts/export_json.py
# 2. Build / run the front end
cd web
npm install
npm run dev # http://localhost:3000/election
npm run build # production build (static, prerendered)
The approval, generic-ballot, and race-level Senate pages are trackers: they
show weighted polling averages and confidence bands rather than election-day
predictions. The separate Senate Forecast page is a nowcast of where chamber
control stands today. It runs 50,000 simulations using race polling,
fundamentals, correlated polling error, fat-tailed uncertainty, and a transparent
prediction-market blend. It is not an election-day forecast and does not model
future campaign movement. The site is served under the /election base path
(see web/next.config.mjs).
.github/workflows/refresh_data.yml runs daily: it best-effort refreshes the
source CSVs, runs scripts/export_json.py, and commits the updated JSON. The
data refresh is offline-resilient — if a source is unreachable, the export falls
back to the committed CSVs in data/fallback/.
election-oracle/
├── config/ # Settings and pollster ratings
│ ├── settings.py # Pydantic-based configuration
│ └── pollster_ratings.json
├── src/
│ ├── data/ # Data source clients
│ │ ├── base.py # Abstract DataSource interface + Poll schema
│ │ ├── votehub.py # VoteHub API client (free, CC BY 4.0)
│ │ ├── rcp.py # RealClearPolitics scraper
│ │ ├── fiftyplusone.py # FiftyPlusOne API (paid, stub)
│ │ ├── silver_bulletin.py
│ │ └── congress_gov.py
│ ├── models/ # Election models
│ │ ├── polling_average.py # Core weighted average engine
│ │ ├── approval.py # Presidential approval model
│ │ ├── generic_ballot.py # Generic ballot + seat projection
│ │ ├── senate.py # Senate race models
│ │ ├── house.py # House race models
│ │ ├── governor.py # Governor race models
│ │ └── presidential.py # 2028 primary tracker
│ ├── analysis/ # Analytical utilities
│ │ ├── pollster_weights.py # Pollster rating management
│ │ ├── trend.py # Trend smoothing
│ │ ├── historical.py # Historical cycle comparisons
│ │ └── fundamentals.py # Non-polling fundamentals
│ ├── db/ # Database layer (SQLModel ORM)
│ │ └── models.py
│ └── dashboard/ # Streamlit dashboard
│ └── app.py
├── tests/ # Test suite
├── scripts/ # Data refresh and backfill scripts
├── notebooks/ # Jupyter exploration notebooks
└── data/ # Raw, processed, and historical data
The core engine (src/models/polling_average.py) computes weighted averages using:
| Source | Type | Cost | Status |
|---|---|---|---|
| VoteHub | API | Free (CC BY 4.0) | Implemented |
| RealClearPolitics | Scraper | Free | Implemented |
| FiftyPlusOne | API | $8/mo+ | Stub (adapter ready) |
| Silver Bulletin | CSV snapshot | Free | CLI benchmark only (removed from the site comparison — feed frozen) |
| Congress.gov | API | Free | Stub |
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Type checking
mypy src/
# Linting
ruff check .
All settings are managed via environment variables or .env file. See .env.example for available options.
Key polling average parameters are configurable in config/settings.py:
recency_half_life_days — how fast old polls decay (default: 14)lv_weight_multiplier — extra weight for likely voter polls (default: 1.5)partisan_bias_penalty — weight penalty for partisan polls (default: 0.5)MIT