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 )
Basic system setup (using terminal):
(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
(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;
> python3
>>> from main import insert_csv_data
>>> insert_csv_data()
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
> pip install SQLAlchemy
> 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)
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.
Start Flask as described in Backend Setup above and navigate to http://localhost:5000/
.
To get more help on Angular ChartJS go check out the Angular Chart README.