GuglielmoTor commited on
Commit
f67d3fd
Β·
verified Β·
1 Parent(s): bde3d91

Update ui/insights_ui_generator.py

Browse files
Files changed (1) hide show
  1. ui/insights_ui_generator.py +21 -8
ui/insights_ui_generator.py CHANGED
@@ -27,7 +27,7 @@ def format_report_for_display(report_data: Optional[pd.Series]) -> Dict[str, str
27
  <div class="empty-state-icon">πŸ“„</div>
28
  <div class="empty-state-title">Report Not Available</div>
29
  <div class="empty-state-description">
30
- The selected report could not be loaded. Please try selecting a different report
31
  or refresh the page.
32
  </div>
33
  </div>
@@ -43,7 +43,7 @@ def format_report_for_display(report_data: Optional[pd.Series]) -> Dict[str, str
43
  # Generate dynamic title and subtitle
44
  title = "Comprehensive Analysis Report"
45
  subtitle = ""
46
-
47
  try:
48
  if report_type == 'Quarter':
49
  title = "πŸ“ˆ Quarterly Insights Report"
@@ -65,13 +65,26 @@ def format_report_for_display(report_data: Optional[pd.Series]) -> Dict[str, str
65
  {f'<p style="font-size: 1.1rem; color: #6b6b6b; margin-bottom: 0;">{subtitle}</p>' if subtitle else ''}
66
  </div>
67
  """
68
-
69
  # The report_text itself should be the raw Markdown for the body
70
  body_markdown = report_text.strip()
71
-
72
  return {'header_html': header_html, 'body_markdown': body_markdown}
73
 
74
- # The following functions (extract_key_results_for_selection, format_single_okr_for_display)
75
- # are no longer needed as their functionality is now handled by the new `ui/okr_ui_generator.py`
76
- # which directly formats the full OKR structure into HTML.
77
- # The 'format_report_to_markdown' function was also removed as it was redundant and not used.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  <div class="empty-state-icon">πŸ“„</div>
28
  <div class="empty-state-title">Report Not Available</div>
29
  <div class="empty-state-description">
30
+ The selected report could not be loaded. Please try selecting a different report
31
  or refresh the page.
32
  </div>
33
  </div>
 
43
  # Generate dynamic title and subtitle
44
  title = "Comprehensive Analysis Report"
45
  subtitle = ""
46
+
47
  try:
48
  if report_type == 'Quarter':
49
  title = "πŸ“ˆ Quarterly Insights Report"
 
65
  {f'<p style="font-size: 1.1rem; color: #6b6b6b; margin-bottom: 0;">{subtitle}</p>' if subtitle else ''}
66
  </div>
67
  """
68
+
69
  # The report_text itself should be the raw Markdown for the body
70
  body_markdown = report_text.strip()
71
+
72
  return {'header_html': header_html, 'body_markdown': body_markdown}
73
 
74
+
75
+ def format_report_to_markdown(report_string: Optional[str]) -> str:
76
+ """
77
+ This function was previously for general Markdown formatting.
78
+ Given the new structure where 'format_report_for_display' handles the split,
79
+ this function might become redundant or repurposed.
80
+ Keeping it for now but noting its potential redundancy depending on upstream calls.
81
+ """
82
+ if not report_string or not report_string.strip():
83
+ return "## Comprehensive Analysis Report\n\n*No analysis report was generated, or an error occurred during its generation.*"
84
+
85
+ # Simple formatting for now. Could be enhanced (e.g., looking for patterns like "Section X:" to make them H3)
86
+ formatted_report = f"## Comprehensive Analysis Report\n\n{report_string.strip()}"
87
+ return formatted_report
88
+
89
+ # REMOVED: extract_key_results_for_selection function
90
+ # REMOVED: format_single_okr_for_display function