Skip to content

tfgg/UK-Polling-Stations

 
 

Repository files navigation

Stories in Ready

Build Status

UK-Polling-Stations

This is a work in progress project that needs help in a number of ways:

  1. Importing the data we have collected from councils (See Below)
  2. If you are a developer (python, django, frontend, etc) or designer, we need help making the site itself.
  3. If you are interested in helping us gather this data, or if you know a lot about the strange world of the UK geographic system.

If you are interested in helping out in any way at all, please contact sym@democracyclub.org.uk

Getting Started

Python

UK-Polling-Stations requires python 3.4

Install system dependencies

UK-Polling-Stations requires Postgres, PostGIS, libgeos and GDAL.

On Mac OSX, run:

brew install postgresql
brew install postgis
brew install geos
brew install gdal

From a clean install of Ubuntu 14 (Trusty), the command:

sudo apt-get install postgresql-9.3 postgresql-server-dev-9.3 python-psycopg2 python3-dev postgis postgresql-9.3-postgis-2.1

will install all of the necessary dependencies.

For other linux distributions, see here for details on installing geospatial libraries for use with Django.

Install project requirements

pip install -r requirements/base.txt

Create database

sudo -u postgres createdb pollingstations
sudo -u postgres createuser dc -P -s
sudo -u postgres psql pollingstations
psql (9.3.6)
Type "help" for help.

pollingstations=# CREATE EXTENSION postgis;
CREATE EXTENSION
pollingstations=#

Define database connection

UK-Polling-Stations uses dj-database-url to manage database connection. To set up a db connection, define an environment variable DATABASE_URL of the form postgis://dc:password@127.0.0.1:5432/pollingstations

Run migrations

python manage.py migrate

Import initial data

python manage.py import_councils
python manage.py loaddata polling_stations/apps/pollingstations/fixtures/initial_data.json

Importing the data we have from councils

Each council that has unimported data has a Github Issue with the Data Import label.

You can see the current status in the Waffle Board.

Data lives in ./data/[council.id]-[council.name]/*

We make a Django manage.py command in the data_collection app for each council which imports the raw data. There are some base importer command classes in the __init__.py of data_collection.management.commands and some template import scripts in polling_stations/apps/data_collection/management/commands/templates/ to use as a starting point.

We then serialize the imported data to polling_stations/apps/pollingstations/fixtures/initial_data.json

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 51.2%
  • Python 36.0%
  • HTML 6.6%
  • QML 6.1%
  • Other 0.1%