From 5efccb1e03015a92f67182984bbe079e8c0c8ba4 Mon Sep 17 00:00:00 2001 From: Celes Renata Date: Fri, 17 Apr 2026 07:25:32 +0000 Subject: [PATCH] fix: deduplicate evidence refs in trend summaries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Backend: assemble_trend_with_evidence now deduplicates document IDs via dict.fromkeys() (the rollup code already did this, but the base assembly didn't — same doc could appear multiple times from different intelligence extractions). Frontend: Trends.tsx deduplicates via Set before rendering as a safety net for existing data already stored with duplicates. --- frontend/src/pages/Trends.tsx | 4 ++-- services/aggregation/worker.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/pages/Trends.tsx b/frontend/src/pages/Trends.tsx index 2fead84..433f622 100644 --- a/frontend/src/pages/Trends.tsx +++ b/frontend/src/pages/Trends.tsx @@ -103,10 +103,10 @@ function TrendCard({ trend, onClick }: { trend: TrendSummary; onClick: () => voi )} {expanded && (
- {trend.top_supporting_evidence?.map((e, i) => ( + {[...new Set(trend.top_supporting_evidence ?? [])].map((e, i) => ( ))} - {trend.top_opposing_evidence?.map((e, i) => ( + {[...new Set(trend.top_opposing_evidence ?? [])].map((e, i) => ( ))}
diff --git a/services/aggregation/worker.py b/services/aggregation/worker.py index 4e3f66d..39cab62 100644 --- a/services/aggregation/worker.py +++ b/services/aggregation/worker.py @@ -687,8 +687,8 @@ def assemble_trend_with_evidence( config = EvidenceRankConfig(max_refs=max_evidence) supporting_ranked, opposing_ranked = rank_evidence_detailed(signals, config) - supporting = [r.document_id for r in supporting_ranked] - opposing = [r.document_id for r in opposing_ranked] + supporting = list(dict.fromkeys(r.document_id for r in supporting_ranked)) + opposing = list(dict.fromkeys(r.document_id for r in opposing_ranked)) catalysts, risks = extract_catalysts_and_risks(impacts, signals)