Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
| # Political Finance Data Integration - Quick Start | |
| ## π Overview | |
| You now have **3 major data integrations** that work together to reveal political connections in civic engagement: | |
| 1. **Grants.gov API** - Federal grant opportunities (FUTURE funding) | |
| 2. **FEC Political Contributions** - Campaign donations (POLITICAL connections) | |
| 3. **Voter Data** - Political demographics (CONTEXT) | |
| Combined with your existing **IRS Form 990 data** (PAST funding), you have the most comprehensive political-financial tracking system for civic engagement. | |
| ## π The Complete Data Ecosystem | |
| ``` | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| β YOUR COMPLETE DATA ECOSYSTEM β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€ | |
| β β | |
| β EXISTING DATA NEW INTEGRATIONS β | |
| β ββββββββββββββ ββββββββββββββββ β | |
| β β | |
| β IRS 990 Grants.gov β | |
| β β’ 3M+ nonprofits βββ> β’ Federal grant opportunities β | |
| β β’ $800k grants β’ Application deadlines β | |
| β β’ Officers β’ Award amounts β | |
| β β’ Financials β’ Eligibility β | |
| β β β | |
| β Jurisdictions β FEC β | |
| β β’ 90k+ cities βββββββββββ΄βββ> β’ Political donations β | |
| β β’ Meeting minutes β’ Donor employers β | |
| β β’ Contact info β’ Recipients β | |
| β β’ Demographics β’ Amounts & dates β | |
| β β β | |
| β β β | |
| β Voter Data β | |
| β β’ Party affiliation β | |
| β β’ Elected officials β | |
| β β’ Turnout β | |
| β β | |
| β COMBINED ANALYSIS: β | |
| β β€ Political influence on grant awards β | |
| β β€ Donor networks in health policy β | |
| β β€ Partisan patterns in funding β | |
| β β€ Timeline: Donation β Policy β Grant β | |
| β β | |
| ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | |
| ``` | |
| ## β‘ Quick Start | |
| ### 1. Get API Keys (5 minutes) | |
| **FEC API** (Required for political data): | |
| ```bash | |
| # Get free API key at: | |
| https://api.data.gov/signup/ | |
| # Enter email β Receive key instantly | |
| # Or use DEMO_KEY for testing (limited) | |
| ``` | |
| **Other APIs** (Optional): | |
| - OpenStates (state legislators): https://openstates.org/accounts/profile/ | |
| - Google Civic (local officials): https://console.cloud.google.com | |
| ### 2. Test Integrations | |
| **Test Grants.gov** (no key required): | |
| ```bash | |
| python examples/demo_grants_gov.py | |
| ``` | |
| Output: Federal oral health grant opportunities β `data/gold/grants/` | |
| **Test FEC** (requires API key): | |
| ```bash | |
| python examples/demo_political_influence.py --api-key YOUR_FEC_KEY | |
| ``` | |
| Output: Political contributions from health sector β `data/gold/fec/` | |
| ### 3. Run Complete Analysis | |
| ```bash | |
| # 1. Generate grant opportunities | |
| python examples/demo_grants_gov.py | |
| # 2. Find political connections | |
| python examples/demo_political_influence.py --api-key YOUR_FEC_KEY | |
| # 3. Match to your nonprofits (if you have officer data) | |
| python discovery/fec_integration.py \ | |
| --api-key YOUR_FEC_KEY \ | |
| --state MA \ | |
| --employer "health" | |
| ``` | |
| ## π Documentation | |
| ### Integration Guides | |
| 1. **[Grants.gov API](../website/docs/integrations/grants-gov-api.md)** | |
| - Federal grant opportunities | |
| - No API key required | |
| - Search by keyword, agency, funding category | |
| - Match to eligible nonprofits | |
| 2. **[FEC Political Contributions](../website/docs/integrations/fec-political-contributions.md)** | |
| - Individual campaign donations | |
| - Free API key required | |
| - Link to nonprofit employers | |
| - Track political influence | |
| 3. **Voter Data Integration** | |
| - Political demographics | |
| - Elected officials | |
| - State-specific sources | |
| - Commercial vendors (L2, Aristotle) | |
| ### Example Analyses | |
| - **[Political Influence Integration](POLITICAL_INFLUENCE_INTEGRATION.md)** - Complete analysis examples | |
| - **[Grants.gov Value](GRANTS_GOV_VALUE.md)** - Data comparison and ROI | |
| ## π― Use Cases | |
| ### 1. Grant Opportunity Alerts | |
| **Before**: Nonprofits miss deadlines | |
| **After**: Automated alerts | |
| ``` | |
| "NEW Grant Alert: HRSA Oral Health Workforce Development" | |
| β’ Award: $500k-$2M | |
| β’ Deadline: Dec 31, 2024 | |
| β’ Your organization is eligible! | |
| β’ Similar MA orgs received avg $800k from this program | |
| ``` | |
| ### 2. Political Transparency | |
| **Before**: Hidden connections | |
| **After**: Public disclosure | |
| ``` | |
| Political Connections: | |
| β’ 2 officers made political donations | |
| β’ Total: $8,500 (2024 cycle) | |
| β’ Recipients: Sen. Warren (D), Rep. Kennedy (D) | |
| β’ Federal grants received: $800,000 (2023) | |
| ``` | |
| ### 3. Influence Analysis | |
| **Before**: Speculation about political influence | |
| **After**: Data-driven analysis | |
| ``` | |
| Research Finding: | |
| β’ Nonprofits with politically active leaders: $450k avg grant | |
| β’ Nonprofits without political activity: $280k avg grant | |
| β’ Difference: $170k (p < 0.05) | |
| β’ Context: Many factors influence grants | |
| ``` | |
| ### 4. Partisan Patterns | |
| **Before**: Anecdotal observations | |
| **After**: Quantitative analysis | |
| ``` | |
| Oral Health Funding by Political Context: | |
| β’ Democratic-controlled states: $2.1M avg | |
| β’ Republican-controlled states: $1.8M avg | |
| β’ Swing states: $2.3M avg | |
| β’ Analysis: More urban states (often blue) have more nonprofits | |
| ``` | |
| ## ποΈ File Structure | |
| ``` | |
| discovery/ | |
| βββ grants_gov_integration.py # Grants.gov API client | |
| βββ fec_integration.py # FEC political contributions | |
| βββ voter_data_integration.py # Voter data and elected officials | |
| examples/ | |
| βββ demo_grants_gov.py # Grant opportunities demo | |
| βββ demo_political_influence.py # FEC integration demo | |
| βββ GRANTS_GOV_VALUE.md # Grants.gov data comparison | |
| βββ POLITICAL_INFLUENCE_INTEGRATION.md # Complete analysis guide | |
| website/docs/integrations/ | |
| βββ grants-gov-api.md # Grants.gov documentation | |
| βββ fec-political-contributions.md # FEC documentation | |
| data/gold/ | |
| βββ grants/ | |
| β βββ oral_health_opportunities.parquet # Federal grants | |
| βββ fec/ | |
| β βββ political_contributions.parquet # Political donations | |
| βββ states/MA/ | |
| βββ nonprofits_organizations.parquet # Organizations | |
| βββ nonprofits_officers.parquet # Leadership | |
| βββ grants_revenue_sources.parquet # Revenue breakdown | |
| βββ available_grants.parquet # Matched opportunities | |
| ``` | |
| ## π‘ Analysis Examples | |
| ### Find Political Connections | |
| ```python | |
| from discovery.fec_integration import OpenFECAPI, PoliticalContributionMatcher | |
| import pandas as pd | |
| # Load your data | |
| officers = pd.read_parquet("data/gold/states/MA/nonprofits_officers.parquet") | |
| # Find political contributions | |
| api = OpenFECAPI(api_key="your_key") | |
| matcher = PoliticalContributionMatcher(api) | |
| contributions = matcher.find_nonprofit_leadership_contributions( | |
| officers_df=officers, | |
| state_code="MA", | |
| min_amount=200 | |
| ) | |
| print(f"Found {len(contributions):,} political donations") | |
| print(f"Total: ${contributions['contribution_amount'].sum():,.2f}") | |
| ``` | |
| ### Match Grants to Nonprofits | |
| ```python | |
| from discovery.grants_gov_integration import GrantsGovAPI, GrantMatcher | |
| # Find oral health grants | |
| api = GrantsGovAPI() | |
| matcher = GrantMatcher(api) | |
| grants = matcher.find_oral_health_grants(opp_statuses="posted") | |
| # Load nonprofits | |
| nonprofits = pd.read_parquet("data/gold/states/MA/nonprofits_organizations.parquet") | |
| # Match grants to eligible MA orgs | |
| matches = matcher.match_grants_to_state( | |
| state_code="MA", | |
| grants_df=grants, | |
| nonprofits_df=nonprofits | |
| ) | |
| print(f"{len(matches):,} grant opportunities for MA orgs") | |
| ``` | |
| ### Analyze Influence | |
| ```python | |
| from discovery.fec_integration import PoliticalContributionMatcher | |
| # Load all data | |
| grants = pd.read_parquet("data/gold/states/MA/grants_revenue_sources.parquet") | |
| contributions = pd.read_parquet("data/gold/fec/political_contributions.parquet") | |
| # Analyze political influence patterns | |
| matcher = PoliticalContributionMatcher(api) | |
| influence = matcher.analyze_political_influence( | |
| contributions_df=contributions, | |
| grants_df=grants | |
| ) | |
| # Results | |
| print("Political Activity vs. Grant Awards:") | |
| print(influence[['total_political_donations', 'total_grants_received']]) | |
| ``` | |
| ## π Privacy & Ethics | |
| ### Important Guidelines | |
| β **DO**: | |
| - Present data transparently | |
| - Provide full context | |
| - Allow verification | |
| - Focus on patterns | |
| - Respect privacy laws | |
| β **DON'T**: | |
| - Imply wrongdoing without evidence | |
| - Selectively present data | |
| - Use partisan language | |
| - Target individuals | |
| - Draw unsupported conclusions | |
| ### Disclaimers | |
| 1. **FEC data is public record** - legal, transparent political participation | |
| 2. **Correlation β causation** - many factors influence grant awards | |
| 3. **Personal vs. institutional** - officers donate as individuals | |
| 4. **Context matters** - civic engagement is protected speech | |
| ## π ROI Summary | |
| ### Setup Time | |
| - Grants.gov: **0 minutes** (no auth required) | |
| - FEC API: **5 minutes** (free signup) | |
| - Voter data: **Varies** (state-specific or commercial) | |
| ### Cost | |
| - Grants.gov: **FREE** | |
| - FEC API: **FREE** | |
| - Voter data: **FREE** (aggregated) or **$-$$$** (individual-level) | |
| ### Value | |
| - **Differentiation**: Unique feature no one else has | |
| - **Transparency**: Build trust through openness | |
| - **Insights**: Data-driven political analysis | |
| - **Advocacy**: Strategic engagement tools | |
| - **Impact**: Better informed democracy | |
| ### Maintenance | |
| - Grants.gov: Daily automated fetches (5 min setup) | |
| - FEC: Weekly batch updates (cron job) | |
| - Voter data: Monthly updates (varies by source) | |
| ## π¦ Next Steps | |
| ### Immediate (Today) | |
| - [ ] Get FEC API key (5 min): https://api.data.gov/signup/ | |
| - [ ] Run Grants.gov demo: `python examples/demo_grants_gov.py` | |
| - [ ] Run FEC demo: `python examples/demo_political_influence.py --api-key KEY` | |
| - [ ] Review generated data in `data/gold/` | |
| ### Short-term (This Week) | |
| - [ ] Match grants to your nonprofits | |
| - [ ] Find political connections in your officer data | |
| - [ ] Create first analysis: donation β grant timeline | |
| - [ ] Build basic dashboard widget | |
| ### Medium-term (This Month) | |
| - [ ] Set up automated daily grant fetching | |
| - [ ] Build email alert system for grant opportunities | |
| - [ ] Create political transparency page | |
| - [ ] Launch "Political Connections" feature | |
| ### Long-term (This Quarter) | |
| - [ ] Integrate voter data (state or commercial) | |
| - [ ] Build comprehensive influence analysis | |
| - [ ] Create network visualizations | |
| - [ ] Publish research findings | |
| - [ ] Partner with journalists/researchers | |
| ## π Troubleshooting | |
| ### "No contributions found" | |
| - Check API key is valid | |
| - Try broader search parameters | |
| - Use `DEMO_KEY` for testing (limited) | |
| - Verify employer names match exactly | |
| ### "File not found" | |
| - Run demos to generate data first | |
| - Check file paths are correct | |
| - Ensure you have MA nonprofit data | |
| - Generate missing data (see commands above) | |
| ### "Rate limit exceeded" | |
| - FEC API: 1,000 requests/hour with key | |
| - Use DEMO_KEY sparingly (30/hour) | |
| - Add delays between requests | |
| - Batch operations overnight | |
| ### "Empty results" | |
| - Many nonprofits have no political activity (normal!) | |
| - Try different search parameters | |
| - Expand date range | |
| - Lower minimum amount | |
| ## π Support | |
| - **Documentation**: See `website/docs/integrations/` | |
| - **Examples**: See `examples/` directory | |
| - **Issues**: Check error messages and API docs | |
| - **Questions**: Review analysis examples in POLITICAL_INFLUENCE_INTEGRATION.md | |
| ## π Success Metrics | |
| You'll know it's working when you can answer: | |
| β "Which federal oral health grants are available RIGHT NOW?" | |
| β "Which nonprofit leaders made political donations?" | |
| β "What's the relationship between donations and grants?" | |
| β "Do partisan patterns exist in oral health funding?" | |
| β "Which advocacy networks are most politically engaged?" | |
| **You now have the most comprehensive political-financial tracking system for civic engagement. Use it to build transparency, enable advocacy, and strengthen democracy!** π | |