datamade / chicago-elections

API for local chicago election
http://chicagoelections.datamade.us/elections/22/
2 stars 0 forks source link

New elections endpoint format #16

Open evz opened 10 years ago

evz commented 10 years ago

@fgregg @derekeder Just wanted to point out that I reworked the elections endpoints to use the data that I have been working on putting into the Open Elections format. I also reworked the output to look closer to the standard that they are proposing for their elections results.

To get a listing of elections that I have scraped, just visit /elections/. That groups the elections by the election_id (which is an Open Elections concept that allows for easy aggregation that way) and lists all the races that we have loaded in that election (which is so far just the aldermanic races). Appending an particular election_id to the end of the URL will get you the results of a particular election aggregated by ward. Like this:

[
    {
        "division": "ocd-division/country:us/state:il/place:chicago",
        "office_name": "Alderman Ward 1",
        "results": [
            {
                "votes": 3386,
                "winner": true,
                "percent": "48.86",
                "name": "MANUEL \"MANNY\" FLORES"
            },
            {
                "votes": 214,
                "winner": false,
                "percent": "3.09",
                "name": "HOWARD L. CRAWFORD, JR."
            },
            {
                "votes": 3330,
                "winner": false,
                "percent": "48.05",
                "name": "JESSE D. GRANATO"
            }
        ],
        "votes_cast": 6930,
        "registered_voters": 27470,
        "ward": 1,
        "election_id": "il-2003-2-25-february-2003-municipal"
    },
    {
        "division": "ocd-division/country:us/state:il/place:chicago",
        "office_name": "Alderman Ward 2",
        "results": [
            {
                "votes": 0,
                "winner": false,
                "percent": "0.00",
                "name": "NO CANDIDATE"
            },
            {
                "votes": 1021,
                "winner": false,
                "percent": "13.34",
                "name": "EDDIE WINTERS"
            },
            {
                "votes": 483,
                "winner": false,
                "percent": "6.31",
                "name": "BOBBY R. MORRIS"
            },
            {
                "votes": 212,
                "winner": false,
                "percent": "2.77",
                "name": "JEROME J. (JERRY) GREEN"
            },
            {
                "votes": 180,
                "winner": false,
                "percent": "2.35",
                "name": "WILLIE MAY"
            },
            {
                "votes": 1537,
                "winner": false,
                "percent": "20.08",
                "name": "GALEN L. McGEE"
            },
            {
                "votes": 4221,
                "winner": true,
                "percent": "55.15",
                "name": "MADELINE L. HAITHCOCK"
            }
        ],
        "votes_cast": 7654,
        "registered_voters": 29468,
        "ward": 2,
        "election_id": "il-2003-2-25-february-2003-municipal"
    },
   ... snip ...
]

I've loaded all the aldermanic races for the elections in 2011, 2007 and 2003. Let me know if we need to get any other elections in there. Also let me know what you think of this output. It doesn't exactly conform to the Open Elections standard but I think it should be useful for what @derekeder is putting together in the mockups.

fgregg commented 10 years ago

@evz, this is looking good.

Why are the election-id's prefixed with il If I was looking at that I would think that that was a state-wide election.

For the run-off election, why are you showing wards that did not have runoffs? http://chicagoelections.datamade.us/elections/il-2003-4-1-april-2003-aldermanic-runoff/

Why is it 47Th and not 47th and 3Rd not 3rd?

As far as compliance with the election standards... it's hard to say.

Please do the following. Create an individual file for each race, so we are in compliance with their pattern, and then also propose your combined results strategy in their repo.

fgregg commented 10 years ago

As far as the other races, in seems like we need to

  1. Exclude races where there are not human candidates
  2. Exclude races that have voters that are not strictly contained within the boundaries of the city of Chicago.

Here's an attempt at identifying these races. https://docs.google.com/spreadsheet/ccc?key=0AptDdMTTIKEndGNmVzRZeVVNd29sbFRKZmpfNjJ4Z3c&usp=sharing

If subset is TRUE, then the Chicago results are the only results that matter. Make sense?

fgregg commented 10 years ago

@evz upon further reflection, let's just add the following races