Skip to content
This repository has been archived by the owner on Mar 29, 2019. It is now read-only.
/ imago Public archive

django app powering Open Civic Data API

License

Notifications You must be signed in to change notification settings

opencivicdata/imago

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

imago

This is the django app that powers api.opencivicdata.org

Python 3.3 or newer required, Python 2 compatibility is not guaranteed.

Getting Started

Imago's loadmappings management command loads mappings between divisions managed by opencivicdata-django and boundaries managed by Represent Boundaries. If mappings are not loaded, then the lat and lon filters on the /people/ and /divisions/ endpoints will not work, and geometries will not appear on the /divisions/ endpoint. For the command to succeed, you must set the IMAGO_COUNTRY and IMAGO_BOUNDARY_MAPPINGS settings:

  • Set IMAGO_COUNTRY to a two-letter, lowercase country code like 'us' in settings.py, to select which country's Open Civic Data Division Identifiers to use.
  • Set IMAGO_BOUNDARY_MAPPINGS in settings.py, a dictionary in which each key is the slug of a boundary set and each value is a dictionary, which has as keys:
    • key: The property of a division identifier that will be used for matching.
    • boundary_key: Optional. Defaults to external_id. The property of a boundary that will be used for matching, or a lambda that takes a boundary as an argument and returns a string that will be used for matching.
    • prefix: Imago will prepend this prefix to the property of the boundary, identified by boundary_key, and will look for the division identifier whose property, identified by key, matches.
    • ignore: Optional. A regular expression string. If no match is found, and if either ignore is missing or the boundary name doesn't match the regular expression, a warning will be issued about the unmatched boundary.

See api.opencivicdata.org's settings.py for an example.