Skip to content

Instantly share code, notes, and snippets.

@derekeder
Last active September 4, 2019 20:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derekeder/6250077831d93727c4c0b2051bd4df52 to your computer and use it in GitHub Desktop.
Save derekeder/6250077831d93727c4c0b2051bd4df52 to your computer and use it in GitHub Desktop.
Chicago City Council - Divided Roll Call votes from Legistar

Open Civic Data API documentation: https://ocd-api-documentation.readthedocs.io/en/latest/

All API responses are in JSON format.

Getting the bills with split votes

Using the Open Civic Data API, you can do a query to find all bill votes for Chicago City Council that have both yes and no votes present for a particular legislative session:

https://ocd.datamade.us/votes/?votes__option=yes&votes__option=no&organization__id=ocd-organization/ef168607-9135-4177-ad8e-c1f7a4806c3a&bill__legislative_session__identifier=2019

Parameters:

  • votes__option: vote results that you want to include in your filter results
  • organization__id: unique id for the organization we are querying. In this case, this is the ID for Chicago City Council
  • bill__legislative_session__identifier: Legislative session we want to filter on. We're looking at 2019.

Here's an example response:

{

    "counts": [ ],
    "bill": {
        "id": "ocd-bill/31c0af70-0ce0-42b2-8f63-e7c24853dd00",
        "identifier": "O2019-3901"
    },
    "id": "ocd-vote/515128d4-f5da-4523-9390-c5e0714c8679",
    "motion_text": "Passed as Substitute",
    "result": "pass",
    "motion_classification": [ ],
    "organization": {
        "name": "Chicago City Council",
        "id": "ocd-organization/ef168607-9135-4177-ad8e-c1f7a4806c3a"
    },
    "updated_at": "2019-07-08T13:53:55.963673+00:00",
    "extras": { },
    "created_at": "2019-06-13T03:01:59.594820+00:00",
    "start_date": "2019-06-12"

},

You'll want to save the id for the vote result. In this case it is ocd-vote/515128d4-f5da-4523-9390-c5e0714c8679.

Getting the votes for each bill

To get the votes for a specific bill, use this endpoint, using the unique bill vote identifier:

https://ocd.datamade.us/ocd-vote/515128d4-f5da-4523-9390-c5e0714c8679

Parameters:

  • bill ID: the unique GUID for the bill. In this case, it is ocd-vote/515128d4-f5da-4523-9390-c5e0714c8679

It will return a JSON object with each member and their vote. Below is an example. Their vote is in the option field.

{
    "voter_name": "La Spata, Daniel",
    "voter": {
        "name": "La Spata, Daniel",
        "id": "ocd-person/c521845f-551b-40a7-97eb-57284773f1a9",
        "biography": "",
        "death_date": "",
        "gender": "",
        "national_identity": "",
        "extras": "{}",
        "family_name": "",
        "created_at": "2019-06-07T13:44:33.669",
        "locked_fields": "[]",
        "given_name": "",
        "sort_name": "",
        "birth_date": "",
        "image": "https://chicago.legistar.com/View.ashx?M=P&ID=217135&GUID=67B0CCE6-7542-4177-A3B8-4A3A91B4484C",
        "updated_at": "2019-07-17T23:11:26.991",
        "summary": ""
    },
    "option": "yes",
    "note": ""

},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment