Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
File size: 5,138 Bytes
d15f07c | 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 138 139 140 141 142 143 144 145 146 | # Data Sources
This directory contains scrapers and loaders for various civic data sources.
## π Available Data Sources
### Federal/National Sources
- **[gsa/](gsa/)** - GSA .gov Domain Registry (2,272+ official government websites)
- **[census/](census/)** - U.S. Census Bureau (demographics, geographic boundaries)
- **[openstates/](openstates/)** - Plural Policy / Open States (state legislatures)
- **[fec/](fec/)** - Federal Election Commission (campaign finance)
- **[grants_gov/](grants_gov/)** - Grants.gov (federal grants)
- **[irs/](irs/)** - IRS (990 forms for nonprofits)
- **[nccs/](nccs/)** - National Center for Charitable Statistics
- **[nces/](nces/)** - National Center for Education Statistics
### Local Government Sources
- **[govwebsites/](govwebsites/)** β NEW - Official .gov website scraper
- **[usmayors/](usmayors/)** β NEW - U.S. Conference of Mayors (election results)
- **[naco/](naco/)** β NEW - National Association of Counties
- **[nlc/](nlc/)** π§ TODO - National League of Cities
- **[icma/](icma/)** π§ TODO - Intl City/County Management Assoc.
### Platform-Specific Scrapers
- **[civicplus/](civicplus/)** π§ TODO - CivicPlus municipal websites
- **[legistar/](legistar/)** π§ TODO - Granicus Legistar legislative portals
- **[youtube/](youtube/)** - YouTube (meeting videos, government channels)
- **[localview/](localview/)** - LocalView (meeting video platform)
### Civic Data APIs
- **[ballotpedia/](ballotpedia/)** - Ballotpedia (election data)
- **[google_civic/](google_civic/)** - Google Civic Information API
- **[voter_data/](voter_data/)** - Voter registration data
### Knowledge Bases
- **[wikidata/](wikidata/)** - Wikidata (structured jurisdiction metadata)
- **[dbpedia/](dbpedia/)** - DBpedia (Wikipedia structured data)
- **[social_media/](social_media/)** - Social media account discovery
### Meeting Data
- **[meetingbank/](meetingbank/)** - MeetingBank dataset (city council meetings)
- **[cityscrapers/](cityscrapers/)** - City Scrapers (meeting agendas)
## π Quick Start
### 1. Load GSA .gov Domains (Recommended First)
```bash
# Load all official government domains
cd gsa/
python load_gsa_domains_to_postgres.py --states AL,GA,IN,MA,WA,WI
# This creates 2,272+ jurisdiction records with official websites
```
### 2. Scrape Official Government Websites
```bash
# Extract YouTube channels, meetings, contacts from .gov sites
cd govwebsites/
python scrape_gov_websites.py --states AL,GA,IN,MA,WA,WI --limit 100
```
### 3. Load Census Data
```bash
# Geographic boundaries and demographics
cd census/
python load_census_places.py --states AL,GA,IN,MA,WA,WI
```
### 4. Load WikiData Enrichment
```bash
# Government officials, websites, metadata
cd wikidata/
python load_jurisdictions_wikidata.py --states AL,GA,IN,MA,WA,WI --types city,county,state
```
### 5. Load YouTube Meeting Videos
```bash
# Meeting videos from government YouTube channels
cd youtube/
python load_youtube_events_to_postgres.py --states AL,GA,IN,MA,WA,WI --max-videos 50
```
## π Load Types
Each data source performs one of these load types:
- **CREATE LOAD** - Creates new records (e.g., Census places, GSA domains)
- **ENRICHMENT LOAD** - Updates existing records (e.g., WikiData, NACo)
- **EVENT LOAD** - Adds time-series events (e.g., YouTube videos, meetings)
## π Recommended Load Order
1. **GSA Domains** - Establishes official government web presence
2. **Census Data** - Base jurisdiction demographic data
3. **WikiData** - Enriches with metadata and official sources
4. **Government Websites** - Discovers YouTube channels and meeting portals
5. **YouTube Videos** - Loads meeting videos from discovered channels
6. **NACo/NLC** - Enriches with county/city official directories
7. **OpenStates** - State legislative data (if applicable)
## π― Coverage Goals
| Data Source | Target Coverage | Current Status |
|-------------|----------------|----------------|
| GSA Domains | 100% of .gov domains | β
100% (2,272 loaded) |
| Census | 100% of cities/counties | β
100% (4,385 loaded) |
| WikiData | 50%+ enrichment | β
88.5% counties, <1% cities |
| Gov Websites | 25%+ scraped | π§ In progress |
| YouTube | 15%+ channels | β
19% (834 jurisdictions) |
| NACo | 50%+ counties | π§ TODO |
| NLC | 25%+ cities | π§ TODO |
## β οΈ Before Scraping
1. **Check robots.txt** - Respect crawl rules
2. **Set User-Agent** - Identify your scraper
3. **Rate limit** - Add delays between requests (2-5 seconds)
4. **Cache results** - Avoid duplicate requests
5. **Check terms of service** - Verify you have permission
## π Adding a New Data Source
1. Create directory: `mkdir scripts/datasources/newsource/`
2. Add scraper script: `scripts/datasources/newsource/scrape_data.py`
3. Add README: `scripts/datasources/newsource/README.md`
4. Update CITATIONS.md with data source info
5. Document in this README
6. Test with `--dry-run` first
## π Support
- See individual source READMEs for specific documentation
- Check CITATIONS.md for source attribution and licenses
- Report issues with specific scrapers in their directories
|