MyRepresentatives

Aggregates contact information for Australian State and Commonwealth Members, and Senators. Data is output as MyRepresentatives::Person and MyRepresentatives::Electorate ruby objects, or in CSV files.

Quick Start

Install the gem

$ gem install MyRepresentatives

Start IRB

$ irb
irb(main):001:0> require 'my_representatives'
=> true
irb(main):002:0> MyRepresentatives.new
...

A CSV file will be output to 'tmp/csv_all_representatives.csv' (relative to the working directory).

Or perhaps something like this:

$ irb
require 'my_representatives'
# State of Victoria Lower House (Legislative Assembly) - from CSV
representatives = MyRepresentatives::VIC::CSVLower.new
representatives.people
# Or Victoria's Upper House (Legislative Council) - scraped from the web
representatives = MyRepresentatives::VIC::WebUpper.new
representatives.people
...
# Commonwealth Upper House (Senate) - merge CSV and Web Scraping to form a 'complete' data source
representatives = MyRepresentatives::Commonwealth::MergeUpper.new
representatives.people
...
# Northern Territory Lower House (Legislative Assembly) - Scrape from the web
representatives = MyRepresentatives::NT::WebLower.new
representatives.people
...

Looking for more?

Browse the source!

Edge cases

Tasmania and Northern Territory governments do not, at this time, supply CSV files (although they do offer Microsoft Word documents).

Tasmania

This gem presently uses manually created CSV files for Tasmania's House of Assembly and Legislative Council based on these official sources - House of Assembly and Legislative Council. Neither document are regularly checked for accuracy, therefore if you identify a change in government - please notify its author. Unfortunately there is no support for web scraping, as there is no scrapable data on the Tasmanian Parliament website at this time.

Northern Territory

Unfortunately there is no support for Northern Territory CSV at this time. There is, however, the MyRepresentatives:::NT::WebLower class if you're happy for the data to be scraped from the NT parliament website (which is a good source of data).

Dependencies

Some State governments (Queensland and Western Australia) supply data in Microsoft Excel's legacy XLS format (rather than the modern XLSX format - or even CSV (our preference)). MyRepresentatives uses the excel2csv gem to convert XLS files to CSV. At this time, excel2csv requires JDK to be installed on your system.

Accuracy of Data

Per the License, "THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND" please be aware that scraping data from websites is problematic - structural changes to Government websites are outside the control of the authors of this gem, and have the ability to break some or all compatibility without notice. In developing this gem, I have also identified several errors in the CSV files published by official sources - so this is also a significant roadblock in ensuring the data this gem produces is accurate.

License

MIT - For terms refer to LICENSE.md