Australian Political Donations Visualiser
Currently running at http://www.politicaldonations.info/
You can run the entire site with a simple HTTP server, like SimpleHTTPServer from python2, or http.server from python 3. All examples from here on in will use python 2, since that's what the scripts in the repo are written in.
- Get yourself a python 2 virtualenv. Use whatever method you use for this. Personally, I use pyenv to manage python versions, and pyenv-virtualenv to manage virtualenvs.
- Activate your virtualenv
- Install dependencies:
pip install -r python/requirements.txt
- Change to the python folder:
cd python
- Download the data:
./download_data.py
- Process the data:
./process_data.py
- Move the datafile to the right spot:
all_data1.json ../data/all_data.json
- change back to the root:
cd ..
- run server
python -m SimpleHTTPServer
- navigate to http://localhost:8000/
It's possible that when you're downloading the data from the AEC, that you encounter a political party that we haven't seen before (or it could just be the submission being named something slightly different from what was submitted previously).
When we download the data from the AEC, due to inconsistencies in the reporting submitted by the political parties, it is necessary that we normalise the naming of the parties for display in the visualisation. We do this by maintaining a mapping in python/parties.txt
. If the download fails due to a mapping missing from this file, it will need to be added to the file (the format is pipe separated values), and the download script re-run. Unfortunately, the script is not particularly robust, and it currently redownloads the lot, but it will fail on the first missing party, when there could be many more. Some more robustness wouldn't go astray here.