A collection of tools to track and analyze Italian regional election data by accessing the Ministry of Interior's undocumented API. This project automates the collection of voter turnout and election results data from Eligendo, the official election portal.
The project consists of three main components that work together to collect and process election data in real-time:
-
Location Code Extractor (
0_codici.ipynb
)- Maps the hierarchical structure of electoral districts
- Extracts unique identifiers for regions, provinces, and municipalities
- Essential for constructing valid API requests
-
Turnout Tracker (
1_affluenza.ipynb
)- Monitors voter turnout in real-time
- Tracks participation rates across different timeframes
- Compares current turnout with historical data
-
Results Processor (
2_risultati.ipynb
)- Collects and processes vote counts as they come in
- Handles both party-list and candidate-level results
- Calculates electoral margins and shifts from previous elections
The system works by:
- Reverse-engineering the Eligendo portal's internal API
- Constructing properly formatted API requests using official location codes
- Processing JSON responses into structured data
- Generating clean CSV files ready for analysis or visualization
- Real-time data collection
- Automated geocoding of results
- Historical comparison capabilities
- Multiple output formats for visualization
- Location Codes - Liguria
- Location Codes - Emilia Romagna e Umbria
- Voter Turnout - Liguria
- Voter Turnout - Emilia Romagna
- Voter Turnout - Umbria
- Election Results - Liguria
- Election Results - Emilia Romagna
- Election Results - Umbria
Each notebook is documented and contains step-by-step examples. The core workflow:
- Run
0_codici_ER_UM.ipynb
to get location codes - Use
1_affluenza_ER.ipynb
to track turnout - Process results with
2_risultati_ER.ipynb
Marco Dalla Stella
📧 [email protected]
🦋 BlueSky
Note: For more information about working with undocumented APIs and web scraping techniques, check out this resource guide.