Spaces:
Sleeping
Sleeping
fix: Handle temporal dict format for revenue_cagr_3yr in analyzer
Browse filesThe metric was being passed as {value: X, end_date: Y} dict but
the formatter expected a scalar float. Added proper type checking.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- src/nodes/analyzer.py +6 -2
src/nodes/analyzer.py
CHANGED
|
@@ -759,8 +759,12 @@ def _format_metrics_for_prompt(extracted: dict, is_financial: bool = False) -> s
|
|
| 759 |
elif isinstance(revenue, (int, float)):
|
| 760 |
lines.append(f"- Revenue: ${revenue:,.0f}")
|
| 761 |
|
| 762 |
-
|
| 763 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 764 |
|
| 765 |
# Net margin with fiscal period
|
| 766 |
net_margin = fin.get("net_margin", {})
|
|
|
|
| 759 |
elif isinstance(revenue, (int, float)):
|
| 760 |
lines.append(f"- Revenue: ${revenue:,.0f}")
|
| 761 |
|
| 762 |
+
cagr = fin.get("revenue_cagr_3yr")
|
| 763 |
+
if cagr:
|
| 764 |
+
if isinstance(cagr, dict) and cagr.get("value") is not None:
|
| 765 |
+
lines.append(f"- Revenue CAGR (3yr): {cagr['value']:.1f}%")
|
| 766 |
+
elif isinstance(cagr, (int, float)):
|
| 767 |
+
lines.append(f"- Revenue CAGR (3yr): {cagr:.1f}%")
|
| 768 |
|
| 769 |
# Net margin with fiscal period
|
| 770 |
net_margin = fin.get("net_margin", {})
|