Skip to content

feat: Research Confidence Dashboard & Historical Analytics#3

Open
dobosmarton wants to merge 1 commit intomainfrom
feature/research-analytics-dashboard
Open

feat: Research Confidence Dashboard & Historical Analytics#3
dobosmarton wants to merge 1 commit intomainfrom
feature/research-analytics-dashboard

Conversation

@dobosmarton
Copy link
Copy Markdown
Owner

Summary

  • verdandi/models/analytics.py — frozen Pydantic response models (OverviewStats, ProviderAnalytics, ScoreAnalytics, PipelineAnalytics + detail types)
  • verdandi/analytics.py — analytics service using SQL aggregations via SQLAlchemy 2.0 Core (no Python loops over large result sets); date range filtering on all four functions
  • verdandi/api/routes/analytics.py — 4 FastAPI GET endpoints under /api/v1/analytics/{overview,providers,scores,pipeline} with ?from=YYYY-MM-DD&to=YYYY-MM-DD support; registered in app factory
  • verdandi/cli.pyverdandi analytics command group with overview, providers, scores, and pipeline subcommands (human-readable tabular output)
  • tests/test_analytics.py — 28 service unit tests against in-memory SQLite
  • tests/test_api/test_analytics.py — 25 FastAPI endpoint tests

All 486 tests pass (433 pre-existing + 53 new).

API endpoints

Method Path Description
GET /api/v1/analytics/overview Total experiments, GO rate, avg score, status breakdown
GET /api/v1/analytics/providers Per-provider call counts and success rates
GET /api/v1/analytics/scores 5-bucket histogram, daily trend, decision counts
GET /api/v1/analytics/pipeline Step completion counts, overall throughput

CLI commands

verdandi analytics overview [--from YYYY-MM-DD] [--to YYYY-MM-DD]
verdandi analytics providers [--from YYYY-MM-DD] [--to YYYY-MM-DD]
verdandi analytics scores [--from YYYY-MM-DD] [--to YYYY-MM-DD]
verdandi analytics pipeline [--from YYYY-MM-DD] [--to YYYY-MM-DD]

Test plan

  • pytest tests/test_analytics.py — 28 service-level unit tests (empty DB, date filters, GO rate, provider source parsing, score buckets, pipeline step counts)
  • pytest tests/test_api/test_analytics.py — 25 API endpoint tests (response shape, populated data, date filters, HTTP 200)
  • Full suite pytest tests/ — 486 tests pass, 0 failures

🤖 Generated with Claude Code

Adds a full analytics layer over historical experiment data:

- verdandi/models/analytics.py — frozen Pydantic models for all
  analytics responses (OverviewStats, ProviderAnalytics, ScoreAnalytics,
  PipelineAnalytics and supporting detail types)

- verdandi/analytics.py — analytics service using SQL aggregations via
  SQLAlchemy 2.0 Core; no Python-side loops over large result sets:
  * get_overview: status distribution, GO rate, avg score
  * get_provider_analytics: per-source call counts derived from
    deep_research search_results JSON + step_error log counts
  * get_score_analytics: 5-bucket histogram, daily trend, decision counts
  * get_pipeline_analytics: per-step completion counts, throughput
  All functions accept optional date_from/date_to YYYY-MM-DD filtering.

- verdandi/api/routes/analytics.py — 4 FastAPI GET endpoints under
  /api/v1/analytics/{overview,providers,scores,pipeline} with ?from=&to=
  query parameters; router registered in app factory

- verdandi/cli.py — analytics group with overview, providers,
  scores, and pipeline subcommands (human-readable tabular output)

- tests/test_analytics.py — 28 service unit tests (in-memory SQLite)
- tests/test_api/test_analytics.py — 25 FastAPI endpoint tests

All 486 tests pass (433 existing + 53 new).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant