COMRADE – a brief explanation

Right. I’ve developed a functioning web tool to make canvassing and organisation a bit easier – and would welcome any and all help to improve it.

I’ve created a stack of fake data – so anyone can jump in and improve its functionality, without exposing any of the real people’s names and addresses in the SSP or RISE’s database.

How you can help:

The source code to COMRADE is here. It’s where the current source code lives, and where I’ll tag releases. You’ll need a Git client and a free Github account to make development changes that I can accept. Please feel free to clone the repository – and make changes to improve it.

Feature requests, and bugs – make them under the repository’s Issues page:

Okay – how do I help the project directly:

I’m not a project manager, so this will be somewhat anarchic.

It’s developed under Linux and Mac OS X. I will accept patches to make it run under a Windows deployment environment, but this is not a priority right now.

What I need:

  • Tests. Lots and lots of automated tests that will demonstrate the correctness of each component. These will be run prior to pushing changes – and so merging changes does not break other changes by other developers.
  • Documentation: I’ve been lax in documenting the program – I’ll be adding new and better comments, so new developers can get up to speed.
  • User documentation: Ditto.


You’ll need a recent 9.x version of PostgreSQL. You’ll need the PostGIS extension. You’ll need 0.12 of Node.js, and npm – to get the build system up and running. You’ll need bower – to grab components that are needed in the build system. You’ll need Python (I use version 2.7)

Under Ubuntu 14.04 LTS the commands to install these components are as follows.

sudo apt-get install curl
curl -sL | sudo bash -
sudo apt-get update
sudo apt-get install -y git build-essential postgresql-server-dev-all postgresql-9.3-postgis-2.1 virtualenvwrapper python-dev nodejs

To get the source code – type in the following (this retrieves the code, and the required postcode_locator module)

git clone
cd canvassing
git submodule init
git submodule update

Get the npm and bower requirements – and build the stylesheets with grunt

sudo npm install -g bower
sudo npm install -g grunt-cli
bower install -s
npm install --loglevel silent
./ collectstatic --noinput

Get the Python requirements:

mkvirtualenv comrade
pip install -r requirements/local.txt

Prepare the database:

sudo su postgres -c "createuser -s comrade"
createdb comrade


psql -d comrade -c "CREATE EXTENSION postgis; CREATE EXTENSION postgis_topology;"

Now create the database tables:

./ syncdb

You’ll be asked to add a superuser – fill out the username, email address and password.

Obtain the Code-Point® Open and Boundary-Line™ packages from the Ordnance Survey OpenData page. And the ward boundary lines from Unzip them.

You’ll find a CSV file with all the postcode points in the Code-Point® Open package. Import it using this command:

./ fill_up_db <path to postcode CSV file>

The ward and region shape files are part of the respective packages. Import them with these commands.

./ load_wards <path to>/WD_DEC_2014_GB_BFE.shp
./ load_regions <path to>/scotland_and_wales_const_region.shp <path to>/scotland_and_wales_region_region.shp <path to>/scottish_westminster_const.shp

That’s as far as we can go without getting the electoral registers. And these are only available to delegated folks.


I’ve prepared a set of fake data – covering one ward in Dundee – fake names, initials, and adding and removing a few fake people. Under no circumstance is this to be used for a real canvass.

Download, decompress and inject it into your pre-prepared database using the following:

lzma -d comrade.pgsql.lzma
psql comrade < comrade.pgsql

The test data includes a superuser – the username is “test”, and the password is “test”

Run the development webserver to use COMRADE.

./ runserver_plus

Leave a Reply

Your email address will not be published. Required fields are marked *