Skip to content

Cris567/electionresults-app

Repository files navigation

ElectionresultsApp

Data Visualisation Project

Data analysis and visualisation using Python3, Flask, Angular, SQLAlchemy, sqlite3.

Analysing a *.csv file with Bundestagswahlen 2017 (german elections 2017) results and visualising those.

(CSV-Source https://www.bundeswahlleiter.de/dam/jcr/72f186bb-aa56-47d3-b24c-6a46f5de22d0/btw17_kerg.csv )

Backend SETUP

Basic system setup (using terminal):

Setup virtual environment

(install python3 if not already done > brew install python)
move to your project folder > cd "path/projectFolder"
create virtual environment > python3 -m venv "/projectFolder/"
activate virtual environment > source "/projectFolder/bin/activate"

Do the following setup steps (Flask, SQLAlchemy, sqlite3) within virtual environment

Create/Open database with sqlite3

(sqlite3 is already included in python3)
> sqlite3 btw_results.db
Run select queries etc. after data import
i.e. get all provinces, counties and/or parties:
sqlite> select * from provinces; select * from counties; select * from parties;

alt text

Import csv data

> python3
>>> from main import insert_csv_data
>>> insert_csv_data()

Dependencies

Python requirements are definded in requirements file and can be installed via > pip install -r requirements

Node dependencies are definded in package file and can be installed via > npm i

Or step by step as shown below

Setup SQLAlchemy

> pip install SQLAlchemy

Setup Flask

> pip install flask
> pip install -U flask_cors
Start Flask: python controller.py
Requests http://127.0.0.1:5000/getProvinces (check controller.py for all available methods)

Frontend SETUP

The Angular part of this project was generated with Angular Version 1.7.6.

Run npm install angular@1.7.6 to install.

The Charts of this project are visualized with Angular ChartJS.

Run npm install chart.js --save to install.

Development server

Start Flask as described in Backend Setup above and navigate to http://localhost:5000/.

Further help

To get more help on Angular ChartJS go check out the Angular Chart README.

About

Data analysis and visualisation using Python3, Flask, Angular, SQLAlchemy, sqlite3.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •