Skip to content

πŸ• Election night scraper for our friends at Block Club

Notifications You must be signed in to change notification settings

datamade/block-club-election-night

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ• Block Club Election Night

This repository contains code to retrieve results for the February 2023 Municipal Election.

Already performed the setup? ⏩ Jump to instructions for Running the scraper.

System requirements

Setup

Open a command line. On a Mac, you can use the Terminal app.

To run a command, type or copy and paste the listed incantation into your command line, then press Enter (or Return).

In the Terminal app, navigate to your desktop:

cd ~/Desktop

Download the scraper code:

git clone https://github.com/datamade/block-club-election-night.git

Navigate into the directory containing the scraper code:

cd block-club-election-night

Create and activate a virtual environment, then install the scraper:

python3 -m venv ~/.virtualenvs/elections
source ~/.virtualenvs/elections/bin/activate
pip install -r requirements.txt

Running the scraper

Whether you want to scrape the summary file or precinct results, you first need to navigate into the directory containing the scraper code and activate your virtual environment. If you just finished setup, above, you can skip this step!

cd ~/Desktop/block-club-election-night
source ~/.virtualenvs/elections/bin/activate

Scraping the summary file

Run the summary file scraper like this:

python3 -m election_night.get_results

You should see something like this in your terminal:

Getting summary results from https://chicagoelections.gov/results/ap/SummaryExport.txt! πŸŽ‰

This indicates the scrape ran successfully!

You can view the output in the results/ folder. Output files are grouped in a sub-folder named for the date and time you ran the scrape.

If you'd like to scrape the zero file posted by the Board of Elections for testing, run:

python3 -m election_night.get_results --test

Scraping precinct-level results

Late on Election Night and into the following day, the Board of Elections stops updating the summary file in favor of precinct-level results. You can run the precinct scraper like this:

python3 -m election_night.get_results --precinct

You should see something like this in your terminal:

Getting precinct results for 2023 Municipal Runoffs - 4/4/23! πŸŽ‰

Note that scraping precinct results takes about a minute to run, since the pages are slow to load.

As before, when the scrape completes, you can view the output in the results/ folder. Output files are grouped in a sub-folder named for the date and time you ran the scrape.

About

πŸ• Election night scraper for our friends at Block Club

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages