# Atomizer Dashboard: Gap Analysis & Future Work Plan

**Date**: November 22, 2025
**Status**: Phase 1-5 Frontend Implementation Complete (Mock/Placeholder Data)

## Executive Summary

The Atomizer Dashboard frontend has been successfully architected and implemented using a modern React stack (Vite, TypeScript, Tailwind, Recharts, Three.js). The UI structure, navigation, and key components for all major phases (Configuration, Monitoring, Analysis, Reporting) are in place.

However, **significant backend integration and data pipeline work remains** to make these features fully functional with real engineering data. Currently, many components rely on placeholder data or simulated API responses.

---

## 1. Backend Integration Gaps

### 1.1 Study Configuration (Critical)
- **Current State**: Frontend sends a JSON payload to `POST /api/optimization/studies`.
- **Missing**:
  - Backend logic to parse this payload and initialize the actual optimization engine.
  - File upload handling for `.prt`, `.sim`, `.fem` files (currently UI only).
  - Validation logic to ensure the requested design variables exist in the NX model.
- **Action Item**: Implement `StudyService.create_study()` in backend to handle file uploads and initialize `OptimizationRunner`.

### 1.2 Real-Time Data Streaming
- **Current State**: WebSocket connection is established; frontend listens for `trial_completed` events.
- **Missing**:
  - Backend broadcaster for `pareto_front` updates (needed for advanced plots).
  - Backend broadcaster for `optimizer_state` (needed for "Optimizer Thinking" visualization).
- **Action Item**: Update `optimization_stream.py` to watch for and broadcast multi-objective data and internal optimizer state changes.

### 1.3 Report Generation
- **Current State**: Frontend has a drag-and-drop builder; "Regenerate" button simulates a delay.
- **Missing**:
  - Backend endpoint `POST /api/reports/generate` to accept the report structure.
  - Logic to compile the report into PDF/HTML using a library like `WeasyPrint` or `Pandoc`.
  - Integration with LLM to generate the "Executive Summary" text based on actual results.
- **Action Item**: Build the report generation service in the backend.

---

## 2. Advanced Visualization Gaps

### 2.1 Parallel Coordinates Plot
- **Current State**: Placeholder component displayed.
- **Missing**:
  - D3.js implementation for the actual plot (Recharts is insufficient for this specific visualization).
  - Data normalization logic (scaling all variables to 0-1 range for display).
  - Interactive brushing (filtering lines by dragging axes).
- **Action Item**: Implement a custom D3.js Parallel Coordinates component wrapped in React.

### 2.2 3D Mesh Viewer
- **Current State**: Renders a rotating placeholder cube.
- **Missing**:
  - **Data Pipeline**: Conversion of Nastran `.op2` or `.bdf` files to web-friendly formats (`.gltf` or `.obj`).
  - **Backend Endpoint**: API to serve the converted mesh files.
  - **Result Mapping**: Logic to parse nodal results (displacement/stress) and map them to vertex colors in Three.js.
- **Action Item**: Create a backend utility (using `pyNastran` + `trimesh`) to convert FEA models to GLTF and extract result fields as textures/attributes.

---

## 3. Intelligent Features Gaps

### 3.1 LLM Integration
- **Current State**: Not implemented in frontend.
- **Missing**:
  - Chat interface for "Talk to your data".
  - Backend integration with Claude/GPT to analyze trial history and provide insights.
  - Automated "Reasoning" display (why the optimizer chose specific parameters).
- **Action Item**: Add `LLMChat` component and corresponding backend route `POST /api/llm/analyze`.

### 3.2 Surrogate Model Visualization
- **Current State**: Not implemented.
- **Missing**:
  - Visualization of the Gaussian Process / Random Forest response surface.
  - 3D surface plots (for 2 variables) or slice plots (for >2 variables).
- **Action Item**: Implement a 3D Surface Plot component using `react-plotly.js` or Three.js.

---

## 4. Work Plan (Prioritized)

### Phase 6: Backend Connection (Immediate)
1.  [ ] Implement file upload handling in FastAPI.
2.  [ ] Connect `Configurator` payload to `OptimizationRunner`.
3.  [ ] Ensure `optimization_history.json` updates trigger WebSocket events correctly.

### Phase 7: 3D Pipeline (High Value)
1.  [ ] Create `op2_to_gltf.py` utility using `pyNastran`.
2.  [ ] Create API endpoint to serve generated GLTF files.
3.  [ ] Update `MeshViewer.tsx` to load real models from URL.

### Phase 8: Advanced Viz (Scientific Rigor)
1.  [ ] Replace Parallel Coordinates placeholder with D3.js implementation.
2.  [ ] Implement "Compare Trials" view (side-by-side table + mesh).
3.  [ ] Add "Optimizer State" visualization (acquisition function heatmaps).

### Phase 9: Reporting & LLM (Productivity)
1.  [ ] Implement backend report generation (PDF export).
2.  [ ] Connect LLM API for automated result summarization.

---

## Conclusion

The frontend is "demo-ready" and structurally complete. The next sprint must focus entirely on **backend engineering** to feed real, dynamic data into these polished UI components. The 3D viewer specifically requires a dedicated data conversion pipeline to bridge the gap between Nastran and the Web.