Skip to content
This repository has been archived by the owner on Apr 5, 2019. It is now read-only.

Proxies Google Sheets with elected officials' contact information for Represent (deprecated)

License

Notifications You must be signed in to change notification settings

opennorth-archive/represent-canada-csv-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Represent API: CSV Proxy

Represent is the open database of Canadian elected officials and electoral districts. It provides a REST API to boundary, representative, and postcode resources.

This repository proxies Google Sheets with elected officials' contact information and reformats the data for import into Represent.

If this repository requires maintenance, it should be merged into scrapers-ca instead.

Getting Started

bundle
bundle exec rackup

API

The only API endpoint is /:id/:gid/:boundary_set. For a Google Sheets URL of:

https://docs.google.com/a/opennorth.ca/spreadsheets/d/7mOZ3yDOsmKJfg3s15S6GFEy6YAtFy461blJEemE81ML/edit#gid=059742683
  • :id is the key 7mOZ3yDOsmKJfg3s15S6GFEy6YAtFy461blJEemE81ML
  • :gid is the parameter 059742683
  • :boundary_set is the slug of a boundary set in Represent

If :boundary_set is census-subdivisions or census-subdivisions-and-divisions, then an optional sgc query string parameter can be set to a two-digit Standard geographic classification (SGC) code, to limit the search for a matching Census subdivision or Census division to one province or territory.

Data manipulation

The proxy:

  • Maps between CSV headers and JSON fields
  • Formats addresses, genders, and phone numbers
  • Preserves unrecognized CSV headers

The proxy attempts to map the District ID or District Name to a boundary in Represent, in the following order:

  1. If a District ID is four digits, the proxy maps it to a Census division boundary.
  2. If a District ID is seven digits, the proxy maps it to a Census subdivision boundary.
  3. If :boundary_set is census-subdivisions or census-subdivisions-and-divisions, the proxy attempts to map the District Name to a unique boundary within the boundary set, and raises an error if it can't.
  4. If :boundary_set is anything else, the proxy slugifies the District Name and maps it to a boundary within the boundary set.

The proxy performs no validation that the boundary exists, except in the third case as a side effect.

Copyright (c) 2015 Open North Inc., released under the MIT license

About

Proxies Google Sheets with elected officials' contact information for Represent (deprecated)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages