Full-stack Amazon AI Transcreation Platform with: - FastAPI backend (async, PostgreSQL, Redis, Celery) with 11 DB tables - JWT auth (SSO-ready abstract provider pattern) - 6-agent pipeline orchestrator with deterministic modules - Next.js 14 frontend with Amazon branding (Ember fonts, orange/dark theme) - Job wizard, monitoring HUD, output review, admin screens - 154 TM/reference files imported, 12 locales configured - Docker Compose for all services Agents 2-5 (TM retrieval, ranker, transcreator, compliance) are stubs pending Phase 3 LLM integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
50 lines
1.7 KiB
Python
50 lines
1.7 KiB
Python
from datetime import datetime
|
|
from typing import Any
|
|
from uuid import UUID
|
|
|
|
from fastapi import APIRouter, Depends, Query
|
|
from sqlalchemy.ext.asyncio import AsyncSession
|
|
|
|
from app.dependencies import get_current_user, get_db
|
|
from app.services.report_service import ReportService
|
|
|
|
router = APIRouter(prefix="/reports", tags=["reports"])
|
|
report_service = ReportService()
|
|
|
|
|
|
@router.get("/usage")
|
|
async def get_usage_stats(
|
|
client_id: UUID | None = Query(None),
|
|
date_from: datetime | None = Query(None),
|
|
date_to: datetime | None = Query(None),
|
|
db: AsyncSession = Depends(get_db),
|
|
current_user: dict = Depends(get_current_user),
|
|
) -> dict[str, Any]:
|
|
"""Get usage statistics (total jobs, tokens, cost, status breakdown)."""
|
|
return await report_service.get_usage_stats(
|
|
db, client_id=client_id, date_from=date_from, date_to=date_to
|
|
)
|
|
|
|
|
|
@router.get("/tokens")
|
|
async def get_token_cost_data(
|
|
client_id: UUID | None = Query(None),
|
|
date_from: datetime | None = Query(None),
|
|
date_to: datetime | None = Query(None),
|
|
db: AsyncSession = Depends(get_db),
|
|
current_user: dict = Depends(get_current_user),
|
|
) -> list[dict[str, Any]]:
|
|
"""Get token usage and cost data grouped by day."""
|
|
return await report_service.get_token_cost_data(
|
|
db, client_id=client_id, date_from=date_from, date_to=date_to
|
|
)
|
|
|
|
|
|
@router.get("/quality")
|
|
async def get_quality_metrics(
|
|
client_id: UUID | None = Query(None),
|
|
db: AsyncSession = Depends(get_db),
|
|
current_user: dict = Depends(get_current_user),
|
|
) -> dict[str, Any]:
|
|
"""Get quality metrics (confidence tier distribution, feedback stats)."""
|
|
return await report_service.get_quality_metrics(db, client_id=client_id)
|