fec-database / README.md
Nason's picture
Add July 2026 refresh changelog to dataset card
9b3e158 verified
|
Raw
History Blame Contribute Delete
5.44 kB
---
license: mit
task_categories:
- tabular-classification
- tabular-regression
tags:
- campaign-finance
- fec
- elections
- political-donations
- pac
- lobbying
- duckdb
- government-data
- politics
- united-states
pretty_name: FEC Campaign Finance Database
size_categories:
- 100M<n<1B
---
# FEC Campaign Finance Database
A clean, queryable DuckDB database built from [FEC bulk data](https://www.fec.gov/data/browse-data/?tab=bulk-data) covering federal campaign finance filings.
**347,171,337 rows** across **10 tables** covering candidates, committees, individual contributions, PAC spending, and more.
Built with [fec-database](https://github.com/ian-nason/fec-database).
## Quick Start
### DuckDB CLI
```sql
INSTALL httpfs;
LOAD httpfs;
ATTACH 'https://huggingface.co/datasets/Nason/fec-database/resolve/main/fec.duckdb' AS fec (READ_ONLY);
-- Top presidential candidates by individual donations (2024 cycle)
SELECT c.CAND_NAME, c.CAND_PTY_AFFILIATION AS party,
SUM(i.TRANSACTION_AMT) AS total, COUNT(*) AS donations
FROM fec.individual_contributions i
JOIN fec.candidates c ON i.CMTE_ID = c.CAND_PCC AND i.cycle = c.cycle
WHERE i.cycle = 2024 AND c.CAND_OFFICE = 'P' AND i.TRANSACTION_AMT > 0
GROUP BY 1, 2 ORDER BY total DESC LIMIT 10;
```
### Python
```python
import duckdb
con = duckdb.connect()
con.sql("INSTALL httpfs; LOAD httpfs;")
con.sql(\"\"\"
ATTACH 'https://huggingface.co/datasets/Nason/fec-database/resolve/main/fec.duckdb'
AS fec (READ_ONLY)
\"\"\")
con.sql("SELECT * FROM fec._metadata").show()
```
DuckDB uses HTTP range requests, so only the pages needed for your query are downloaded.
## Tables
| Table | Description | Rows | Cols | Cycles |
|-------|-------------|------|------|--------|
| `individual_contributions` | Every individual donation: name, employer, occupation, amount, date | 275,049,839 | 22 | 2004-2026 |
| `committee_to_committee` | Transfers between committees | 46,486,423 | 22 | 2004-2026 |
| `operating_expenditures` | Committee operating expenditures: payee, purpose, amount | 19,413,938 | 26 | 2004-2026 |
| `committee_contributions` | PAC/party contributions to candidates | 5,261,682 | 23 | 2004-2026 |
| `independent_expenditures` | Independent expenditures for/against candidates | 596,985 | 24 | 2010-2026 |
| `committees` | Committee master: name, type, party, treasurer, connected org | 184,883 | 16 | 2004-2026 |
| `candidates` | Candidate master: name, party, office, state, district, status | 76,279 | 16 | 2004-2026 |
| `candidate_committee_links` | Which committees are authorized by which candidates | 74,141 | 8 | 2004-2026 |
| `communication_costs` | Internal communications supporting/opposing candidates | 25,590 | 26 | 2010-2026 |
| `electioneering_communications` | Broadcast ads mentioning candidates near elections | 1,577 | 20 | 2010-2026 |
## Pre-built Views
| View | Description |
|------|-------------|
| `v_candidate_totals` | Candidate fundraising totals from individual contributions |
| `v_top_donors` | Aggregated donor activity across all cycles |
| `v_pac_to_candidate` | PAC-to-candidate contributions with org names |
| `v_daily_donations` | Daily donation volume and amounts |
## Data Source
[Federal Election Commission](https://www.fec.gov/data/browse-data/?tab=bulk-data). Bulk data files are public domain and updated weekly.
## License
Database build code: MIT. Underlying data: public domain (U.S. government records).
## GitHub
Full source code, build instructions, and example queries: [github.com/ian-nason/fec-database](https://github.com/ian-nason/fec-database)
# Changelog
## 2026-07-06 — Full refresh + data-quality audit
Rebuilt from current FEC bulk downloads (cycles 2004-2026) and repaired
after an independent SQL-verified audit.
**Data changes**
- 347,171,337 rows across 10 tables (previous published build: 339.5M).
- Cycle 2020 individual contributions complete at 69,352,160 rows.
- `independent_expenditures`: 74,030 superseded amendment versions removed —
only the latest version of each filing is kept (2022 IE total dropped from
$46.9B to $33.6B; remaining inflation is upstream prank filings, see
caveats).
**Fixes**
- Standalone-table dates now parse (previously 100% NULL):
`independent_expenditures` (DD-MON-YY), `communication_costs` (YYYYMMDD),
`electioneering_communications` (DD-MON-YY, amounts now numeric).
- All four views rebuilt with correct money semantics: conduit rows
(`TRANSACTION_TP = '24T'`, the ActBlue/WinRed double count worth 14-22% of
every cycle since 2018) excluded; refunds (20Y/21Y/22Y, stored as positive
amounts) netted out; memo rows excluded.
- `v_candidate_totals` aggregates per principal campaign committee, so
candidates sharing a committee (Biden/Harris 2024) no longer fan out into
double-counted rows.
- `v_pac_to_candidate` is direct contributions only (24K/24Z) — it
previously counted independent expenditures *against* a candidate as
support.
**Known caveats** (see the README's "How to sum money correctly")
- Upstream prank filings remain in `independent_expenditures` (e.g. a $10B
"COMMITTEE 300" row) — treat amounts above ~$5M as suspect anywhere.
- A few thousand rows carry wild dates (years 0677-9206); clamp to the
cycle window before bucketing.
- Recent-cycle `committee_contributions.CAND_ID` values fail to resolve to
same-cycle candidates at 1-5% (FEC master-file churn).