Spaces:
Sleeping
Sleeping
Fix: Include fiscal_year and form in fundamentals MCP output
Browse filesThe orchestrator's to_metric_dict helper was only returning value,
end_date, and data_type fields - missing fiscal_year and form which
are needed by the frontend to properly identify SEC EDGAR data.
Updated all three to_metric_dict helpers in orchestrator.py to include
the full temporal metadata from TemporalMetric.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
mcp-servers/fundamentals-basket/services/orchestrator.py
CHANGED
|
@@ -417,7 +417,7 @@ class OrchestratorService:
|
|
| 417 |
|
| 418 |
financials = self.parser.parse_financials(facts, ticker)
|
| 419 |
|
| 420 |
-
# Helper to convert TemporalMetric to dict
|
| 421 |
def to_metric_dict(tm):
|
| 422 |
if tm is None:
|
| 423 |
return None
|
|
@@ -425,6 +425,8 @@ class OrchestratorService:
|
|
| 425 |
"value": tm.value,
|
| 426 |
"end_date": tm.end_date,
|
| 427 |
"data_type": tm.data_type,
|
|
|
|
|
|
|
| 428 |
}
|
| 429 |
|
| 430 |
# Only 6 universal metrics (works across all industries)
|
|
@@ -455,7 +457,7 @@ class OrchestratorService:
|
|
| 455 |
|
| 456 |
financials, debt, cash_flow = self.parser.parse_yfinance_data(data, ticker)
|
| 457 |
|
| 458 |
-
# Helper to convert TemporalMetric to dict
|
| 459 |
def to_metric_dict(tm):
|
| 460 |
if tm is None:
|
| 461 |
return None
|
|
@@ -463,6 +465,8 @@ class OrchestratorService:
|
|
| 463 |
"value": tm.value,
|
| 464 |
"end_date": tm.end_date,
|
| 465 |
"data_type": tm.data_type,
|
|
|
|
|
|
|
| 466 |
}
|
| 467 |
|
| 468 |
# Only supplementary metrics not in SEC EDGAR (avoid duplicates)
|
|
@@ -491,6 +495,7 @@ class OrchestratorService:
|
|
| 491 |
|
| 492 |
financials, debt, cash_flow = self.parser.parse_yfinance_data(data, ticker)
|
| 493 |
|
|
|
|
| 494 |
def to_metric_dict(tm):
|
| 495 |
if tm is None:
|
| 496 |
return None
|
|
@@ -498,6 +503,8 @@ class OrchestratorService:
|
|
| 498 |
"value": tm.value,
|
| 499 |
"end_date": tm.end_date,
|
| 500 |
"data_type": tm.data_type,
|
|
|
|
|
|
|
| 501 |
}
|
| 502 |
|
| 503 |
# FALLBACK: Core metrics + supplementary metrics
|
|
|
|
| 417 |
|
| 418 |
financials = self.parser.parse_financials(facts, ticker)
|
| 419 |
|
| 420 |
+
# Helper to convert TemporalMetric to dict (include all temporal fields)
|
| 421 |
def to_metric_dict(tm):
|
| 422 |
if tm is None:
|
| 423 |
return None
|
|
|
|
| 425 |
"value": tm.value,
|
| 426 |
"end_date": tm.end_date,
|
| 427 |
"data_type": tm.data_type,
|
| 428 |
+
"fiscal_year": tm.fiscal_year,
|
| 429 |
+
"form": tm.form,
|
| 430 |
}
|
| 431 |
|
| 432 |
# Only 6 universal metrics (works across all industries)
|
|
|
|
| 457 |
|
| 458 |
financials, debt, cash_flow = self.parser.parse_yfinance_data(data, ticker)
|
| 459 |
|
| 460 |
+
# Helper to convert TemporalMetric to dict (include all temporal fields)
|
| 461 |
def to_metric_dict(tm):
|
| 462 |
if tm is None:
|
| 463 |
return None
|
|
|
|
| 465 |
"value": tm.value,
|
| 466 |
"end_date": tm.end_date,
|
| 467 |
"data_type": tm.data_type,
|
| 468 |
+
"fiscal_year": tm.fiscal_year,
|
| 469 |
+
"form": tm.form,
|
| 470 |
}
|
| 471 |
|
| 472 |
# Only supplementary metrics not in SEC EDGAR (avoid duplicates)
|
|
|
|
| 495 |
|
| 496 |
financials, debt, cash_flow = self.parser.parse_yfinance_data(data, ticker)
|
| 497 |
|
| 498 |
+
# Helper to convert TemporalMetric to dict (include all temporal fields)
|
| 499 |
def to_metric_dict(tm):
|
| 500 |
if tm is None:
|
| 501 |
return None
|
|
|
|
| 503 |
"value": tm.value,
|
| 504 |
"end_date": tm.end_date,
|
| 505 |
"data_type": tm.data_type,
|
| 506 |
+
"fiscal_year": tm.fiscal_year,
|
| 507 |
+
"form": tm.form,
|
| 508 |
}
|
| 509 |
|
| 510 |
# FALLBACK: Core metrics + supplementary metrics
|