Add semantic source-of-truth tagging + grouped layer toggles#75
Merged
Conversation
The overflow graph now carries explicit boolean flags driving the HTML viewer's layer toggles, replacing brittle colour/shape heuristics. The viewer surfaces three labelled sections (Structural Paths / Individual entities properties / Flow redispatch values) with a Select-all / Unselect-all row and dim-instead-of-hide behaviour so unchecked elements stay visible at low opacity. OverflowGraph: - set_hubs_shape sets is_hub on hub nodes (also tagged as in_red_loop AND on_constrained_path so they show under those layers regardless of recommender list contents). - New tag_red_loops(lines, nodes) and tag_constrained_path(lines, nodes) helpers driven by the recommender's lists. - highlight_significant_line_loading sets is_monitored on every monitored line and is_overload on the strict subset of overloaded contingency lines (is_overload is a strict subset of is_monitored). Interactive HTML viewer: - _build_layer_index scans data-attr-* on nodes AND edges and emits semantic layers (Hubs, Red-loop paths, Constrained path, Overloads, Low margin lines). - Layers are grouped into three sections via _LAYER_SECTIONS and rendered in _SECTION_ORDER with section headers. - Membership-based dim model: an element is visible iff at least one of its claiming layers is checked; opacity drops to 0.12 otherwise (no display:none, so click/hover stay live). - Endpoint-node inclusion: edge-only layers also dim/highlight the bbox-endpoint nodes of their claimed edges. - Select-all / Unselect-all link row above the layer list. - _align_edge_ids_with_svg() regression guard: re-keys the JSON edge model from SVG <title> endpoints so the data-source / data-target attributes always match the (src, dst) endpoints graphviz baked into the title. Tests: - test_overflow_graph.py covers the new is_hub / in_red_loop / is_monitored / is_overload / on_constrained_path attributes, the strict overload-subset semantics, and the constrained-path / red-loop taggers. - test_interactive_html.py covers the new semantic layer keys, section grouping, membership dim model, endpoint-node inclusion, edge-id alignment guard, and the Select-all / Unselect-all row. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7 tasks
marota
added a commit
that referenced
this pull request
May 5, 2026
Release containing the semantic source-of-truth tagging and grouped layer toggles for the interactive overflow-graph viewer (PR #75). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The overflow graph and its interactive HTML viewer now expose
semantic layer toggles driven by source-of-truth boolean flags
the recommender propagates onto graph nodes and edges, replacing
brittle colour / shape heuristics.
OverflowGraph(alphaDeesp/core/graphs/overflow_graph.py)set_hubs_shapetags every hub withis_hub=True(and alsoin_red_loop=True+on_constrained_path=Trueso hubs alwaysshow under those layers regardless of how the recommender's
lists are built).
tag_red_loops(lines, nodes)andtag_constrained_path(lines, nodes)helpers consume therecommender's pre-computed lists.
highlight_significant_line_loadingtagsis_monitored=Trueon every monitored entry and
is_overload=Trueon the strictsubset that is contingency-overloaded —
is_overloadis astrict subset of
is_monitored.Interactive HTML viewer (
alphaDeesp/core/interactive_html.py)_build_layer_indexscansdata-attr-*flags on both nodesand edges and emits semantic layers (Hubs, Red-loop paths,
Constrained path, Overloads, Low margin lines).
Paths / Individual entities properties / Flow redispatch
values — via
_LAYER_SECTIONSand rendered in_SECTION_ORDERwith
<h3 class=\"layer-section-header\">markers.least one of its claiming layers is checked; opacity drops to
0.12otherwise. Nodisplay:none— click / hover staylive so the operator can still hit dimmed elements.
highlight the bbox-endpoint nodes of their claimed edges, so
toggling "Overloads" alone keeps the substations the
overload connects visible.
dispatching the same change event as individual checkboxes.
_align_edge_ids_with_svg()regression guard: graphviz'sSVG and JSON outputs assign edge ids in independent orders, so
data-source/data-targeton<g class=\"edge\">endedup disagreeing with the edge's
<title>endpoints. We nowre-key the JSON edge model from the SVG title strings.
Test plan
pytest alphaDeesp/tests/test_overflow_graph.py— newassertions for the
is_hub/in_red_loop/is_monitored/
is_overload/on_constrained_pathattributes, thestrict overload-subset semantics, and the new taggers.
pytest alphaDeesp/tests/test_interactive_html.py— newsemantic layer keys, section grouping, membership dim model,
endpoint-node inclusion, edge-id alignment guard, and the
Select-all / Unselect-all row.
Expert_op4grid_recommender(companion PR) wires the lists into the new taggers.
injects the action-pin overlay on top of the viewer.
🤖 Generated with Claude Code