feat: market events db migration + generation date filter

Database migration:
- Add 'origin' and 'source_refs' columns to market_events ALTER TABLE migration
  (sub_type/actual_value/expected_value/surprise_pct were already there)
- All new tables (macro_gauge_snapshots, ai_desks) created via CREATE TABLE IF NOT EXISTS
  on next init_db() call (container restart)

Backend:
- GET /api/market-events/db-status — health check returning row counts,
  latest dates, and missing columns for all 6 tables needed by the detector
- list_events() now accepts gen_date_from / gen_date_to query params
  filtering by date(created_at) — separate from start_date event date filters

Frontend (MarketEvents.tsx):
- MarketEvent interface: add created_at field
- EventRow: show generation date as MM-DD next to event date
- Extended filters: new ' Date de génération' section with from/to inputs
  filtered independently from the event date range
- Clear-all button includes genFrom/genTo reset

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
OpenSquared
2026-06-26 14:23:09 +02:00
parent d0816fd9ff
commit 325d52b3b9
3 changed files with 93 additions and 3 deletions

View File

@@ -774,6 +774,8 @@ def init_db():
("surprise_pct", "REAL DEFAULT NULL"),
("unit", "TEXT DEFAULT NULL"),
("sub_type", "TEXT DEFAULT NULL"),
("origin", "TEXT DEFAULT NULL"),
("source_refs", "TEXT DEFAULT '[]'"),
]:
try:
c.execute(f"ALTER TABLE market_events ADD COLUMN {_col} {_def}")