-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Script for fetching, parsing and storing election night results #6
Comments
My suggested structure (from #3, where I had put it before by mistake): Use a function that takes in an elections results URL as string. Inside that function, parse the XML out into a nice, clean Python dict (object type ducked from var = {}), then push that out wherever you need it with Python's built-in json.dumps(dict) function. |
Other stuff this script needs:
|
@qbscarlie and @DanielLevitt32, any progress on these, namely the FIP pairing? Tempus fugit... |
@NathanLawrence Shoot. I meant to reference e25b701 wherein I added this. Does this look right to you? I've made the fips an attribute of each associative array in the counties array. Could also make the counties into an associative array, keyed off of FIPS, but I assume that wouldn't help much, and iterating over the counties would not be as straight-forward. {
"last_updated": 1415152662,
"race_type": "State Senate",
"races": [
{
"counties": [
{
"candidates": [
{
"id": "750074485",
"name": "Joseph (Joe) Keaveny",
"party": "Democratic",
"votes": "0"
},
{
"id": "750074484",
"name": "Courtney Blunt",
"party": "Republican",
"votes": "0"
}
],
"fips": "189",
"name": "St. Louis",
"reporting_precincts": "0",
"total_precincts": "24"
},
{
"candidates": [
{
"id": "750074485",
"name": "Joseph (Joe) Keaveny",
"party": "Democratic",
"votes": "0"
},
{
"id": "750074484",
"name": "Courtney Blunt",
"party": "Republican",
"votes": "0"
}
],
"fips": "510",
"name": "St. Louis City",
"reporting_precincts": "0",
"total_precincts": "101"
}
],
"title": "State Senator - District 4"
}, |
I like this layout -- it's exactly what I had in mind. |
Here is what I did last time around: https://github.com/gordonje/MO_votes_2014/blob/master/get_data.py
The text was updated successfully, but these errors were encountered: