Files
stonks-oracle/docs/sanitized-pipeline-deep-dive/diagrams/trend-accumulation-escalation.md
T
Celes Renata 88ad1e8d99 feat: comprehensive docs, unit tests, docker-compose app services
- Add scheduler and ingestion unit tests (test_scheduler_unit.py, test_ingestion_unit.py)
- Add all 13 app services + dashboard to docker-compose.yml
- Add full documentation suite: API reference, Helm reference, Docker deployment guide,
  3 architecture diagrams (K8s, Docker Compose, data pipeline), AI agent guide,
  backup/restore guide, observability/metrics reference, per-service docs
- Add intelligence pipeline deep-dive docs with Mermaid diagrams
- Update README with documentation index and links
- Add specs for comprehensive-quality-docs, intelligence-pipeline-deep-dive,
  sanitized-pipeline-docs
2026-04-22 02:56:41 +00:00

63 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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\n0.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
```