File size: 5,444 Bytes
5d93294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ce87deb
5d93294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51a1c6e
 
 
 
ce87deb
51a1c6e
 
 
ce87deb
51a1c6e
5d93294
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9b3e158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
---
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).