Implement full 5-tab Toronto Neighbourhood Dashboard with real data connectivity: Dashboard Structure: - Overview tab with livability scores and rankings - Housing tab with affordability metrics - Safety tab with crime statistics - Demographics tab with population/income data - Amenities tab with parks, schools, transit Figure Factories (portfolio_app/figures/): - bar_charts.py: ranking, stacked, horizontal bars - scatter.py: scatter plots, bubble charts - radar.py: spider/radar charts - demographics.py: donut, age pyramid, income distribution Service Layer (portfolio_app/toronto/services/): - neighbourhood_service.py: queries dbt marts for all tab data - geometry_service.py: generates GeoJSON from PostGIS - Graceful error handling when database unavailable Callbacks (portfolio_app/pages/toronto/callbacks/): - map_callbacks.py: choropleth updates, map click handling - chart_callbacks.py: supporting chart updates - selection_callbacks.py: dropdown handlers, KPI updates Data Pipeline (scripts/data/): - load_toronto_data.py: orchestration script with CLI flags Lessons Learned: - Graceful error handling in service layers - Modular callback structure for multi-tab dashboards - Figure factory pattern for reusable charts Closes: #64, #65, #66, #67, #68, #69, #70 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
62 lines
1.4 KiB
Python
62 lines
1.4 KiB
Python
"""Plotly figure factories for data visualization."""
|
|
|
|
from .bar_charts import (
|
|
create_horizontal_bar,
|
|
create_ranking_bar,
|
|
create_stacked_bar,
|
|
)
|
|
from .choropleth import (
|
|
create_choropleth_figure,
|
|
create_zone_map,
|
|
)
|
|
from .demographics import (
|
|
create_age_pyramid,
|
|
create_donut_chart,
|
|
create_income_distribution,
|
|
)
|
|
from .radar import (
|
|
create_comparison_radar,
|
|
create_radar_figure,
|
|
)
|
|
from .scatter import (
|
|
create_bubble_chart,
|
|
create_scatter_figure,
|
|
)
|
|
from .summary_cards import create_metric_card_figure, create_summary_metrics
|
|
from .time_series import (
|
|
add_policy_markers,
|
|
create_market_comparison_chart,
|
|
create_price_time_series,
|
|
create_time_series_with_events,
|
|
create_volume_time_series,
|
|
)
|
|
|
|
__all__ = [
|
|
# Choropleth
|
|
"create_choropleth_figure",
|
|
"create_zone_map",
|
|
# Time series
|
|
"create_price_time_series",
|
|
"create_volume_time_series",
|
|
"create_market_comparison_chart",
|
|
"create_time_series_with_events",
|
|
"add_policy_markers",
|
|
# Summary
|
|
"create_metric_card_figure",
|
|
"create_summary_metrics",
|
|
# Bar charts
|
|
"create_ranking_bar",
|
|
"create_stacked_bar",
|
|
"create_horizontal_bar",
|
|
# Scatter plots
|
|
"create_scatter_figure",
|
|
"create_bubble_chart",
|
|
# Radar charts
|
|
"create_radar_figure",
|
|
"create_comparison_radar",
|
|
# Demographics
|
|
"create_age_pyramid",
|
|
"create_donut_chart",
|
|
"create_income_distribution",
|
|
]
|