How callum-doty/campaign-allocation works
Campaign Allocation is a research and decision-support pipeline for House campaign spending. Its main workflow fetches public election and finance data, assembles race-level features, forecasts outcomes, then evaluates and reallocates committee budgets; backtests compare those decisions with actual spending. Separate analyses cover spending timing, media markets and channels, national polling and household stress, and the 2026 map. The graph follows the documented runner and sampled source relationships; some analytical modules are represented by their exact paths, but their internal calls were not sampled.
Main entry points: run.py Pipeline runner · report.py Report and figures · backtest.py Cycle backtests · build_races.py Race features
Components 22
Data and features
- Fetch public data
campaign/fetch.py - Election results
campaign/load_results.py - Candidate nominees
campaign/load_candidates.py - Challenger quality
campaign/lookup_quality.py - Outside spending
campaign/load_expenditures.py - Race features
campaign/build_races.py
Forecasting
- Baseline model
campaign/fit_baseline.py - Margin prediction
campaign/predict_margin.py - 2026 forecast
campaign/forecast.py - Dated forecasts
campaign/dated_forecast.py - Cycle backtests
campaign/backtest.py
Spending analysis
- Budget allocation
campaign/allocate.py - Committee game
campaign/solve_game.py - Coordinated allocation
campaign/coordinated_allocation.py - Ballot timing
campaign/ballot_timing.py - Channel mix
campaign/channel_mix.py - Media costs
campaign/media_cost.py
Reports and insights
- Household stress
campaign/household_index.py - National polling tests
campaign/national_vote.py - Report and figures
campaign/report.py
Other components
- Analyst
- Pipeline runner
run.py
Connections 26
- Analyst → Pipeline runner: runs pipeline
run.py - Pipeline runner → Fetch public data: fetches data
run.py - Pipeline runner → Race features: builds races
run.py - Pipeline runner → Cycle backtests: backtests cycles
run.py - Pipeline runner → Committee game: solves game
run.py - Pipeline runner → Channel mix: analyzes channels
run.py - Pipeline runner → Media costs: prices media
run.py - Pipeline runner → 2026 forecast: forecasts cycle
run.py - Pipeline runner → National polling tests: tests polling
run.py - Pipeline runner → Report and figures: writes report
run.py - Race features → Election results: loads results
campaign/build_races.py - Race features → Candidate nominees: loads nominees
campaign/build_races.py - Race features → Outside spending: loads spending
campaign/build_races.py - Candidate nominees → Challenger quality: checks nominees
campaign/load_candidates.py - Cycle backtests → Baseline model: fits model
campaign/backtest.py - Cycle backtests → Margin prediction: predicts margins
campaign/backtest.py - Cycle backtests → Dated forecasts: scores checkpoints
campaign/backtest.py - Cycle backtests → Ballot timing: evaluates timing
campaign/backtest.py - Cycle backtests → Budget allocation: compares budgets
- 2026 forecast → Race features: uses race features
- Report and figures → Channel mix: reports mix
campaign/report.py - Report and figures → Household stress: reports stress
campaign/report.py - Report and figures → Ballot timing: reports timing
campaign/report.py - Report and figures → Media costs: reports costs
campaign/report.py - Report and figures → Committee game: reports equilibrium
- Report and figures → Coordinated allocation: reports allocation