Dashboard is a program developed by F.Feenstra
The program requires the following packages to be installed:
- pandas (V1.0.1; BSD 3-Clause License)
- matplotlib (v3.1.3; PSF license)
- pyyaml (V5.3; Lisense)
See 'Installing' on how to install these packages.
Installing and running the program can be done by executing the following steps:
Step 1: acquire the source files
Either clone or download the source files.
Step 2: creating the virtual environment
Alternative step below
- Open JetBrains PyCharm
- Click on 'File' -> 'Settings' (Ctrl + Alt + S) -> 'Project: progr1' -> 'Project Interpreter'
- Add a new interperter by pressing the gear icon -> 'Add'
- Make sure 'New environment' is selected, click on 'OK' and again click on 'OK'
- Activate the virtual environment by either restarting PyCharm or executing the following command in the terminal:
source venv/bin/activateAlternatively
- Open a terminal in the project root folder
- Run:
bash venv_installer.sh - Wait for bash script to complete installing the packages
- Activate the virtual environment by restarting PyCharm or using
source venv/bin/activateNote: you can skip step 3 with this alternative method.
Step 3: installing the required packages
- Make sure the virtual environment is active and run the command
pip install -r requirements.txt- Wait for the command to finish the installations
Step 4: running the program
Download a csv file from the hah.milieudefensie.nl dashboard to the projectfolder. Execute the following command in the command-line:
python3 dashboard.pyFunction to fill an array y with the numbers of occurrence per category. This function only processes one column. These arrays are used to fill the horizontal bar in the chart
This funtion creates the graph. It uses the following parameters: results : dict A mapping from question labels to a list of answers per category. It is assumed all lists contain the same number of entries and that it matches the length of category_names. category_names : list of str The category labels The horizontal bar is grey for the 'weet niet' part and it does not display 0 see also https://matplotlib.org/gallery/lines_bars_and_markers/horizontal_barchart_distribution.html
This function is necesarry to preprocess the file and to ignore empty values
The column names of the tables generated by hah webapp are numbers. These need to be mapped with the 'stellingen' from the config file
The program can read multiple files and analyse them one by one in case no arguments are given. The files of the analysies need to be in the same directory of the dashboard.py
python3 dashboard.pyThe program can read a single file by parsing a file argument:
python3 dashboard.py /path/to/directory/file.csv This program also requires a config.yml file in which the user can alter the stellingen
The program outputs a png file with the analysis for each csv file:
Figure1: dashboard of gesprekken 2020 tot 11 february postcode-8900-8941,9700-9747
