π Interactive City Dashboard
Explore world cities with an interactive map, charts, and live data
- A fully interactive Dash application that visualises world cities with:
- A dynamic Mapbox map
- A responsive population bar chart
- A collapsible Wikipedia-powered city information panel
- A clean light/dark theme system
- Multiple layout modes (side-by-side, stacked, wide, minimalist, pro)
- A modular, test-driven architecture designed for clarity and maintainability
This project demonstrates professional-grade Dash engineering, clean separation of concerns, and a fully tested callback + layout system.
- Click any city to update the dashboard
- Map auto-centres and highlights the selected city
- Built using Plotly Mapbox
- Shows population for the selected city
- Automatically scales the y-axis
- Theme-aware styling
- Collapsible βCity Informationβ panel
- Fetches live summaries via a service layer
- Clean separation between UI and data fetching
- Full theme propagation across map, chart, and layout
- Smooth transitions
- Side-by-side
- Stacked
- Sidebar
- Wide map focus
- Chart focus
- Minimalist
- Three-column βProβ layout
- Layout tests
- Callback unit tests
- Integration tests using Dashβs callback map
Click below to watch the 1 minute demo:
project_flask_api/
β
βββ api.py # Dash app entrypoint
β
βββ data/
β βββ populations.py # City dataset
β
βββ services/
β βββ wiki.py # Wikipedia summary fetcher
β
βββ components/
β βββ map_builder.py # Map figure builder
β βββ charts.py # Population chart builder
β βββ details_panel.py # Wiki/details panel builder
β βββ theme.py # Light/Dark theme definitions
β
βββ layout/
β βββ layout.py # serve_layout() β full UI tree
β
βββ callbacks/
β βββ callbacks.py # Pure callback logic + register_callbacks()
β
βββ tests/
βββ test_layout.py
βββ test_callbacks.py
βββ test_integration_app.py
git clone https://github.com/reory/Interactive-City-Dashboard.git
cd Interactive-City-Dashboard
pip install -r requirements.txtpython api.pyThen open: http://127.0.0.1:8050
pytest -q-
The suite includes:
-
Layout structure validation
-
Callback logic tests
-
Integration tests using Dashβs callback registry
This project follows:
Pure functions
- All callback logic is pure and testable.
Separation of concerns
-
Layout = static UI
-
Callbacks = behaviour
-
Components = reusable UI builders
-
Services = external data
-
Data = static datasets
Predictable state
- No hidden globals, no side effects.
Test-driven structure
- Every major part of the app is validated.
This app can be deployed to:
- Heroku
- Render
- Azure App Service
- Docker
- Gunicorn + Nginx
- Expose the server object in api.py:
server = app.serverPull requests are welcome. For major changes, open an issue first to discuss what youβd like to change.
MIT License β free to use, modify, and distribute.
Built by Roy Peters Click here for contact details π






