Owner:
What’s already done: app/core/trends.py already supports NewsAPI or RSS fallback; extraction logic exists; DB stores TrendTopic.
Goal: Make trends ingestion reliable for demo + backtesting without needing live APIs.
Tasks
Acceptance criteria
Tests
- Unit test:
extract_trend_terms() deterministically returns same top terms given a fixed input headline list
- Integration-ish test: snapshot ingest populates DB and endpoint returns them
Dependencies
- None (snapshot mode avoids any key/network dependency)
Owner:
What’s already done:
app/core/trends.pyalready supports NewsAPI or RSS fallback; extraction logic exists; DB stores TrendTopic.Goal: Make trends ingestion reliable for demo + backtesting without needing live APIs.
Tasks
Add offline ingest mode:
TRENDS_SOURCE=snapshot, loaddata/trends_snapshot_today.jsonand store it as TrendTopic rowsImprove extraction determinism:
Optional (nice to have): add GOV.UK Atom feed option as an alternative open-licensed UK source
Acceptance criteria
POST /trends/ingestworks in 3 modes:GET /trends/currentreturns consistent, sorted listTests
extract_trend_terms()deterministically returns same top terms given a fixed input headline listDependencies