feat: Enhance dashboard with charts, study report viewer, and pruning tracking

- Add ConvergencePlot component with running best, statistics, gradient fill
- Add ParameterImportanceChart with Pearson correlation analysis
- Add StudyReportViewer with KaTeX math rendering and full markdown support
- Update pruning endpoint to query Optuna database directly
- Add /report endpoint for STUDY_REPORT.md files
- Fix chart data transformation for single/multi-objective studies
- Update Protocol 13 documentation with new components
- Update generate-report skill with dashboard integration

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Antoine
2025-12-02 22:01:49 -05:00
parent ec5e42d733
commit 75d7036193
10 changed files with 2917 additions and 66 deletions

View File

@@ -1,6 +1,6 @@
# Atomizer Dashboard
**Last Updated**: November 23, 2025
**Last Updated**: December 3, 2025
---
@@ -83,23 +83,50 @@ Displays algorithm information:
- **Objectives Count**: Number of optimization objectives
- **Design Variables Count**: Number of design parameters
### 3. Convergence Monitoring
- **Convergence Plot**: Best value vs. trial number
- **Real-time Updates**: WebSocket-driven live updates
- **Pruned Trials**: Visual indication of pruned trials
### 3. Convergence Plot (Enhanced)
**File**: `atomizer-dashboard/frontend/src/components/ConvergencePlot.tsx`
### 4. Parameter Space Exploration
- **2D Scatter Plot**: Design variable relationships
- **Color Mapping**: Objective values mapped to color intensity
- **Interactive Tooltips**: Trial details on hover
Advanced convergence visualization:
- **Dual-line plot**: Individual trial values + running best trajectory
- **Area fill**: Gradient under trial values curve
- **Statistics panel**: Best value, improvement %, 90% convergence trial
- **Summary footer**: First value, mean, std dev, total trials
- **Step-after interpolation**: Running best shown as step function
### 5. Trial History Table
### 4. Parameter Importance Chart
**File**: `atomizer-dashboard/frontend/src/components/ParameterImportanceChart.tsx`
Correlation-based parameter analysis:
- **Pearson correlation**: Calculates correlation between each parameter and objective
- **Horizontal bar chart**: Parameters ranked by absolute importance
- **Color coding**: Green (negative correlation - helps minimize), Red (positive - hurts minimize)
- **Tooltip**: Shows percentage importance and raw correlation coefficient (r)
- **Minimum 3 trials**: Required for statistical significance
### 5. Study Report Viewer
**File**: `atomizer-dashboard/frontend/src/components/StudyReportViewer.tsx`
Full-featured markdown report viewer:
- **Modal overlay**: Full-screen report viewing
- **Math equations**: KaTeX support for LaTeX math (`$...$` inline, `$$...$$` block)
- **GitHub-flavored markdown**: Tables, code blocks, task lists
- **Custom styling**: Dark theme with proper typography
- **Syntax highlighting**: Code blocks with language detection
- **Refresh button**: Re-fetch report for live updates
- **External link**: Open in system editor
### 6. Trial History Table
- Comprehensive list of all trials
- Sortable columns
- Status indicators (COMPLETE, PRUNED, FAIL)
- Parameter values and objective values
- User attributes (constraints)
### 7. Pruned Trials Tracking
- **Real-time count**: Fetched directly from Optuna database
- **Pruning diagnostics**: Tracks pruned trial params and causes
- **Database query**: Uses SQLite `state = 'PRUNED'` filter
---
## API Endpoints
@@ -286,6 +313,9 @@ atomizer-dashboard/
│ │ │ ├── ParallelCoordinatesPlot.tsx # Multi-objective visualization
│ │ │ ├── ParetoPlot.tsx # Pareto front scatter plot
│ │ │ ├── OptimizerPanel.tsx # Strategy information
│ │ │ ├── ConvergencePlot.tsx # Enhanced convergence chart
│ │ │ ├── ParameterImportanceChart.tsx # Correlation-based importance
│ │ │ ├── StudyReportViewer.tsx # Markdown report viewer
│ │ │ ├── common/
│ │ │ │ └── Card.tsx # Reusable card component
│ │ │ └── dashboard/
@@ -307,6 +337,15 @@ atomizer-dashboard/
└── optimization.py # Optimization endpoints
```
## NPM Dependencies
The frontend uses these key packages:
- `react-markdown` - Markdown rendering
- `remark-gfm` - GitHub-flavored markdown support
- `remark-math` - Math equation parsing
- `rehype-katex` - KaTeX math rendering
- `recharts` - Interactive charts
---
## Data Flow
@@ -368,7 +407,16 @@ if (!objectives || !designVariables) return <EmptyState />;
---
## Future Enhancements
## Recent Updates (December 2025)
### Completed
- [x] **Convergence Plot**: Enhanced with running best, statistics, and gradient fill
- [x] **Parameter Importance Chart**: Correlation analysis with color-coded bars
- [x] **Study Report Viewer**: Full markdown rendering with KaTeX math support
- [x] **Pruned Trials**: Real-time count from Optuna database (not JSON file)
- [x] **Chart Data Transformation**: Fixed `values` array mapping for single/multi-objective
### Future Enhancements
- [ ] 3D Pareto front visualization for 3+ objectives
- [ ] Advanced filtering and search in trial history

View File

@@ -1,7 +1,7 @@
# Protocol 13: Real-Time Dashboard Tracking
**Status**: ✅ COMPLETED
**Date**: November 21, 2025
**Status**: ✅ COMPLETED (Enhanced December 2025)
**Date**: November 21, 2025 (Last Updated: December 3, 2025)
**Priority**: P1 (Critical)
## Overview
@@ -130,7 +130,39 @@ Stiffness Mass support_angle tip_thickness
| ╲ |
```
#### 4. Dashboard Integration
#### 4. ConvergencePlot Component (NEW - December 2025)
**File**: `atomizer-dashboard/frontend/src/components/ConvergencePlot.tsx`
**Features**:
- Dual-line visualization: trial values + running best
- Area fill gradient under trial curve
- Statistics header: Best value, Improvement %, 90% convergence trial
- Summary footer: First value, Mean, Std Dev, Total trials
- Step-after interpolation for running best line
- Reference line at best value
#### 5. ParameterImportanceChart Component (NEW - December 2025)
**File**: `atomizer-dashboard/frontend/src/components/ParameterImportanceChart.tsx`
**Features**:
- Pearson correlation between parameters and objectives
- Horizontal bar chart sorted by absolute importance
- Color coding: Green (negative correlation), Red (positive correlation)
- Tooltip with percentage and raw correlation coefficient
- Requires minimum 3 trials for statistical analysis
#### 6. StudyReportViewer Component (NEW - December 2025)
**File**: `atomizer-dashboard/frontend/src/components/StudyReportViewer.tsx`
**Features**:
- Full-screen modal for viewing STUDY_REPORT.md
- KaTeX math equation rendering (`$...$` inline, `$$...$$` block)
- GitHub-flavored markdown (tables, code blocks, task lists)
- Custom dark theme styling for all markdown elements
- Refresh button for live updates
- External link to open in system editor
#### 7. Dashboard Integration
**File**: `atomizer-dashboard/frontend/src/pages/Dashboard.tsx`
**Layout Structure**:
@@ -292,6 +324,28 @@ npm run dev # Runs on port 3001
- **Real-time writes**: <5ms per trial (JSON serialization)
- **Dashboard load time**: <500ms initial render
## December 2025 Enhancements
### Completed
- [x] **ConvergencePlot**: Enhanced with running best, statistics panel, gradient fill
- [x] **ParameterImportanceChart**: Pearson correlation analysis with color-coded bars
- [x] **StudyReportViewer**: Full markdown rendering with KaTeX math equation support
- [x] **Pruning endpoint**: Now queries Optuna SQLite directly instead of JSON file
- [x] **Report endpoint**: New `/studies/{id}/report` endpoint for STUDY_REPORT.md
- [x] **Chart data fix**: Proper `values` array transformation for single/multi-objective
### API Endpoint Additions (December 2025)
4. **GET `/api/optimization/studies/{study_id}/pruning`** (Enhanced)
- Now queries Optuna database directly for PRUNED trials
- Returns params, timing, and pruning cause for each trial
- Fallback to legacy JSON file if database unavailable
5. **GET `/api/optimization/studies/{study_id}/report`** (NEW)
- Returns STUDY_REPORT.md content as JSON
- Searches in 2_results/, 3_results/, and study root
- Returns 404 if no report found
## Future Enhancements (P3)
- [ ] WebSocket support for instant updates (currently polling)
@@ -300,7 +354,6 @@ npm run dev # Runs on port 3001
- [ ] Strategy performance comparison charts
- [ ] Historical phase duration analysis
- [ ] Mobile-responsive design
- [ ] Dark/light theme toggle
## Troubleshooting