fec-database / README.md
Nason's picture
Upload README.md with huggingface_hub
1928522 verified
|
Raw
History Blame Contribute Delete
6.9 kB
metadata
license: other
license_name: public-domain
license_link: https://www.fec.gov/data/browse-data/?tab=bulk-data
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 covering federal campaign finance filings.

354,943,430 rows across 10 tables covering candidates, committees, individual contributions, PAC spending, and more.

Built with fec-database.

Quick Start

DuckDB CLI

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

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 280,827,680 22 2004-2026
committee_to_committee Transfers between committees 48,118,471 22 2004-2026
operating_expenditures Committee operating expenditures: payee, purpose, amount 19,725,971 26 2004-2026
committee_contributions PAC/party contributions to candidates 5,304,857 23 2004-2026
independent_expenditures Independent expenditures for/against candidates 602,587 24 2010-2026
committees Committee master: name, type, party, treasurer, connected org 185,471 16 2004-2026
candidates Candidate master: name, party, office, state, district, status 76,692 16 2004-2026
candidate_committee_links Which committees are authorized by which candidates 74,481 8 2004-2026
communication_costs Internal communications supporting/opposing candidates 25,631 26 2010-2026
electioneering_communications Broadcast ads mentioning candidates near elections 1,589 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. 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

Changelog

2026-09-14 — Data refresh (FEC bulk files as of 2026-09-14)

  • Rebuilt from the FEC bulk downloads for all 12 cycles (2004-2026). Total rows 347,171,337 → 354,943,430: individual_contributions 280,827,680, committee_to_committee 48,118,471, operating_expenditures 19,725,971, committee_contributions 5,304,857, independent_expenditures 602,587 (74,486 superseded amendment versions removed at build time).
  • The July audit's repairs are now regression checks in the build: standalone table dates > 85% non-null, CALCULATED_CANDIDATE_SHARE typed DOUBLE, one v_candidate_totals row per (cycle, committee), v_pac_to_candidate limited to 24K/24Z, conduit (24T) rows excluded from totals, and all 12 cycles present (a silently skipped download would otherwise drop a cycle). A failing check aborts the build with a non-zero exit.
  • DuckDB memory capped (default 6 GB, run at 4 GB / 2 threads for this build) with DATAPOND_MEMORY_LIMIT / DATAPOND_THREADS overrides; continue_build.py uses the same settings. File size 37.7 → 35.2 GB (insertion order no longer preserved, which compresses better). publish_to_hf.py --card-only.
  • Caveats unchanged: prank filings remain (treat single contributions > $5M as suspect); upstream dates range from year 0677 to 9206; CAND_ID resolves for ~95-99% of rows.

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).