Skip to content

feat: MEE dashboards, component browser, map, sharing, and execution UI#8

Open
MaykThewessen wants to merge 15 commits intoPyPSA:mainfrom
MaykThewessen:feature/mee-dashboards-and-optimizations
Open

feat: MEE dashboards, component browser, map, sharing, and execution UI#8
MaykThewessen wants to merge 15 commits intoPyPSA:mainfrom
MaykThewessen:feature/mee-dashboards-and-optimizations

Conversation

@MaykThewessen
Copy link
Copy Markdown

@MaykThewessen MaykThewessen commented Apr 6, 2026

Summary

Implements most of the project roadmap items, adding dashboard-style analysis, a component data browser, interactive map, saved views, network sharing, and a run creation form.

Features

  • Custom analysis pipelines — 9 analysis types (dispatch area, line loading, price curves, cross-border flows, capacity mix, nodal balance, line flow snapshots) with Plotly visualizations, carrier color standardization, and Polars-accelerated aggregation
  • Component data browser — Sidebar listing all PyPSA component types, paginated data table with column sorting, search, dtype-aware formatting, and time-series metadata badges
  • Inline component editing — Edit mode toggle, batch save with yellow change highlights, confirm-on-discard, disabled sort/pagination during editing
  • Interactive map — Leaflet + OpenStreetMap showing buses as circle markers and lines/links as colored polylines with capacity-based width, popups, auto-fit bounds, and carrier filter integration
  • Saved dashboard views — CRUD API + UI to save/load/delete current filter & tab configuration as named views (public or private)
  • Network sharing — Share networks with specific users beyond public/private visibility via network_shares join table, with user search and share management dialog
  • Run creation dialog — Self-service workflow submission with form validation, backend selection, git branch/tag, config file, snakemake args, and import networks

Backend changes

Area Files
API routes components.py, map.py, views.py, analysis.py (new); networks.py, main.py (modified)
Schemas components.py, views.py, analysis.py (new); network.py (modified)
Services analysis.py (new); network.py (modified)
Models SavedView, network_shares table added
Migrations 0003_add_saved_views.py, 0004_add_network_shares.py
Permissions can_access() extended to check network shares
Utils carrier_colors.py, enhanced serializers.py

Frontend changes

Component Purpose
ComponentBrowser.svelte Paginated component data table with sort/search
NetworkMap.svelte Leaflet map with GeoJSON bus/branch visualization
SaveViewDialog.svelte Save current dashboard config as named view
ViewSelector.svelte Load/delete saved views dropdown
ShareDialog.svelte Share network with specific users
CreateRunDialog.svelte Self-service workflow submission form

Bug fixes included

  • n.export()n.export_to_netcdf() (correct PyPSA API)
  • ReDoS prevention in component search (regex=False)
  • Cache corruption fix (uncached load for writes, targeted eviction)
  • Non-admin user search for sharing (dedicated endpoint vs admin-only)
  • Path validation on network export
  • Frontend: double-fetch, stale search input, unmount cleanup, network switch state reset

Test plan

  • Upload a network (.nc file) and verify it appears in the list
  • Open network detail → verify Component Data section shows components with correct counts
  • Click through component types, verify pagination, sorting, and search work
  • Toggle edit mode, modify a value, save, verify it persists on reload
  • Verify Leaflet map renders buses and branches, popups show details
  • Save a dashboard view, navigate away, return and load it
  • Share a network with another user, verify they can see it
  • Create a new run via the dialog (requires Snakedispatch backend)
  • Verify analysis tabs (Energy Balance, Capacity, CAPEX, OPEX) render plots

🤖 Generated with Claude Code

MaykThewessen and others added 13 commits April 6, 2026 16:00
Port Script_MEE-style dashboard analyses to pypsa-app as a new analysis
service layer alongside the existing PyPSA built-in statistics. Adds 7
analysis types (dispatch_area, line_loading_histogram/timeseries,
price_duration_curve/timeseries, cross_border_flows, capacity_mix) with
canonical carrier colors, dispatch ordering, and country color theming.

Performance: orjson for faster JSON serialization in cache and serializer,
128KB file hash chunks, NaN/Inf sanitization in DataFrame serialization,
optional Polars for vectorized aggregations on large networks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fix critical bugs in analysis service:
- Replace unsafe n.buses.get("country", "") pattern that crashes on
  networks without a "country" column (ValueError on pandas >= 2.0)
- Extract _get_bus_countries/_buses_in_country/_bus_country helpers
  for safe, consistent country lookups across all analysis functions
- Add AC line cross-border flow detection (previously only HVDC links)
- Handle NaN country values gracefully
- Add .fillna(0) to capacity_mix reindex to prevent NaN bars
- Refactor cross_border_flows to reduce cyclomatic complexity (PLR0912)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…yPSA#6)

Add two new analysis types addressing GitHub issue PyPSA#6:
- nodal_balance: per-bus generation vs load at a given snapshot, showing
  net injection as overlay bar chart (top-N by absolute injection)
- line_flow_snapshot: per-line loading % and flow direction at a given
  snapshot, with color-coded congestion thresholds

Both support snapshot_idx parameter for time-step navigation, enabling
the frontend to build a "grid playback" tool.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add full-stack component browser for viewing PyPSA network component
data (buses, generators, lines, etc.) with pagination, sorting, search,
and time-series metadata. Backend includes PATCH endpoint for editing
component data with safe cache invalidation and path validation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Edit mode with pencil toggle, batch save with yellow highlights for
modified cells, confirm-on-discard for unsaved changes, and pagination/
sort disabled during editing to prevent data loss.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Users can save the current dashboard configuration (active tab, carrier/
country filters, individual plot mode) as named views, load them later,
and share public views. Includes SavedView model, Alembic migration,
CRUD API endpoints, and Save/Load UI in the network detail header.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Lightweight map visualization using Leaflet + OpenStreetMap tiles.
Shows buses as circle markers and lines/links as colored polylines
with capacity-based width. Popups show component details. Map auto-fits
to network bounds and responds to carrier filter selection.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Networks can now be shared with specific users beyond public/private
visibility. Adds network_shares join table, extends can_access() to
check shares, adds share/unshare API endpoints, and includes a Share
dialog in the network detail header with user search.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Form with workflow URL, branch/tag, config file, backend selection,
and advanced options (snakemake args, import networks, visibility).
Validates inputs, submits to API, and navigates to run detail on success.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix n.export() -> n.export_to_netcdf() (PyPSA has no .export())
- Add GET /networks/users/search endpoint for non-admin user search
- Fix ShareDialog to use new endpoint instead of admin-only listUsers
- Remove deadlock risk by dropping explicit cache lock acquisition

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MaykThewessen MaykThewessen force-pushed the feature/mee-dashboards-and-optimizations branch from 70631c7 to 56c73be Compare April 6, 2026 21:25
@MaykThewessen MaykThewessen changed the title feat: custom analysis pipelines and performance optimizations feat: MEE dashboards, component browser, map, sharing, and execution UI Apr 6, 2026
- Buses colored by carrier or country (toggle in legend panel)
- Bus radius scaled by generation capacity at that node
- Per-bus popup shows generator count/capacity, carrier types, load count
- Branches: cross-border lines highlighted amber, log-scale width
- Hover effects on buses and branches
- Collapsible legend with carrier/country color swatches and branch type key
- CartoDB Positron basemap for cleaner data visualization
- Click-to-filter callback support (onBusClick prop)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@MaykThewessen MaykThewessen force-pushed the feature/mee-dashboards-and-optimizations branch from f9c0f8f to f4d014e Compare April 6, 2026 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant