Spaces:
Sleeping
Sleeping
Pass temporal fields through A2A to frontend
Browse files- Update research_gateway.py to extract temporal fields from partial_metrics
- Update researcher.py progress_callback to pass temporal data to add_metric
- Enables fiscal period display (FY 2023, Q3 2024) in Key Data panel
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- src/nodes/research_gateway.py +5 -1
- src/nodes/researcher.py +4 -2
src/nodes/research_gateway.py
CHANGED
|
@@ -146,9 +146,13 @@ async def wait_for_completion(
|
|
| 146 |
value = metric.get("value")
|
| 147 |
if not source or not metric_name:
|
| 148 |
continue
|
|
|
|
|
|
|
|
|
|
|
|
|
| 149 |
metric_key = f"{source}:{metric_name}:{value}"
|
| 150 |
if metric_key not in emitted_metrics:
|
| 151 |
-
progress_callback(source, metric_name, value)
|
| 152 |
emitted_metrics.add(metric_key)
|
| 153 |
|
| 154 |
if status == "completed":
|
|
|
|
| 146 |
value = metric.get("value")
|
| 147 |
if not source or not metric_name:
|
| 148 |
continue
|
| 149 |
+
# Extract temporal fields
|
| 150 |
+
end_date = metric.get("end_date")
|
| 151 |
+
fiscal_year = metric.get("fiscal_year")
|
| 152 |
+
form = metric.get("form")
|
| 153 |
metric_key = f"{source}:{metric_name}:{value}"
|
| 154 |
if metric_key not in emitted_metrics:
|
| 155 |
+
progress_callback(source, metric_name, value, end_date, fiscal_year, form)
|
| 156 |
emitted_metrics.add(metric_key)
|
| 157 |
|
| 158 |
if status == "completed":
|
src/nodes/researcher.py
CHANGED
|
@@ -76,11 +76,13 @@ def researcher_node(state, workflow_id=None, progress_store=None):
|
|
| 76 |
add_activity_log(workflow_id, step, message)
|
| 77 |
|
| 78 |
# Create progress callback for granular metric events
|
| 79 |
-
def progress_callback(source: str, metric: str, value
|
|
|
|
| 80 |
if workflow_id and progress_store:
|
| 81 |
# Import here to avoid circular imports
|
| 82 |
from src.services.workflow_store import add_metric
|
| 83 |
-
add_metric(workflow_id, source, metric, value
|
|
|
|
| 84 |
|
| 85 |
try:
|
| 86 |
# Fetch via Research Gateway (A2A protocol)
|
|
|
|
| 76 |
add_activity_log(workflow_id, step, message)
|
| 77 |
|
| 78 |
# Create progress callback for granular metric events
|
| 79 |
+
def progress_callback(source: str, metric: str, value,
|
| 80 |
+
end_date: str = None, fiscal_year: int = None, form: str = None):
|
| 81 |
if workflow_id and progress_store:
|
| 82 |
# Import here to avoid circular imports
|
| 83 |
from src.services.workflow_store import add_metric
|
| 84 |
+
add_metric(workflow_id, source, metric, value,
|
| 85 |
+
end_date=end_date, fiscal_year=fiscal_year, form=form)
|
| 86 |
|
| 87 |
try:
|
| 88 |
# Fetch via Research Gateway (A2A protocol)
|