feat(phase-9): implement layout variations, pareto fleet optimization, and final demonstration
This commit is contained in:
@@ -241,6 +241,46 @@ class DashboardDataProvider:
|
||||
|
||||
return comparisons
|
||||
|
||||
def get_optimization_data(self) -> Dict[str, Any]:
|
||||
"""Read optimization summary JSON, or parse markdown if JSON is absent."""
|
||||
opt_dir = self.results_dir / "optimization"
|
||||
json_file = opt_dir / "optimization_summary.json"
|
||||
if not json_file.exists():
|
||||
json_file = opt_dir / "final_demonstration_summary.json"
|
||||
|
||||
if json_file.exists():
|
||||
try:
|
||||
with open(json_file, "r", encoding="utf-8") as f:
|
||||
return json.load(f)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# Fallback or default empty structure
|
||||
return {
|
||||
"evaluation": {
|
||||
"overall_score": 0.0,
|
||||
"recommendation": "Run 'warehouse-twin optimize' to generate optimization benchmarks.",
|
||||
"deltas": [],
|
||||
"key_takeaways": [],
|
||||
},
|
||||
"layout_comparison": [],
|
||||
"best_layout": "baseline",
|
||||
"pareto_frontier": {},
|
||||
}
|
||||
|
||||
def get_optimization_svg(self) -> Optional[str]:
|
||||
"""Return raw SVG content for layout optimization comparison."""
|
||||
opt_dir = self.results_dir / "optimization"
|
||||
svg_file = opt_dir / "layout_comparison.svg"
|
||||
if not svg_file.exists():
|
||||
svg_file = self.results_dir / "demonstration" / "layout_comparison.svg"
|
||||
if svg_file.exists():
|
||||
try:
|
||||
return svg_file.read_text(encoding="utf-8")
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def _parse_markdown_table(markdown_text: str) -> List[Dict[str, str]]:
|
||||
"""Extract table rows from a Markdown document into list of dictionaries."""
|
||||
|
||||
Reference in New Issue
Block a user