Skip to content

Issue 5 (Alerts & scheduling 'newly risky today' pipeline + API integration tests) #4

Description

@abby-ql

Owner:

What’s already done: cross-match job exists and creates Alerts; API routes exist.
Goal: Make alerts pipeline demo-ready + add basic API integration tests.

Tasks

  • Add a scheduled-job simulation path:

    • e.g., scripts/run_daily_alerts.py that does: ingest trends → cross-match → print summary
  • Improve alert dedup logic if needed:

    • confirm what defines “duplicate” (currently item_id + trend_term)
    • optionally add “same day” logic if you want it
  • Add integration tests using FastAPI TestClient:

    • seed DB in test setup
    • call /trends/ingest in snapshot mode
    • call /alerts/run
    • verify /alerts returns alerts with expected structure

Acceptance criteria

  • One command can demo the “daily run”:

    • python -m scripts.run_daily_alerts --source snapshot
  • Integration tests exist: tests/test_api_flow.py

  • /alerts includes risk delta and explanation details (already mostly there; ensure stable schema)

Tests

  • pytest -q runs integration tests without network or API keys

Dependencies

  • Uses Issue 3 snapshot ingest mode (or embed snapshot ingestion in the script directly)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions