Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
"""
|
| 2 |
-
๐ ARF ULTIMATE INVESTOR DEMO v3.3.
|
| 3 |
Enhanced with professional visualizations, export features, and data persistence
|
|
|
|
| 4 |
"""
|
| 5 |
|
| 6 |
import asyncio
|
|
@@ -122,7 +123,22 @@ class RAGGraphVisualizer:
|
|
| 122 |
def get_graph_figure(self):
|
| 123 |
"""Create Plotly figure of RAG graph"""
|
| 124 |
if not self.incidents:
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 126 |
|
| 127 |
# Prepare node data
|
| 128 |
nodes = []
|
|
@@ -241,10 +257,44 @@ class PredictiveVisualizer:
|
|
| 241 |
def get_predictive_timeline(self):
|
| 242 |
"""Create predictive timeline visualization"""
|
| 243 |
if not self.predictions:
|
| 244 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 245 |
|
| 246 |
-
|
| 247 |
-
df = pd.DataFrame(self.predictions[-10:]) # Last 10 predictions
|
| 248 |
|
| 249 |
fig = go.Figure()
|
| 250 |
|
|
@@ -270,7 +320,7 @@ class PredictiveVisualizer:
|
|
| 270 |
|
| 271 |
# Add threshold warning if applicable
|
| 272 |
for i, row in df.iterrows():
|
| 273 |
-
if row["time_to_threshold"] and row["time_to_threshold"] < 30:
|
| 274 |
fig.add_annotation(
|
| 275 |
x=row["predicted_at"],
|
| 276 |
y=row["predicted"],
|
|
@@ -436,156 +486,266 @@ class LiveDashboard:
|
|
| 436 |
}
|
| 437 |
|
| 438 |
# ============================================================================
|
| 439 |
-
# ENHANCED VISUALIZATION ENGINE
|
| 440 |
# ============================================================================
|
| 441 |
|
| 442 |
class EnhancedVisualizationEngine:
|
| 443 |
-
"""Enhanced visualization engine with animations and interactivity"""
|
| 444 |
|
| 445 |
@staticmethod
|
| 446 |
def create_animated_radar_chart(metrics: Dict[str, float], title: str = "Performance Radar"):
|
| 447 |
"""Create animated radar chart with smooth transitions"""
|
| 448 |
|
| 449 |
-
|
| 450 |
-
|
| 451 |
-
|
| 452 |
-
|
| 453 |
-
|
| 454 |
-
|
| 455 |
-
|
| 456 |
-
|
| 457 |
-
|
| 458 |
-
|
| 459 |
-
|
| 460 |
-
|
| 461 |
-
|
| 462 |
-
|
| 463 |
-
|
| 464 |
-
|
| 465 |
-
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
|
| 471 |
-
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
)
|
| 481 |
-
|
| 482 |
-
|
| 483 |
-
|
| 484 |
-
|
| 485 |
-
|
| 486 |
-
|
| 487 |
-
|
| 488 |
-
|
| 489 |
-
|
| 490 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 491 |
|
| 492 |
@staticmethod
|
| 493 |
def create_heatmap_timeline(scenarios: List[Dict[str, Any]]):
|
| 494 |
-
"""Create heatmap timeline of incidents"""
|
| 495 |
|
| 496 |
-
|
| 497 |
-
|
| 498 |
-
|
| 499 |
-
|
| 500 |
-
|
| 501 |
-
|
| 502 |
-
|
| 503 |
-
|
| 504 |
-
|
| 505 |
-
|
| 506 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 507 |
)
|
| 508 |
|
| 509 |
-
|
| 510 |
-
|
| 511 |
-
|
| 512 |
-
|
| 513 |
-
|
| 514 |
-
|
| 515 |
-
|
| 516 |
-
|
| 517 |
-
|
| 518 |
-
|
| 519 |
-
|
| 520 |
-
|
| 521 |
-
|
| 522 |
-
|
| 523 |
-
|
| 524 |
-
|
| 525 |
-
showscale=True,
|
| 526 |
-
hoverongaps=False,
|
| 527 |
-
hovertemplate='<b>%{x}</b><br>%{y}: %{z}<extra></extra>'
|
| 528 |
-
))
|
| 529 |
-
|
| 530 |
-
fig.update_layout(
|
| 531 |
-
title="๐ฅ Incident Heatmap Timeline",
|
| 532 |
-
xaxis_title="Scenarios",
|
| 533 |
-
yaxis_title="Metrics",
|
| 534 |
-
height=400,
|
| 535 |
-
xaxis={'tickangle': 45},
|
| 536 |
-
)
|
| 537 |
-
|
| 538 |
-
return fig
|
| 539 |
|
| 540 |
@staticmethod
|
| 541 |
def create_real_time_metrics_stream():
|
| 542 |
-
"""Create real-time streaming metrics visualization"""
|
| 543 |
-
|
| 544 |
-
# Generate sample streaming data
|
| 545 |
-
times = pd.date_range(start='now', periods=50, freq='1min')
|
| 546 |
-
values = np.cumsum(np.random.randn(50)) + 100
|
| 547 |
-
|
| 548 |
-
fig = go.Figure()
|
| 549 |
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
| 554 |
-
|
| 555 |
-
|
| 556 |
-
|
| 557 |
-
|
| 558 |
-
|
| 559 |
-
|
| 560 |
-
|
| 561 |
-
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
| 567 |
-
|
| 568 |
-
|
| 569 |
-
|
| 570 |
-
|
| 571 |
-
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 579 |
),
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
|
| 588 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 589 |
|
| 590 |
# ============================================================================
|
| 591 |
# EXPORT ENGINE
|
|
@@ -682,7 +842,7 @@ class ExportEngine:
|
|
| 682 |
</table>
|
| 683 |
|
| 684 |
<div class="footer">
|
| 685 |
-
<p>ARF Ultimate Investor Demo v3.3.
|
| 686 |
<p>Confidential - For investor review only</p>
|
| 687 |
<p>Contact: enterprise@petterjuan.com | Website: https://arf.dev</p>
|
| 688 |
</div>
|
|
@@ -691,80 +851,6 @@ class ExportEngine:
|
|
| 691 |
"""
|
| 692 |
|
| 693 |
return html
|
| 694 |
-
|
| 695 |
-
@staticmethod
|
| 696 |
-
def export_compliance_report(compliance_data: Dict[str, Any], format: str = "html") -> str:
|
| 697 |
-
"""Export compliance report in specified format"""
|
| 698 |
-
|
| 699 |
-
if format == "html":
|
| 700 |
-
return ExportEngine._compliance_to_html(compliance_data)
|
| 701 |
-
else:
|
| 702 |
-
# Return as JSON for other formats
|
| 703 |
-
return json.dumps(compliance_data, indent=2)
|
| 704 |
-
|
| 705 |
-
@staticmethod
|
| 706 |
-
def _compliance_to_html(compliance_data: Dict[str, Any]) -> str:
|
| 707 |
-
"""Convert compliance data to HTML report"""
|
| 708 |
-
|
| 709 |
-
html = f"""
|
| 710 |
-
<!DOCTYPE html>
|
| 711 |
-
<html>
|
| 712 |
-
<head>
|
| 713 |
-
<title>ARF {compliance_data.get('standard', 'Compliance')} Report</title>
|
| 714 |
-
<style>
|
| 715 |
-
body {{ font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; margin: 40px; }}
|
| 716 |
-
.header {{ background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
|
| 717 |
-
color: white; padding: 30px; border-radius: 10px; margin-bottom: 30px; }}
|
| 718 |
-
.status-pass {{ color: #27ae60; font-weight: bold; }}
|
| 719 |
-
.status-fail {{ color: #e74c3c; font-weight: bold; }}
|
| 720 |
-
.finding-card {{ background: white; border-radius: 8px; padding: 15px;
|
| 721 |
-
margin: 10px 0; box-shadow: 0 2px 4px rgba(0,0,0,0.1);
|
| 722 |
-
border-left: 4px solid #3498db; }}
|
| 723 |
-
.footer {{ margin-top: 40px; padding-top: 20px; border-top: 1px solid #eee;
|
| 724 |
-
color: #666; font-size: 12px; }}
|
| 725 |
-
</style>
|
| 726 |
-
</head>
|
| 727 |
-
<body>
|
| 728 |
-
<div class="header">
|
| 729 |
-
<h1>๐ ARF {compliance_data.get('standard', 'Compliance')} Compliance Report</h1>
|
| 730 |
-
<p>Report ID: {compliance_data.get('report_id', 'N/A')} |
|
| 731 |
-
Generated: {compliance_data.get('generated_at', 'N/A')}</p>
|
| 732 |
-
<p>Period: {compliance_data.get('period', 'N/A')}</p>
|
| 733 |
-
</div>
|
| 734 |
-
|
| 735 |
-
<h2>โ
Executive Summary</h2>
|
| 736 |
-
<div class="finding-card">
|
| 737 |
-
<h3>{compliance_data.get('summary', 'No summary available')}</h3>
|
| 738 |
-
<p><strong>Estimated Audit Cost Savings:</strong> {compliance_data.get('estimated_audit_cost_savings', 'N/A')}</p>
|
| 739 |
-
</div>
|
| 740 |
-
|
| 741 |
-
<h2>๐ Detailed Findings</h2>
|
| 742 |
-
"""
|
| 743 |
-
|
| 744 |
-
# Add findings
|
| 745 |
-
findings = compliance_data.get('findings', {})
|
| 746 |
-
for key, value in findings.items():
|
| 747 |
-
status_class = "status-pass" if value in [True, "99.95%", "Complete"] else "status-fail"
|
| 748 |
-
display_value = "โ
PASS" if value is True else "โ FAIL" if value is False else str(value)
|
| 749 |
-
|
| 750 |
-
html += f"""
|
| 751 |
-
<div class="finding-card">
|
| 752 |
-
<h3>{key.replace('_', ' ').title()}</h3>
|
| 753 |
-
<p class="{status_class}">{display_value}</p>
|
| 754 |
-
</div>
|
| 755 |
-
"""
|
| 756 |
-
|
| 757 |
-
html += """
|
| 758 |
-
<div class="footer">
|
| 759 |
-
<p>This report was automatically generated by ARF Compliance Auditor</p>
|
| 760 |
-
<p>All findings are based on automated system analysis</p>
|
| 761 |
-
<p>Contact: enterprise@petterjuan.com | Compliance Hotline: +1-555-COMPLY</p>
|
| 762 |
-
</div>
|
| 763 |
-
</body>
|
| 764 |
-
</html>
|
| 765 |
-
"""
|
| 766 |
-
|
| 767 |
-
return html
|
| 768 |
|
| 769 |
# ============================================================================
|
| 770 |
# DEMO SCENARIOS - ENHANCED
|
|
@@ -898,11 +984,11 @@ ENTERPRISE_SCENARIOS = {
|
|
| 898 |
}
|
| 899 |
|
| 900 |
# ============================================================================
|
| 901 |
-
# MAIN DEMO UI -
|
| 902 |
# ============================================================================
|
| 903 |
|
| 904 |
def create_enhanced_demo():
|
| 905 |
-
"""Create enhanced ultimate investor demo UI"""
|
| 906 |
|
| 907 |
# Initialize enhanced components
|
| 908 |
business_calc = BusinessImpactCalculator()
|
|
@@ -913,9 +999,9 @@ def create_enhanced_demo():
|
|
| 913 |
export_engine = ExportEngine()
|
| 914 |
enterprise_servers = {}
|
| 915 |
|
| 916 |
-
with gr.Blocks(title="๐ ARF Ultimate Investor Demo v3.3.
|
| 917 |
gr.Markdown("""
|
| 918 |
-
# ๐ Agentic Reliability Framework - Ultimate Investor Demo v3.3.
|
| 919 |
### **From Cost Center to Profit Engine: 5.2ร ROI with Autonomous Reliability**
|
| 920 |
|
| 921 |
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
@@ -926,7 +1012,7 @@ def create_enhanced_demo():
|
|
| 926 |
<p style="margin: 5px 0;">Experience the full spectrum: <strong>OSS (Free) โ Enterprise (Paid)</strong></p>
|
| 927 |
</div>
|
| 928 |
<div style="text-align: right;">
|
| 929 |
-
<p style="margin: 0;">๐ <strong>v3.3.
|
| 930 |
<p style="margin: 0;">๐ Professional analytics & export features</p>
|
| 931 |
</div>
|
| 932 |
</div>
|
|
@@ -1071,10 +1157,35 @@ def create_enhanced_demo():
|
|
| 1071 |
label="๐ฎ Predictive Analytics Timeline",
|
| 1072 |
)
|
| 1073 |
|
| 1074 |
-
# Function to update scenario with enhanced visualization
|
| 1075 |
def update_scenario_enhanced(scenario_name, viz_type):
|
| 1076 |
scenario = ENTERPRISE_SCENARIOS.get(scenario_name, {})
|
| 1077 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1078 |
# Add to RAG graph
|
| 1079 |
incident_id = rag_visualizer.add_incident(
|
| 1080 |
component=scenario.get("component", "unknown"),
|
|
@@ -1083,27 +1194,51 @@ def create_enhanced_demo():
|
|
| 1083 |
|
| 1084 |
# Add prediction
|
| 1085 |
if "prediction" in scenario:
|
| 1086 |
-
|
| 1087 |
-
|
| 1088 |
-
|
| 1089 |
-
|
| 1090 |
-
|
| 1091 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1092 |
|
| 1093 |
# Select visualization based on type
|
| 1094 |
-
|
| 1095 |
-
|
| 1096 |
-
|
| 1097 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1098 |
)
|
| 1099 |
-
elif viz_type == "Heatmap":
|
| 1100 |
-
viz_fig = viz_engine.create_heatmap_timeline([scenario])
|
| 1101 |
-
else: # Stream
|
| 1102 |
-
viz_fig = viz_engine.create_real_time_metrics_stream()
|
| 1103 |
|
| 1104 |
return {
|
| 1105 |
metrics_display: scenario.get("metrics", {}),
|
| 1106 |
-
impact_display:
|
| 1107 |
rag_graph: rag_visualizer.get_graph_figure(),
|
| 1108 |
predictive_timeline: predictive_viz.get_predictive_timeline(),
|
| 1109 |
performance_chart: viz_fig,
|
|
@@ -1159,11 +1294,12 @@ def create_enhanced_demo():
|
|
| 1159 |
live_dashboard.add_execution_result(result["revenue_protected"])
|
| 1160 |
|
| 1161 |
# Add to RAG graph
|
| 1162 |
-
rag_visualizer.
|
| 1163 |
-
|
| 1164 |
-
|
| 1165 |
-
|
| 1166 |
-
|
|
|
|
| 1167 |
|
| 1168 |
# Update dashboard displays
|
| 1169 |
dashboard_data = live_dashboard.get_dashboard_data()
|
|
@@ -1178,6 +1314,13 @@ def create_enhanced_demo():
|
|
| 1178 |
revenue_protected: f"### ๐ฐ Revenue Protected\n**{dashboard_data['revenue_protected']}**",
|
| 1179 |
auto_heal_rate: f"### โก Auto-Heal Rate\n**{dashboard_data['auto_heal_rate']}**",
|
| 1180 |
engineer_hours: f"### ๐ท Engineer Hours Saved\n**{dashboard_data['engineer_hours_saved']}**",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1181 |
}
|
| 1182 |
|
| 1183 |
# Connect events
|
|
@@ -1203,7 +1346,7 @@ def create_enhanced_demo():
|
|
| 1203 |
enterprise_action_btn.click(
|
| 1204 |
fn=enterprise_execution,
|
| 1205 |
inputs=[scenario_selector, license_input, execution_mode],
|
| 1206 |
-
outputs=[result_display, rag_graph, revenue_protected, auto_heal_rate, engineer_hours]
|
| 1207 |
)
|
| 1208 |
|
| 1209 |
# ================================================================
|
|
@@ -1413,6 +1556,14 @@ def create_enhanced_demo():
|
|
| 1413 |
mttr_reduction = 0.94 # 94% faster
|
| 1414 |
engineer_time_savings = 0.85 # 85% less engineer time
|
| 1415 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1416 |
# Calculations
|
| 1417 |
manual_incidents = incidents * (1 - auto_heal_rate)
|
| 1418 |
auto_healed = incidents * auto_heal_rate
|
|
@@ -1434,7 +1585,7 @@ def create_enhanced_demo():
|
|
| 1434 |
|
| 1435 |
# ROI
|
| 1436 |
payback_months = implementation_cost / monthly_savings if monthly_savings > 0 else 999
|
| 1437 |
-
first_year_roi = ((annual_savings - implementation_cost) / implementation_cost) * 100
|
| 1438 |
|
| 1439 |
# Create chart
|
| 1440 |
fig = go.Figure(data=[
|
|
@@ -1505,7 +1656,7 @@ def create_enhanced_demo():
|
|
| 1505 |
</div>
|
| 1506 |
|
| 1507 |
<div style="text-align: center; padding: 15px; background: #2c3e50; color: white; border-radius: 5px; margin-top: 20px;">
|
| 1508 |
-
<p style="margin: 0;">๐ ARF Ultimate Investor Demo v3.3.
|
| 1509 |
<p style="margin: 5px 0 0 0; font-size: 12px;">Built with โค๏ธ using Gradio & Plotly</p>
|
| 1510 |
</div>
|
| 1511 |
""")
|
|
@@ -1522,7 +1673,7 @@ def main():
|
|
| 1522 |
logger = logging.getLogger(__name__)
|
| 1523 |
|
| 1524 |
logger.info("=" * 80)
|
| 1525 |
-
logger.info("๐ Starting ARF Ultimate Investor Demo v3.3.
|
| 1526 |
logger.info("=" * 80)
|
| 1527 |
|
| 1528 |
demo = create_enhanced_demo()
|
|
|
|
| 1 |
"""
|
| 2 |
+
๐ ARF ULTIMATE INVESTOR DEMO v3.3.8
|
| 3 |
Enhanced with professional visualizations, export features, and data persistence
|
| 4 |
+
FIXED VERSION: All visualization errors resolved
|
| 5 |
"""
|
| 6 |
|
| 7 |
import asyncio
|
|
|
|
| 123 |
def get_graph_figure(self):
|
| 124 |
"""Create Plotly figure of RAG graph"""
|
| 125 |
if not self.incidents:
|
| 126 |
+
# Return empty figure with message
|
| 127 |
+
fig = go.Figure()
|
| 128 |
+
fig.update_layout(
|
| 129 |
+
title="๐ง RAG Graph Memory - Learning from Incidents",
|
| 130 |
+
xaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
|
| 131 |
+
yaxis=dict(showgrid=False, zeroline=False, showticklabels=False),
|
| 132 |
+
plot_bgcolor="white",
|
| 133 |
+
height=500,
|
| 134 |
+
annotations=[dict(
|
| 135 |
+
text="No incidents recorded yet. Try a scenario!",
|
| 136 |
+
xref="paper", yref="paper",
|
| 137 |
+
x=0.5, y=0.5, showarrow=False,
|
| 138 |
+
font=dict(size=16, color="gray")
|
| 139 |
+
)]
|
| 140 |
+
)
|
| 141 |
+
return fig
|
| 142 |
|
| 143 |
# Prepare node data
|
| 144 |
nodes = []
|
|
|
|
| 257 |
def get_predictive_timeline(self):
|
| 258 |
"""Create predictive timeline visualization"""
|
| 259 |
if not self.predictions:
|
| 260 |
+
# Return empty figure with message
|
| 261 |
+
fig = go.Figure()
|
| 262 |
+
fig.update_layout(
|
| 263 |
+
title="๐ฎ Predictive Analytics Timeline",
|
| 264 |
+
xaxis_title="Time",
|
| 265 |
+
yaxis_title="Metric Value",
|
| 266 |
+
height=400,
|
| 267 |
+
plot_bgcolor="white",
|
| 268 |
+
annotations=[dict(
|
| 269 |
+
text="No predictions yet. Try a scenario!",
|
| 270 |
+
xref="paper", yref="paper",
|
| 271 |
+
x=0.5, y=0.5, showarrow=False,
|
| 272 |
+
font=dict(size=14, color="gray")
|
| 273 |
+
)]
|
| 274 |
+
)
|
| 275 |
+
return fig
|
| 276 |
+
|
| 277 |
+
# Create timeline data - ensure we have valid data
|
| 278 |
+
valid_predictions = []
|
| 279 |
+
for p in self.predictions[-10:]: # Last 10 predictions
|
| 280 |
+
if isinstance(p.get("current"), (int, float)) and isinstance(p.get("predicted"), (int, float)):
|
| 281 |
+
valid_predictions.append(p)
|
| 282 |
+
|
| 283 |
+
if not valid_predictions:
|
| 284 |
+
# Return empty figure
|
| 285 |
+
fig = go.Figure()
|
| 286 |
+
fig.update_layout(
|
| 287 |
+
title="๐ฎ Predictive Analytics Timeline",
|
| 288 |
+
height=400,
|
| 289 |
+
annotations=[dict(
|
| 290 |
+
text="Waiting for prediction data...",
|
| 291 |
+
xref="paper", yref="paper",
|
| 292 |
+
x=0.5, y=0.5, showarrow=False
|
| 293 |
+
)]
|
| 294 |
+
)
|
| 295 |
+
return fig
|
| 296 |
|
| 297 |
+
df = pd.DataFrame(valid_predictions)
|
|
|
|
| 298 |
|
| 299 |
fig = go.Figure()
|
| 300 |
|
|
|
|
| 320 |
|
| 321 |
# Add threshold warning if applicable
|
| 322 |
for i, row in df.iterrows():
|
| 323 |
+
if row["time_to_threshold"] and isinstance(row["time_to_threshold"], (int, float)) and row["time_to_threshold"] < 30:
|
| 324 |
fig.add_annotation(
|
| 325 |
x=row["predicted_at"],
|
| 326 |
y=row["predicted"],
|
|
|
|
| 486 |
}
|
| 487 |
|
| 488 |
# ============================================================================
|
| 489 |
+
# ENHANCED VISUALIZATION ENGINE - FIXED VERSION
|
| 490 |
# ============================================================================
|
| 491 |
|
| 492 |
class EnhancedVisualizationEngine:
|
| 493 |
+
"""Enhanced visualization engine with animations and interactivity - FIXED"""
|
| 494 |
|
| 495 |
@staticmethod
|
| 496 |
def create_animated_radar_chart(metrics: Dict[str, float], title: str = "Performance Radar"):
|
| 497 |
"""Create animated radar chart with smooth transitions"""
|
| 498 |
|
| 499 |
+
try:
|
| 500 |
+
# Filter out non-numeric values
|
| 501 |
+
numeric_metrics = {}
|
| 502 |
+
for key, value in metrics.items():
|
| 503 |
+
if isinstance(value, (int, float)):
|
| 504 |
+
numeric_metrics[key] = value
|
| 505 |
+
|
| 506 |
+
if not numeric_metrics:
|
| 507 |
+
# Return empty radar chart
|
| 508 |
+
fig = go.Figure()
|
| 509 |
+
fig.update_layout(
|
| 510 |
+
title=title,
|
| 511 |
+
polar=dict(
|
| 512 |
+
radialaxis=dict(visible=True, range=[0, 100])
|
| 513 |
+
),
|
| 514 |
+
height=400,
|
| 515 |
+
annotations=[dict(
|
| 516 |
+
text="No numeric metrics available",
|
| 517 |
+
xref="paper", yref="paper",
|
| 518 |
+
x=0.5, y=0.5, showarrow=False,
|
| 519 |
+
font=dict(size=14, color="gray")
|
| 520 |
+
)]
|
| 521 |
+
)
|
| 522 |
+
return fig
|
| 523 |
+
|
| 524 |
+
categories = list(numeric_metrics.keys())
|
| 525 |
+
values = list(numeric_metrics.values())
|
| 526 |
+
|
| 527 |
+
# Ensure we have at least 3 categories for radar chart
|
| 528 |
+
if len(categories) < 3:
|
| 529 |
+
# Duplicate categories to make radar work
|
| 530 |
+
while len(categories) < 3:
|
| 531 |
+
categories.append(f"Metric_{len(categories)}")
|
| 532 |
+
values.append(0)
|
| 533 |
+
|
| 534 |
+
# Create radar chart
|
| 535 |
+
fig = go.Figure()
|
| 536 |
+
|
| 537 |
+
fig.add_trace(go.Scatterpolar(
|
| 538 |
+
r=values,
|
| 539 |
+
theta=categories,
|
| 540 |
+
fill='toself',
|
| 541 |
+
name='Current',
|
| 542 |
+
line_color='#4CAF50',
|
| 543 |
+
opacity=0.8
|
| 544 |
+
))
|
| 545 |
+
|
| 546 |
+
# Add ideal baseline (for comparison)
|
| 547 |
+
baseline_values = [max(values) * 0.8] * len(values) if values else [0] * len(categories)
|
| 548 |
+
fig.add_trace(go.Scatterpolar(
|
| 549 |
+
r=baseline_values,
|
| 550 |
+
theta=categories,
|
| 551 |
+
fill='toself',
|
| 552 |
+
name='Ideal Baseline',
|
| 553 |
+
line_color='#2196F3',
|
| 554 |
+
opacity=0.3
|
| 555 |
+
))
|
| 556 |
+
|
| 557 |
+
fig.update_layout(
|
| 558 |
+
polar=dict(
|
| 559 |
+
radialaxis=dict(
|
| 560 |
+
visible=True,
|
| 561 |
+
range=[0, max(values) * 1.2 if values else 100]
|
| 562 |
+
)),
|
| 563 |
+
showlegend=True,
|
| 564 |
+
title=title,
|
| 565 |
+
height=400,
|
| 566 |
+
animations=[{
|
| 567 |
+
'frame': {'duration': 500, 'redraw': True},
|
| 568 |
+
'transition': {'duration': 300, 'easing': 'cubic-in-out'},
|
| 569 |
+
}]
|
| 570 |
+
)
|
| 571 |
+
|
| 572 |
+
return fig
|
| 573 |
+
except Exception as e:
|
| 574 |
+
logging.error(f"Error creating radar chart: {e}")
|
| 575 |
+
# Return empty figure
|
| 576 |
+
fig = go.Figure()
|
| 577 |
+
fig.update_layout(
|
| 578 |
+
title=title,
|
| 579 |
+
height=400,
|
| 580 |
+
annotations=[dict(
|
| 581 |
+
text=f"Error loading radar chart",
|
| 582 |
+
xref="paper", yref="paper",
|
| 583 |
+
x=0.5, y=0.5, showarrow=False,
|
| 584 |
+
font=dict(size=14, color="red")
|
| 585 |
+
)]
|
| 586 |
+
)
|
| 587 |
+
return fig
|
| 588 |
|
| 589 |
@staticmethod
|
| 590 |
def create_heatmap_timeline(scenarios: List[Dict[str, Any]]):
|
| 591 |
+
"""Create heatmap timeline of incidents - FIXED"""
|
| 592 |
|
| 593 |
+
try:
|
| 594 |
+
if not scenarios:
|
| 595 |
+
# Return empty heatmap
|
| 596 |
+
fig = go.Figure()
|
| 597 |
+
fig.update_layout(
|
| 598 |
+
title="๐ฅ Incident Heatmap Timeline",
|
| 599 |
+
height=400,
|
| 600 |
+
annotations=[dict(
|
| 601 |
+
text="No scenario data available",
|
| 602 |
+
xref="paper", yref="paper",
|
| 603 |
+
x=0.5, y=0.5, showarrow=False,
|
| 604 |
+
font=dict(size=14, color="gray")
|
| 605 |
+
)]
|
| 606 |
+
)
|
| 607 |
+
return fig
|
| 608 |
+
|
| 609 |
+
# Prepare data
|
| 610 |
+
severity_map = {"critical": 3, "high": 2, "medium": 1, "low": 0}
|
| 611 |
+
|
| 612 |
+
data = []
|
| 613 |
+
for i, scenario in enumerate(scenarios):
|
| 614 |
+
impact = scenario.get("business_impact", {})
|
| 615 |
+
|
| 616 |
+
# Safely get severity value
|
| 617 |
+
revenue_risk = impact.get("revenue_at_risk", 0)
|
| 618 |
+
if not isinstance(revenue_risk, (int, float)):
|
| 619 |
+
revenue_risk = 0
|
| 620 |
+
|
| 621 |
+
severity_val = severity_map.get(
|
| 622 |
+
"critical" if revenue_risk > 1000000 else
|
| 623 |
+
"high" if revenue_risk > 500000 else
|
| 624 |
+
"medium" if revenue_risk > 100000 else "low",
|
| 625 |
+
0
|
| 626 |
+
)
|
| 627 |
+
|
| 628 |
+
description = scenario.get("description", "Unknown")
|
| 629 |
+
if len(description) > 30:
|
| 630 |
+
description = description[:27] + "..."
|
| 631 |
+
|
| 632 |
+
data.append({
|
| 633 |
+
"Scenario": description,
|
| 634 |
+
"Revenue Risk": revenue_risk,
|
| 635 |
+
"Users Impacted": impact.get("users_impacted", 0),
|
| 636 |
+
"Severity": severity_val,
|
| 637 |
+
"Time to Resolve": impact.get("time_to_resolve", 0),
|
| 638 |
+
})
|
| 639 |
+
|
| 640 |
+
df = pd.DataFrame(data)
|
| 641 |
+
|
| 642 |
+
# Ensure we have numeric data for heatmap
|
| 643 |
+
numeric_columns = ['Revenue Risk', 'Users Impacted', 'Severity', 'Time to Resolve']
|
| 644 |
+
for col in numeric_columns:
|
| 645 |
+
if col in df.columns:
|
| 646 |
+
df[col] = pd.to_numeric(df[col], errors='coerce').fillna(0)
|
| 647 |
+
|
| 648 |
+
# Create heatmap
|
| 649 |
+
fig = go.Figure(data=go.Heatmap(
|
| 650 |
+
z=df[numeric_columns].values.T,
|
| 651 |
+
x=df['Scenario'],
|
| 652 |
+
y=numeric_columns,
|
| 653 |
+
colorscale='RdYlGn_r', # Red to Green (reversed for severity)
|
| 654 |
+
showscale=True,
|
| 655 |
+
hoverongaps=False,
|
| 656 |
+
hovertemplate='<b>%{x}</b><br>%{y}: %{z}<extra></extra>'
|
| 657 |
+
))
|
| 658 |
+
|
| 659 |
+
fig.update_layout(
|
| 660 |
+
title="๐ฅ Incident Heatmap Timeline",
|
| 661 |
+
xaxis_title="Scenarios",
|
| 662 |
+
yaxis_title="Metrics",
|
| 663 |
+
height=400,
|
| 664 |
+
xaxis={'tickangle': 45},
|
| 665 |
)
|
| 666 |
|
| 667 |
+
return fig
|
| 668 |
+
except Exception as e:
|
| 669 |
+
logging.error(f"Error creating heatmap: {e}")
|
| 670 |
+
# Return empty figure
|
| 671 |
+
fig = go.Figure()
|
| 672 |
+
fig.update_layout(
|
| 673 |
+
title="๐ฅ Incident Heatmap Timeline",
|
| 674 |
+
height=400,
|
| 675 |
+
annotations=[dict(
|
| 676 |
+
text=f"Error loading heatmap",
|
| 677 |
+
xref="paper", yref="paper",
|
| 678 |
+
x=0.5, y=0.5, showarrow=False,
|
| 679 |
+
font=dict(size=14, color="red")
|
| 680 |
+
)]
|
| 681 |
+
)
|
| 682 |
+
return fig
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 683 |
|
| 684 |
@staticmethod
|
| 685 |
def create_real_time_metrics_stream():
|
| 686 |
+
"""Create real-time streaming metrics visualization - FIXED"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 687 |
|
| 688 |
+
try:
|
| 689 |
+
# Generate sample streaming data
|
| 690 |
+
times = pd.date_range(start='now', periods=50, freq='1min')
|
| 691 |
+
values = np.cumsum(np.random.randn(50)) + 100
|
| 692 |
+
|
| 693 |
+
fig = go.Figure()
|
| 694 |
+
|
| 695 |
+
fig.add_trace(go.Scatter(
|
| 696 |
+
x=times,
|
| 697 |
+
y=values,
|
| 698 |
+
mode='lines+markers',
|
| 699 |
+
name='System Health Score',
|
| 700 |
+
line=dict(color='#2196F3', width=3),
|
| 701 |
+
marker=dict(size=6),
|
| 702 |
+
hovertemplate='Time: %{x}<br>Score: %{y:.1f}<extra></extra>'
|
| 703 |
+
))
|
| 704 |
+
|
| 705 |
+
# Add threshold lines
|
| 706 |
+
fig.add_hline(y=95, line_dash="dash", line_color="green",
|
| 707 |
+
annotation_text="Optimal", annotation_position="right")
|
| 708 |
+
fig.add_hline(y=80, line_dash="dash", line_color="orange",
|
| 709 |
+
annotation_text="Warning", annotation_position="right")
|
| 710 |
+
fig.add_hline(y=70, line_dash="dash", line_color="red",
|
| 711 |
+
annotation_text="Critical", annotation_position="right")
|
| 712 |
+
|
| 713 |
+
# Add range slider
|
| 714 |
+
fig.update_layout(
|
| 715 |
+
title="๐ Real-time System Health Monitor",
|
| 716 |
+
xaxis=dict(
|
| 717 |
+
rangeselector=dict(
|
| 718 |
+
buttons=list([
|
| 719 |
+
dict(count=15, label="15m", step="minute", stepmode="backward"),
|
| 720 |
+
dict(count=1, label="1h", step="hour", stepmode="backward"),
|
| 721 |
+
dict(count=6, label="6h", step="hour", stepmode="backward"),
|
| 722 |
+
dict(step="all")
|
| 723 |
+
])
|
| 724 |
+
),
|
| 725 |
+
rangeslider=dict(visible=True),
|
| 726 |
+
type="date"
|
| 727 |
),
|
| 728 |
+
yaxis_title="Health Score",
|
| 729 |
+
height=400,
|
| 730 |
+
showlegend=True
|
| 731 |
+
)
|
| 732 |
+
|
| 733 |
+
return fig
|
| 734 |
+
except Exception as e:
|
| 735 |
+
logging.error(f"Error creating real-time metrics: {e}")
|
| 736 |
+
# Return empty figure
|
| 737 |
+
fig = go.Figure()
|
| 738 |
+
fig.update_layout(
|
| 739 |
+
title="๐ Real-time System Health Monitor",
|
| 740 |
+
height=400,
|
| 741 |
+
annotations=[dict(
|
| 742 |
+
text="Loading real-time data...",
|
| 743 |
+
xref="paper", yref="paper",
|
| 744 |
+
x=0.5, y=0.5, showarrow=False,
|
| 745 |
+
font=dict(size=14, color="gray")
|
| 746 |
+
)]
|
| 747 |
+
)
|
| 748 |
+
return fig
|
| 749 |
|
| 750 |
# ============================================================================
|
| 751 |
# EXPORT ENGINE
|
|
|
|
| 842 |
</table>
|
| 843 |
|
| 844 |
<div class="footer">
|
| 845 |
+
<p>ARF Ultimate Investor Demo v3.3.8 | Generated automatically</p>
|
| 846 |
<p>Confidential - For investor review only</p>
|
| 847 |
<p>Contact: enterprise@petterjuan.com | Website: https://arf.dev</p>
|
| 848 |
</div>
|
|
|
|
| 851 |
"""
|
| 852 |
|
| 853 |
return html
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 854 |
|
| 855 |
# ============================================================================
|
| 856 |
# DEMO SCENARIOS - ENHANCED
|
|
|
|
| 984 |
}
|
| 985 |
|
| 986 |
# ============================================================================
|
| 987 |
+
# MAIN DEMO UI - FIXED VERSION
|
| 988 |
# ============================================================================
|
| 989 |
|
| 990 |
def create_enhanced_demo():
|
| 991 |
+
"""Create enhanced ultimate investor demo UI - FIXED VERSION"""
|
| 992 |
|
| 993 |
# Initialize enhanced components
|
| 994 |
business_calc = BusinessImpactCalculator()
|
|
|
|
| 999 |
export_engine = ExportEngine()
|
| 1000 |
enterprise_servers = {}
|
| 1001 |
|
| 1002 |
+
with gr.Blocks(title="๐ ARF Ultimate Investor Demo v3.3.8") as demo:
|
| 1003 |
gr.Markdown("""
|
| 1004 |
+
# ๐ Agentic Reliability Framework - Ultimate Investor Demo v3.3.8
|
| 1005 |
### **From Cost Center to Profit Engine: 5.2ร ROI with Autonomous Reliability**
|
| 1006 |
|
| 1007 |
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
|
|
|
| 1012 |
<p style="margin: 5px 0;">Experience the full spectrum: <strong>OSS (Free) โ Enterprise (Paid)</strong></p>
|
| 1013 |
</div>
|
| 1014 |
<div style="text-align: right;">
|
| 1015 |
+
<p style="margin: 0;">๐ <strong>v3.3.8</strong> with enhanced visualizations</p>
|
| 1016 |
<p style="margin: 0;">๐ Professional analytics & export features</p>
|
| 1017 |
</div>
|
| 1018 |
</div>
|
|
|
|
| 1157 |
label="๐ฎ Predictive Analytics Timeline",
|
| 1158 |
)
|
| 1159 |
|
| 1160 |
+
# FIXED: Function to update scenario with enhanced visualization
|
| 1161 |
def update_scenario_enhanced(scenario_name, viz_type):
|
| 1162 |
scenario = ENTERPRISE_SCENARIOS.get(scenario_name, {})
|
| 1163 |
|
| 1164 |
+
# Check if scenario exists
|
| 1165 |
+
if not scenario:
|
| 1166 |
+
# Return empty figures for all visualizations
|
| 1167 |
+
empty_fig = go.Figure()
|
| 1168 |
+
empty_fig.update_layout(
|
| 1169 |
+
title="No scenario data available",
|
| 1170 |
+
height=400,
|
| 1171 |
+
annotations=[dict(
|
| 1172 |
+
text="Select a valid scenario",
|
| 1173 |
+
xref="paper", yref="paper",
|
| 1174 |
+
x=0.5, y=0.5, showarrow=False,
|
| 1175 |
+
font=dict(size=14, color="gray")
|
| 1176 |
+
)]
|
| 1177 |
+
)
|
| 1178 |
+
|
| 1179 |
+
return {
|
| 1180 |
+
metrics_display: {},
|
| 1181 |
+
impact_display: {},
|
| 1182 |
+
rag_graph: rag_visualizer.get_graph_figure(),
|
| 1183 |
+
predictive_timeline: predictive_viz.get_predictive_timeline(),
|
| 1184 |
+
performance_chart: empty_fig,
|
| 1185 |
+
incident_heatmap: empty_fig,
|
| 1186 |
+
real_time_metrics: viz_engine.create_real_time_metrics_stream(),
|
| 1187 |
+
}
|
| 1188 |
+
|
| 1189 |
# Add to RAG graph
|
| 1190 |
incident_id = rag_visualizer.add_incident(
|
| 1191 |
component=scenario.get("component", "unknown"),
|
|
|
|
| 1194 |
|
| 1195 |
# Add prediction
|
| 1196 |
if "prediction" in scenario:
|
| 1197 |
+
try:
|
| 1198 |
+
current_val = scenario["metrics"].get("latency_ms", 100)
|
| 1199 |
+
if isinstance(current_val, (int, float)):
|
| 1200 |
+
predictive_viz.add_prediction(
|
| 1201 |
+
metric="latency",
|
| 1202 |
+
current_value=current_val,
|
| 1203 |
+
predicted_value=current_val * 1.3,
|
| 1204 |
+
time_to_threshold=8.5 if "Black Friday" in scenario_name else None
|
| 1205 |
+
)
|
| 1206 |
+
except Exception as e:
|
| 1207 |
+
logging.error(f"Error adding prediction: {e}")
|
| 1208 |
+
|
| 1209 |
+
# Get impact analysis
|
| 1210 |
+
impact_analysis = {}
|
| 1211 |
+
if "business_impact" in scenario:
|
| 1212 |
+
impact_analysis = business_calc.calculate_impact(scenario["business_impact"])
|
| 1213 |
|
| 1214 |
# Select visualization based on type
|
| 1215 |
+
try:
|
| 1216 |
+
if viz_type == "Radar Chart":
|
| 1217 |
+
viz_fig = viz_engine.create_animated_radar_chart(
|
| 1218 |
+
scenario.get("metrics", {}),
|
| 1219 |
+
f"Performance Radar - {scenario_name[:20]}..."
|
| 1220 |
+
)
|
| 1221 |
+
elif viz_type == "Heatmap":
|
| 1222 |
+
viz_fig = viz_engine.create_heatmap_timeline([scenario])
|
| 1223 |
+
else: # Stream
|
| 1224 |
+
viz_fig = viz_engine.create_real_time_metrics_stream()
|
| 1225 |
+
except Exception as e:
|
| 1226 |
+
logging.error(f"Visualization error: {e}")
|
| 1227 |
+
viz_fig = go.Figure()
|
| 1228 |
+
viz_fig.update_layout(
|
| 1229 |
+
title=f"Visualization for {scenario_name[:20]}...",
|
| 1230 |
+
height=400,
|
| 1231 |
+
annotations=[dict(
|
| 1232 |
+
text="Error loading visualization",
|
| 1233 |
+
xref="paper", yref="paper",
|
| 1234 |
+
x=0.5, y=0.5, showarrow=False,
|
| 1235 |
+
font=dict(size=14, color="red")
|
| 1236 |
+
)]
|
| 1237 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1238 |
|
| 1239 |
return {
|
| 1240 |
metrics_display: scenario.get("metrics", {}),
|
| 1241 |
+
impact_display: impact_analysis,
|
| 1242 |
rag_graph: rag_visualizer.get_graph_figure(),
|
| 1243 |
predictive_timeline: predictive_viz.get_predictive_timeline(),
|
| 1244 |
performance_chart: viz_fig,
|
|
|
|
| 1294 |
live_dashboard.add_execution_result(result["revenue_protected"])
|
| 1295 |
|
| 1296 |
# Add to RAG graph
|
| 1297 |
+
if rag_visualizer.incidents:
|
| 1298 |
+
rag_visualizer.add_outcome(
|
| 1299 |
+
incident_id=rag_visualizer.incidents[-1]["id"],
|
| 1300 |
+
success=result["success"],
|
| 1301 |
+
action=healing_intent["action"]
|
| 1302 |
+
)
|
| 1303 |
|
| 1304 |
# Update dashboard displays
|
| 1305 |
dashboard_data = live_dashboard.get_dashboard_data()
|
|
|
|
| 1314 |
revenue_protected: f"### ๐ฐ Revenue Protected\n**{dashboard_data['revenue_protected']}**",
|
| 1315 |
auto_heal_rate: f"### โก Auto-Heal Rate\n**{dashboard_data['auto_heal_rate']}**",
|
| 1316 |
engineer_hours: f"### ๐ท Engineer Hours Saved\n**{dashboard_data['engineer_hours_saved']}**",
|
| 1317 |
+
incident_feed: [[
|
| 1318 |
+
datetime.datetime.now().strftime("%H:%M:%S"),
|
| 1319 |
+
scenario.get("component", "unknown"),
|
| 1320 |
+
f"${result['revenue_protected']:,.0f}",
|
| 1321 |
+
"โ
Resolved" if result["success"] else "โ ๏ธ Partial",
|
| 1322 |
+
f"${result['revenue_protected']:,.0f}"
|
| 1323 |
+
]],
|
| 1324 |
}
|
| 1325 |
|
| 1326 |
# Connect events
|
|
|
|
| 1346 |
enterprise_action_btn.click(
|
| 1347 |
fn=enterprise_execution,
|
| 1348 |
inputs=[scenario_selector, license_input, execution_mode],
|
| 1349 |
+
outputs=[result_display, rag_graph, revenue_protected, auto_heal_rate, engineer_hours, incident_feed]
|
| 1350 |
)
|
| 1351 |
|
| 1352 |
# ================================================================
|
|
|
|
| 1556 |
mttr_reduction = 0.94 # 94% faster
|
| 1557 |
engineer_time_savings = 0.85 # 85% less engineer time
|
| 1558 |
|
| 1559 |
+
# Ensure numeric values
|
| 1560 |
+
try:
|
| 1561 |
+
incidents = float(incidents) if incidents else 0
|
| 1562 |
+
team_size = float(team_size) if team_size else 0
|
| 1563 |
+
incident_cost = float(incident_cost) if incident_cost else 0
|
| 1564 |
+
except:
|
| 1565 |
+
incidents = team_size = incident_cost = 0
|
| 1566 |
+
|
| 1567 |
# Calculations
|
| 1568 |
manual_incidents = incidents * (1 - auto_heal_rate)
|
| 1569 |
auto_healed = incidents * auto_heal_rate
|
|
|
|
| 1585 |
|
| 1586 |
# ROI
|
| 1587 |
payback_months = implementation_cost / monthly_savings if monthly_savings > 0 else 999
|
| 1588 |
+
first_year_roi = ((annual_savings - implementation_cost) / implementation_cost) * 100 if implementation_cost > 0 else 0
|
| 1589 |
|
| 1590 |
# Create chart
|
| 1591 |
fig = go.Figure(data=[
|
|
|
|
| 1656 |
</div>
|
| 1657 |
|
| 1658 |
<div style="text-align: center; padding: 15px; background: #2c3e50; color: white; border-radius: 5px; margin-top: 20px;">
|
| 1659 |
+
<p style="margin: 0;">๐ ARF Ultimate Investor Demo v3.3.8 | Enhanced with Professional Analytics & Export Features</p>
|
| 1660 |
<p style="margin: 5px 0 0 0; font-size: 12px;">Built with โค๏ธ using Gradio & Plotly</p>
|
| 1661 |
</div>
|
| 1662 |
""")
|
|
|
|
| 1673 |
logger = logging.getLogger(__name__)
|
| 1674 |
|
| 1675 |
logger.info("=" * 80)
|
| 1676 |
+
logger.info("๐ Starting ARF Ultimate Investor Demo v3.3.8")
|
| 1677 |
logger.info("=" * 80)
|
| 1678 |
|
| 1679 |
demo = create_enhanced_demo()
|