feat: add Sprint 5 visualization components and Toronto dashboard

- Add figure factories: choropleth, time_series, summary_cards
- Add shared components: map_controls, time_slider, metric_card
- Create Toronto dashboard page with KPI cards, choropleth maps, and time series
- Add dashboard callbacks for interactivity
- Placeholder data for demonstration until QGIS boundaries are complete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-11 16:20:01 -05:00
parent b7907e68e4
commit 077e426d34
10 changed files with 1298 additions and 0 deletions

View File

@@ -0,0 +1,79 @@
"""Map control components for choropleth visualizations."""
from typing import Any
import dash_mantine_components as dmc
from dash import html
def create_metric_selector(
id_prefix: str,
options: list[dict[str, str]],
default_value: str | None = None,
label: str = "Select Metric",
) -> dmc.Select:
"""Create a metric selector dropdown.
Args:
id_prefix: Prefix for component IDs.
options: List of options with 'label' and 'value' keys.
default_value: Initial selected value.
label: Label text for the selector.
Returns:
Mantine Select component.
"""
return dmc.Select(
id=f"{id_prefix}-metric-selector",
label=label,
data=options,
value=default_value or (options[0]["value"] if options else None),
style={"width": "200px"},
)
def create_map_controls(
id_prefix: str,
metric_options: list[dict[str, str]],
default_metric: str | None = None,
show_layer_toggle: bool = True,
) -> dmc.Paper:
"""Create a control panel for map visualizations.
Args:
id_prefix: Prefix for component IDs.
metric_options: Options for metric selector.
default_metric: Default selected metric.
show_layer_toggle: Whether to show layer visibility toggle.
Returns:
Mantine Paper component containing controls.
"""
controls: list[Any] = [
create_metric_selector(
id_prefix=id_prefix,
options=metric_options,
default_value=default_metric,
label="Display Metric",
),
]
if show_layer_toggle:
controls.append(
dmc.Switch(
id=f"{id_prefix}-layer-toggle",
label="Show Boundaries",
checked=True,
style={"marginTop": "10px"},
)
)
return dmc.Paper(
children=[
dmc.Text("Map Controls", fw=500, size="sm", mb="xs"),
html.Div(controls),
],
p="md",
radius="sm",
withBorder=True,
)