Note. this fork is for the WikiLeaks Party to be selected by default, styling adjustments otherwise overall functioning remains similar.
Task, to have the preferences for WikiLeaks Party opened on loading of the page. All other functionality to remain the same.
Contact @karwalski for access to the development server which automatically pulls from this repo
This repository contains code I have written for data analysis and visualisations relating to the Australian federal election of 2013. This includes a D3-based visualisation of Senate preference affinity (affinity.html) and scripts for fetching and preparing the data for it, as well as a bonus script for categorising parties according to how they order a basket of other parties in their preferences.
To get the visualisation working, you will need to do the following in the directory where the files are:
-
Run the extract_prefs.py script; this will fetch the preferences from the ABC's group voting ticket site and process them to generate a file named
avgprefs.json
. python extract_prefs.py -
Run the makefdg.py script to produce
fdg.json
, which contains data for the force-directed graph component of the visualisation and the political party colours: python makefdg.json -
To serve the visualisation locally, start a local HTTP server using Python by running the following command in the code directory: python -m SimpleHTTPServer 8000
-
Then go to
http://localhost:8000/affinity.html
, and voilà.
Note that the code has not been refactored and is probably a lot uglier than it otherwise would be.
- salient1.py
This script processes the contents of avgprefs.json
, categorises parties by which order they favour a basket of marker parties and prints the list to standard output. It was written for the purpose of writing this blog post. The basket of parties is hardcoded to the major parties, the Greens and One Nation (i.e., the ones people are likely to have strong opinions about), but this can be changed fairly easily.