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.

Requirements:

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 https://deb.nodesource.com/setup_0.12 | 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 https://github.com/scotm/canvassing.git
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
grunt
./manage.py 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

SKIP TO THE END OF THIS SECTION IF YOU DON’T HAVE AN ELECTORAL REGISTER TO USE.

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

Now create the database tables:

./manage.py 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 geoportal.statistics.gov.uk. Unzip them.

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

./manage.py 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.

./manage.py load_wards <path to>/WD_DEC_2014_GB_BFE.shp
./manage.py 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.

END OF DATABASE PREPARATION

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:

wget https://github.com/scotm/canvassing/raw/master/comrade.pgsql.lzma
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.

./manage.py runserver_plus

Comments

Leave a Reply

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