Nason commited on
Commit
5d93294
·
verified ·
1 Parent(s): 551ff1a

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +97 -0
README.md ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ task_categories:
4
+ - tabular-classification
5
+ - tabular-regression
6
+ tags:
7
+ - campaign-finance
8
+ - fec
9
+ - elections
10
+ - political-donations
11
+ - pac
12
+ - lobbying
13
+ - duckdb
14
+ - government-data
15
+ - politics
16
+ - united-states
17
+ pretty_name: FEC Campaign Finance Database
18
+ size_categories:
19
+ - 100M<n<1B
20
+ ---
21
+
22
+ # FEC Campaign Finance Database
23
+
24
+ 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.
25
+
26
+ **297,272,747 rows** across **10 tables** covering candidates, committees, individual contributions, PAC spending, and more.
27
+
28
+ Built with [fec-database](https://github.com/ian-nason/fec-database).
29
+
30
+ ## Quick Start
31
+
32
+ ### DuckDB CLI
33
+
34
+ ```sql
35
+ INSTALL httpfs;
36
+ LOAD httpfs;
37
+ ATTACH 'https://huggingface.co/datasets/Nason/fec-database/resolve/main/fec.duckdb' AS fec (READ_ONLY);
38
+
39
+ -- Top presidential candidates by individual donations (2024 cycle)
40
+ SELECT c.CAND_NAME, c.CAND_PTY_AFFILIATION AS party,
41
+ SUM(i.TRANSACTION_AMT) AS total, COUNT(*) AS donations
42
+ FROM fec.individual_contributions i
43
+ JOIN fec.candidates c ON i.CMTE_ID = c.CAND_PCC AND i.cycle = c.cycle
44
+ WHERE i.cycle = 2024 AND c.CAND_OFFICE = 'P' AND i.TRANSACTION_AMT > 0
45
+ GROUP BY 1, 2 ORDER BY total DESC LIMIT 10;
46
+ ```
47
+
48
+ ### Python
49
+
50
+ ```python
51
+ import duckdb
52
+ con = duckdb.connect()
53
+ con.sql("INSTALL httpfs; LOAD httpfs;")
54
+ con.sql(\"\"\"
55
+ ATTACH 'https://huggingface.co/datasets/Nason/fec-database/resolve/main/fec.duckdb'
56
+ AS fec (READ_ONLY)
57
+ \"\"\")
58
+ con.sql("SELECT * FROM fec._metadata").show()
59
+ ```
60
+
61
+ DuckDB uses HTTP range requests, so only the pages needed for your query are downloaded.
62
+
63
+ ## Tables
64
+
65
+ | Table | Description | Rows | Cols | Cycles |
66
+ |-------|-------------|------|------|--------|
67
+ | `individual_contributions` | Every individual donation: name, employer, occupation, amount, date | 226,607,614 | 22 | 2004-2026 |
68
+ | `committee_to_committee` | Transfers between committees | 45,559,049 | 22 | 2004-2026 |
69
+ | `operating_expenditures` | Committee operating expenditures: payee, purpose, amount | 18,875,347 | 26 | 2004-2026 |
70
+ | `committee_contributions` | PAC/party contributions to candidates | 5,214,013 | 23 | 2004-2026 |
71
+ | `independent_expenditures` | Independent expenditures for/against candidates | 664,775 | 258 | 2010-2026 |
72
+ | `committees` | Committee master: name, type, party, treasurer, connected org | 183,599 | 16 | 2004-2026 |
73
+ | `candidate_committee_links` | Which committees are authorized by which candidates | 73,520 | 8 | 2004-2026 |
74
+ | `candidates` | Candidate master: name, party, office, state, district, status | 67,702 | 16 | 2004-2026 |
75
+ | `communication_costs` | Internal communications supporting/opposing candidates | 25,558 | 27 | 2010-2026 |
76
+ | `electioneering_communications` | Broadcast ads mentioning candidates near elections | 1,570 | 397 | 2010-2024 |
77
+
78
+ ## Pre-built Views
79
+
80
+ | View | Description |
81
+ |------|-------------|
82
+ | `v_candidate_totals` | Candidate fundraising totals from individual contributions |
83
+ | `v_top_donors` | Aggregated donor activity across all cycles |
84
+ | `v_pac_to_candidate` | PAC-to-candidate contributions with org names |
85
+ | `v_daily_donations` | Daily donation volume and amounts |
86
+
87
+ ## Data Source
88
+
89
+ [Federal Election Commission](https://www.fec.gov/data/browse-data/?tab=bulk-data). Bulk data files are public domain and updated weekly.
90
+
91
+ ## License
92
+
93
+ Database build code: MIT. Underlying data: public domain (U.S. government records).
94
+
95
+ ## GitHub
96
+
97
+ Full source code, build instructions, and example queries: [github.com/ian-nason/fec-database](https://github.com/ian-nason/fec-database)