Repository navigation
Conversation
Add confirmation dialogs for contingency and study reload
This commit updates RecommenderService to extract and include PST tap information in the action_topology field of enriched actions, ensuring visibility in the UI.
Adds a '💾 Save Results' button in the header that assembles the full
analysis session into a structured JSON file and triggers a browser
download. The exported file includes:
- Configuration: all settings (network/action paths, thresholds,
monitoring factor, flags, etc.)
- Contingency: disconnected element, selected overloads, monitor_deselected flag
- Overload lists: N overloads, N-1 overloads, and resolved overloads
- Overflow graph: PDF URL and path
- Analysis: message, DC fallback flag, action score table, and all
action cards with rho_before/rho_after arrays, max_rho, topology,
convergence status, plus per-action status tags:
- is_selected (starred by user)
- is_suggested (recommended by the expert_op4grid engine)
- is_rejected (explicitly rejected)
- is_manually_simulated (added via manual search)
Also adds a new `SessionResult` TypeScript type hierarchy in types.ts
(`SessionResult`, `SavedActionEntry`, `SavedActionStatus`).
The button is disabled until at least a contingency is selected.
The filename includes the contingency name and an ISO timestamp.
https://claude.ai/code/session_01JgtV5Uj3vk9J41XbDSFc7g
## is_suggested fix Replaces `is_suggested: !manuallyAddedIds.has(id)` with a dedicated `suggestedByRecommenderIds` Set that accumulates every action ID ever returned by the recommender for the current contingency. This fixes the edge case where a user manually simulates an action *before* running the recommender, and the recommender later returns the same action as a suggestion — previously the action was incorrectly marked as `is_suggested: false` because it was in `manuallyAddedIds`. Both flags can now be true independently. The set is populated in the step-2 streaming handler and cleared on contingency change, Load Study, and Apply Settings resets. ## Refactor Extracts the JSON-building logic from `handleSaveResults` into a new pure function `buildSessionResult(input: SessionInput)` in `utils/sessionUtils.ts`. This separates the serialisation logic from React state and makes it directly unit-testable. ## Tests - `utils/sessionUtils.test.ts` (27 new tests): - All configuration, contingency, overload, and analysis fields - All four status tags independently verified - Edge cases: manually-added-then-suggested, only-manual, re-run accumulation - `App.test.tsx` (6 new UI tests): - Button presence, disabled/enabled state - Download triggered with correct filename pattern - JSON structure validated against downloaded Blob ## Docs `docs/save-results.md` documents the full JSON schema, field reference, status tag semantics, implementation notes, and test coverage. https://claude.ai/code/session_01JgtV5Uj3vk9J41XbDSFc7g
## Session folder save
Replace browser-only JSON download with a full session folder saved to
the backend filesystem via POST /api/save-session:
- session.json — full analysis snapshot
- <overflow>.pdf — copy of the overflow graph PDF
When "Output Folder Path" is not configured, falls back to browser JSON
download (previous behaviour).
## New Settings → Paths tab
Settings modal gains a third tab "Paths" (shown first) with:
- Network File Path — synchronized with the banner input
- Action Dictionary File Path — moved here from the banner
- Output Folder Path — new field for session save destination
All three fields are backed up on settings open and restored on Cancel.
## Banner simplification
The Action File Path input/picker is removed from the banner; only the
Network Path remains (plus Load Study, Save Results, Settings gear).
## Backend
New POST /api/save-session endpoint:
- Creates <output_folder_path>/<session_name>/ directory
- Writes session.json
- Copies overflow PDF if pdf_path is provided and file exists
- Returns { "session_folder": "<absolute_path>" }
## Standalone interface
standalone_interface.html receives the same changes:
- outputFolderPath state + localStorage persistence
- suggestedByRecommenderIds state (was referenced but not declared)
- handleSaveSession function (new — mirrors App.tsx logic)
- Save Results button added to banner
- Action File Path removed from banner
- Settings Paths tab added
## Docs
docs/save-results.md updated to describe session folder behaviour,
output folder configuration, and the banner restructuring.
https://claude.ai/code/session_01JgtV5Uj3vk9J41XbDSFc7g
…or disconnection simply of the related network branch
…t primary action categories like Disconnections take precedence. I've also resolved all frontend lint errors and mirrored these improvements to the standalone interface for consistency. Verification was completed with 13 tests passing and logic hardening in both interfaces.
feat: include pst_tap in enriched action topology
- Switched folder icons to file icons for path-based fields. - Added placeholder to network file input in settings and main banner. - Fixed 'Change in settings' link in standalone interface. - Updated frontend tests to 33 passing tests with UI verification.
…cessing indicator
marota
pushed a commit
that referenced
this pull request
Apr 30, 2026
Reconciliation of section 2 (0.5.0): - Drop misattributed PRs that were actually pre-rebrand: save/reload (#49/#52), MW Start (#62), interaction-logging (#64), SLD highlights (#63), load shedding initial integration (#61). All now properly cited in section 1.5–1.6. - Disambiguate App.tsx refactor history: PR #56 (hooks, 2100 → 800, pre-rebrand) vs PR #74 (components, 1000 → 650, 0.5.0) vs PR #75 (memoization Phase 2, same LoC). - Add accurate 0.5.0 PRs: #66 (vectorization w/ benchmark table), #69/#70/#71 (UI polish), #72 (curtailment), #73 (loads_p/gens_p format + configurable MW), #74/#75 (App.tsx decomposition), #78 (PST tap re-simulation), #84/#86/#87/#90 (detachable tabs). - Add a recap table summarizing what's truly new in 0.5.0. Diagrams added (Mermaid, GitHub-rendered): - Gantt timeline of all 4 phases (top of doc). - High-level architecture (frontend / backend / data). - Two-step analysis sequence diagram (section 1.6). - App.tsx LoC evolution flow (section 2.4). - Backend mixin decomposition before/after PR #104/#106 (section 3). - PyPSA-EUR pipeline flowchart (section 4). https://claude.ai/code/session_01Pg7fuCUG2edfm5PyHS6SbN
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.
PR: ExpertAssist UI Refinements, PDF Export Fix, and Save Session Feedback
Goal
Improve user feedback during and after analysis, fix the missing PDF in session exports, and ensure UI consistency across the main application and standalone interface.
Proposed Changes
1. Save Session & PDF Export
App.tsxandstandalone_interface.htmlto store thepdf_pathfrom analysis results. This allows the backend to find and copy the overflow graph PDF when a session is saved.save_sessionendpoint inmain.pyto return apdf_copiedboolean, indicating success or failure of the PDF export.2. UI Aesthetic Refinements (Yellow Theme)
#fff3cdbackground) to:VisualizationPanel.3. Logic & Robustness
setTimeouthook forinfoMessagestate to ensure notifications like "Analysis completed" don't clutter the UI indefinitely.infoMessagerendering instandalone_interface.html.Verification Results
expert_backend/tests/test_save_session.pyto verify the full save flow and PDF copying.