Uses Sankey Diagrams to visualize politicians that have "crossed the floor" from election to election.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Python 3
- Plotly Orca
- Method 1:
$ conda install -c plotly plotly-orca
- Method 1:
$ npm install -g [email protected] orca
- Method 1:
$ docker pull quay.io/plotly/orca
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python setup.up install --force
source:
config:
sources:
- link: [wikipedia link]
table_header: [html table header]
name_col: [Name Column]
attr_col:
origin_name: [Parliamentary group column name on wikipedia]
name_on_plot: [Parliamentary group column name to be shown on on plot]
ignore_cols:
- [column name to ignore]
enclosing_tag: [tag enclosing the table]
- link: [wikipedia link]
table_header: [html table header]
name_col: [Name Column]
attr_col:
origin_name: [Parliamentary group column name on wikipedia]
name_on_plot: [Parliamentary group column name to be shown on on plot]
ignore_cols:
- [column name]
enclosing_tag: [tag enclosing the table]
type: ParliamentMembersCrawler
target:
config:
plot_name: [Output Plot Name]
target_path: [path in which the plots are going to be saved]
save_image: [true|false]
save_html: [true|false]
color_grouping_type: [party|year|none]
custom_party_colors: # REQUIRED: color_grouping_type: party
[Parliamentary group value]: [color hex code]
[Parliamentary group value]: [color hex code]
[Parliamentary group value]: [color hex code]
type: plotly
[wikipedia link]
: Wikipeda page that contains a table with the list of parliament members of some year [example[html table header]
: The Table Header- First click
View Page Source
on the wikipedia page - Spot the table with the parliament members
- Copy the header of the table - usually it starts with a
<thead>
tag
- First click
[Name Column]
: The name of the column that represents the members' names[Parliamentary group column name on wikipedia]
: The name of the column that represents the parliamentary groups' names[Parliamentary group column name to be shown on on plot]
: The value with which you want the previous attribute to be replaced on the plot[column name to ignore]
: If in the page source there is table column with the attributecolspan="2"
, the add its name here[tag enclosing the table]
: The tag name that encloses the header along with rest of the table - usually<table>
or<tbody>
[Output Plot Name]
: The name of the plot[path in which the plots are going to be saved]
: Save path of the plot[Parliamentary group value]
: The name of the parliament group for which you want a custom color[color hex code]
: The hex code of the custom color - should be enclosed in double quotes e.g. "#4974BB"
parliament_members_sankey -c CONFIG_FILE [-l LOG_FILE] [--debug] [--help]
python3 main.py -c CONFIG_FILE [-l LOG_FILE] [--debug] [--help]
This project is licensed under the GNU General Public License v3.0 License