# Trend Accumulation and Escalation ```mermaid flowchart TD subgraph Windows["Five Time Windows\nservices/aggregation/worker.py"] W1["intraday (12h)"] W2["1d (1 day)"] W3["7d (7 days)"] W4["30d (30 days)"] W5["90d (90 days)"] end W1 & W2 & W3 & W4 & W5 --> SIGNALS SIGNALS["Fetch signals per window\nEntity + Macro + Competitive\n→ WeightedSignal[]"] SIGNALS --> SENT["weighted_sentiment_average()\nCompute avg sentiment across signals"] SENT --> DIR subgraph DIR["derive_trend_direction()"] D1["avg_sentiment ≥ 0.15 → POSITIVE"] D2["avg_sentiment ≤ −0.15 → NEGATIVE"] D3["contradiction > 0.10\nAND |avg| < 0.30 → MIXED"] D4["otherwise → NEUTRAL"] end DIR --> CONF subgraph CONF["compute_trend_confidence()"] C1["Unique source count\ncaps at 15 → 0.8 contribution"] C2["Avg extraction credibility"] C3["Signal agreement ratio\ndampened by log₂(n+1)/log₂(8)\nsaturates ~7 unique sources"] C4["Contradiction penalty\n−0.4 × contradiction_score"] C5["confidence = 0.3×count + 0.3×credibility\n+ 0.4×agreement − penalty"] end CONF --> STRENGTH["trend_strength = |avg_sentiment|\nclamped to [0, 1]"] STRENGTH --> ESC subgraph ESC["Escalation Path\n(via eligibility thresholds)"] direction TB E1["NEUTRAL\nconfidence < 0.35\nOR strength < 0.10\nOR direction = neutral"] E2["OBSERVE\nstrength < 0.25\nAND confidence < 0.50"] E3["MONITOR\nstrength < 0.25\nAND confidence ≥ 0.50"] E4["ACT / DEFER\nstrength ≥ 0.25\nAND direction = positive/negative"] E1 -->|"More signals\nsame direction"| E2 E2 -->|"Confidence grows\nmore unique sources"| E3 E3 -->|"Strength exceeds 0.25\naccumulated evidence"| E4 end ESC --> PERSIST subgraph PERSIST["Persistence"] P1["trend_windows\n(upserted each cycle)"] P2["trend_history\n(time-series snapshots)"] P3["trend_evidence\n(per-document rankings)"] P4["trend_projections\nservices/aggregation/projection.py"] end ```