Giter Site home page Giter Site logo

mirbehroznoor / world-bank-api-python-dashboard Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 0.0 3.5 MB

A multi layout dash python App which uses wbgapi python module for World Bank Data and plotly for visualizations.

License: MIT License

Python 72.32% Shell 0.37% CSS 27.31%
dashboard python3 world-bank-api dash plotly plotly-dash wbgapi

world-bank-api-python-dashboard's Introduction

World Bank API Python DashBoard

The project uses the data available from World Bank API Python for visualizations.

Limitation: No option to change World Bank API Database from DashBoard/GUI

Available Versions

Dash App

https://github.com/mirbehroznoor/World-Bank-API-Python-DashBoard/blob/main/wbapp.gif

Multi App

In Multi App, the User can choose two indicators on x-axis and y-axis respectively. The user can look for multi-variable trends for economies.

  • Trendline
    • OLS
    • Lowess
  • Plots
    • Line
    • Scatter
  • Add/Remove: Markers and Years
  • Switch Axis Variables Button
  • Indicator Descriptions (Info Button)
  • Linear/Log Scales

Simple App

It is one variable App where user can only change y-axis variable while x-axis is by set to Year by default. It accepts only one indicator while it is possible to add as many economies as possible.

  • OLS Trendline
  • Linear/Log Scale

Possibility to Switch

It is possible to switch from Simple to Multi App or vice versa.

Limitation

If App was switched or refreshed, the selections will reset to default. The default settings can be changed from within scripts.

Download Graphs as .png

The interactive plotly has the option to download the graphs too.

Incredible Search

https://github.com/mirbehroznoor/World-Bank-API-Python-DashBoard/blob/main/search-app-1.png

Default Database

World Bank API is set to World Development Indicators (WDI) Database, id=2, by the module developers. wb.source.info() provides the list of available Databases from World Bank API.

import wbgapi as wb
wb.source.info() #provide the list of DBs
wb.db # id number of current Database i.e: (WDI=2)

Globally

In case, of a different database request, the wb.db value has to be changed at the top of appSupport.py

wb.db = 1

Download & Install Conda

GNU/Linux: Too Easy to Install

Windows 10

Take note of Miniconda3 installation path.

During Miniconda3 installation tick:
  1. Add Miniconda3 to my PATH environment variable
  2. Register Miniconda3 as my default Python 3.9

Windows 7

The Python interpreters <= 3.8 are compatible.

GNU/Linux

Install Git

sudo apt-get update
sudo apt-get install git

Download Github Repository

git clone https://github.com/mirbehroznoor/World-Bank-API-Python-DashBoard

Conda Environment

Python Dependencies

In environment.yml, the conda environment is named wbconda

cat environment.yml
name: wbconda
channels:
  - conda-forge
dependencies:
  - python==3.10
  - dash==2.3.1
  - wbgapi==1.0.7
  - plotly==5.7.0
  - pandas==1.4.2
  - black
  - pip
  - pip:
    - statsmodels==0.13.2
    - dash_bootstrap_components==1.1.0
    - dash-iconify==0.1.2

Create Conda Environment

bash build_env.sh

Run Python App

Simply run the app.py script. The App will open in the default browser after few seconds.

Manually

cd ~/path/to/World-Bank-API-Python-DashBoard
conda activate wbconda
python app.py

Automate

Write Bash Alias function

Find or create .bash_aliases in folder $HOME Directory. Insert the function snippet:

wbapp() {
    cd ~/path/to/World-Bank-API-Python-DashBoard
    conda activate wbconda
    python app.py
}

For shell to re-read the .bash_aliases file, run the following command:

source ~/.bashrc

Afterwards in Terminal, simply run:

wbapp

Windows 10 Instructions.txt

First Option:

Git for Windows

Install git for windows (with default options) Install: Git for Windows

Download World Bank API files from Github Repository
Add Conda Path

Open Git Bash Add conda.sh Path in Git Bash

#Type in Git Bash
. C:/Users/your-username/miniconda3/etc/profile.d/conda.sh
Setup Conda Env

Manually open extracted path in Git Bash:

cd ~ /path/to/World-Bank-API-Python-Dashboard
bash build_env.sh #Creates Conda Environment
Run the App
#Activates conda Environment
conda activate wbconda
#Runs Application
python app.py
Open in Browser

If the App does not open automatically in your favorite browser. Visit App URL:

localhost:8050

<OR>

http://127.0.0.1:8050
Close or Terminate Server

To exit Git Bash server press Ctrl + C in terminal <OR> To close Git Bash Enter exit

After Setup

To Re-run after initial installation (for later use or once Git Bash is closed): Open Git Bash Manually navigate to extracted files path

. C:/Users/your-username/miniconda3/etc/profile.d/conda.sh
conda activate wbconda
Python app.py

Second Option:

The following instructions may not be accurate

Install PyCharm
Create a Project
Use the Git Clone Option from PyCharm Stackoverflow: Import github Repository to PyCharm
Setup Conda Env within PyCharm
  • For Conda Env: environment.yml
  • For Pyevn Env: requirements.txt
Run the App.py

Share it with others!

  • Linkedin
  • Twitter
  • Whoever can use it

Acknowledgments

world-bank-api-python-dashboard's People

Contributors

mirbehroznoor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

world-bank-api-python-dashboard's Issues

AttributeError: 'Flask' object has no attribute 'before_first_request'. Did you mean: '_got_first_request'?

Hello ๐Ÿ‘‹
After installing conda, build and activating the environment, when I try to run app.py I get this error:

Traceback (most recent call last):
  File "/Users/user/Sandbox/test/World-Bank-API-Python-DashBoard/app.py", line 16, in <module>
    app = Dash(__name__, suppress_callback_exceptions=True,
  File "/Users/user/miniconda3/envs/wbconda/lib/python3.10/site-packages/dash/dash.py", line 461, in __init__
    self.init_app()
  File "/Users/user/miniconda3/envs/wbconda/lib/python3.10/site-packages/dash/dash.py", line 509, in init_app
    self.server.before_first_request(self._setup_server)
AttributeError: 'Flask' object has no attribute 'before_first_request'. Did you mean: '_got_first_request'?
(wbconda)

Operating system: MacOS 12.6.1
Project version: 2.0.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.