Implement dashboard callbacks for interactivity #68
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Create the callback functions that wire up the dashboard interactivity: map clicks, tab switches, year selection, and neighbourhood details panel.
Files to Create
portfolio_app/pages/toronto/callbacks/map_callbacks.pyportfolio_app/pages/toronto/callbacks/chart_callbacks.pyportfolio_app/pages/toronto/callbacks/selection_callbacks.pyportfolio_app/pages/toronto/callbacks/__init__.pyCallback Specifications
Map Callbacks
update_choropleth(year, metric, tab)- Redraw map with selected metrichandle_map_click(clickData)- Extract neighbourhood_id, update Storehighlight_selected(selected_id)- Visual feedback on selected neighbourhoodChart Callbacks
update_kpi_cards(year, neighbourhood_id)- Refresh KPI valuesupdate_supporting_charts(year, neighbourhood_id, tab)- Refresh bar/line chartsupdate_details_panel(neighbourhood_id)- Show all metrics for selectionSelection Callbacks
sync_year_across_tabs(year)- Keep year consistent across tabsupdate_url_hash(tab)- Sync URL with active tabState Management
Use
dcc.Storefor:selected-neighbourhood-store- Currently selected neighbourhood IDselected-year-store- Currently selected yeardashboard-data-store- Cached mart data (avoid re-fetching)Acceptance Criteria
Technical Notes
@callbackdecorator (Dash 2.0+ style)prevent_initial_call=Truewhere appropriatedash.no_updateto skip unchanged outputsclientside_callbackfor simple state updatesLabels: type:feature, component:frontend, priority:critical, tech:python, tech:dash