Barton

Barton is programmable, political access. It's an API for Australian electorates and politician contact details.

Access

Access the API via HTTP:

curl http://barton.experimentsindemocracy.org/api

Barton is read only so you'll only ever need to GET

Download

If you'd like to download and install it yourself you can do this as either a gem:

$ gem install barton

Or git if that tickles your fancy

git@github.com:experimentsindemocracy/barton.git

But first you'll need to install Elasticsearch

$ brew install elasticsearch

Then setup the data and run locally

$ barton --setup environment_name
$ barton --run environment_name

Requests

NOTE: Barton is in a very early alpha stage and the API may change substantially. Ensure you use the email param to get notifications of any changes.

The API base with examples can be found at:

http://barton.experimentsindemocracy.org/api

Subsequent use takes the form:

/resource/[id]?[params]

To return a single electorate

/electorates/id

To return multiple politicians

/members?params=values

Address returns all electorates bounding the supplied address. Where ever possible, do the geocoding yourself to avoid Google's 2500 per day rate limit.

/electorates?address=676+Ann+St,+Fortitude+Valley+Qld+4006 

Geo returns all electorates bounding the supplied 'long,lat' string. Using geo instead of address will result in faster response times.

/electorates?geo=145.77602080,-16.92192860

Tags returns all electorates matching the comma separated tags. To find all local councils and wards in Sydney for example:

/electorates?tags=sydney,local

Reach down into resources to filter by their children. To find

Or get more cunning with key:value and splats for all Mayors in Queensland whose name that start with the letter 'G'

/members?tags=name:g*,queensland,mayor

Go totally freaky by mixing tags and geo. Try all politicians responsible for transport in Cairns

/electorates?geo=145.77602080,-16.92192860&tags=transport

Finally, add your email so I can keep a handle on usage and loads

/[email protected]

Responses

Barton will try to play HATEOAS as nicely as possible so you should be able to explore from the base api url to all resources.

Responses are JSON format and limited to 100 results. Barton will return a status 200 whenever things are dandy or a 404 if no matching resources are found.

http://barton.experimentsindemocracy.org/api/members?tags=name:newman

{
  "name": "Barton API",
  "disclaimer": "This data is crowded sourced and provided free of charge for informational purposes only. No guarantees regarding data quality are made whatsoever apart from it's rather considerable coolness.",
  "license": "MIT License http://www.opensource.org/licenses/mit-license.php",
  "result_count": 2,
  "results": [
    {
      "name": "Campbell Newman",
      "role": "Premier",
      "party": "LNP",
      "address": "Level 15, Executive Building, 100 George Street, Brisbane Qld 4000",
      "email": "[email protected]",
      "phone": "07 3224 4500",
      "fax": "07 3221 1809",
      "id": "0db2ec",
      "type": "member",
      "tags": [
        "Queensland",
        "State",
        "Legislative Assembly"
      ],
      "electorate": {
        "name": "Queensland",
        "url": "http://barton.experimentsindemocracy.org/api/electorates/03d420"
      },
      "url": "http://barton.experimentsindemocracy.org/api/members/0db2ec"
    },
    {
      "name": "Campbell Newman",
      "party": "LNP",
      "role": "Member for Ashgrove",
      "email": "[email protected]",
      "phone": "07 3366 6000",
      "web": "http://www.parliament.qld.gov.au/members/current/list/bio?member=Newman+Campbell",
      "post": "PO Box 40, Ashgrove Q 4060",
      "address": "Ashgrove Central, 221 Waterworks Road, Ashgrove",
      "id": "207190",
      "type": "member",
      "tags": [
        "Queensland",
        "State",
        "Legislative Assembly",
        "Brisbane North"
      ],
      "electorate": {
        "name": "Ashgrove",
        "url": "http://barton.experimentsindemocracy.org/api/electorates/e07a89"
      },
      "url": "http://barton.experimentsindemocracy.org/api/members/207190"
    }
  ],
  "resources": {
    "home": "http://barton.experimentsindemocracy.org",
    "api": "http://barton.experimentsindemocracy.org/api",
    "electorates": "http://barton.experimentsindemocracy.org/api/electorates",
    "members": "http://barton.experimentsindemocracy.org/api/members"
  },
  "examples": {
    "id": "http://barton.experimentsindemocracy.org/api/members/0db2ec",
    "geo": "http://barton.experimentsindemocracy.org/api/electorates?geo=151.2054563,-33.8438383",
    "tags": "http://barton.experimentsindemocracy.org/api/members?tags=sydney,local",
    "mixed": "http://barton.experimentsindemocracy.org/api/electorates?geo=151.2054563,-33.8438383&tags=federal"
  }
}

Contributing

If you want to help then by all means jump in, fork and send a pull request.

Updating politician contact details is the most pressing job. See the data readme for more details.