feat(analytics): add PSA activity logging and enhanced PSA metrics endpoint
- Log `note_posted` and `time_entry_posted` activities to `psa_activity_logs` after each successful PSA push in `psa_documentation_service.py`; errors are caught and logged without blocking the main push flow - Add `PsaFunnel`, `PsaDailyTrend`, and `EnhancedPsaMetrics` Pydantic schemas - Add `GET /analytics/flowpilot/psa-metrics?period=30d` endpoint (team_admin, rate-limited 15/min) returning time entry totals, push funnel (sessions → linked → doc pushed → time entry logged), and daily trend Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -87,6 +87,27 @@ class FlowQualityResponse(BaseModel):
|
||||
needs_attention: list[FlowQualityRow]
|
||||
|
||||
|
||||
class PsaFunnel(BaseModel):
|
||||
total_sessions: int
|
||||
linked_to_ticket: int
|
||||
doc_pushed: int
|
||||
time_entry_logged: int
|
||||
|
||||
|
||||
class PsaDailyTrend(BaseModel):
|
||||
date: str
|
||||
entries: int
|
||||
hours: float
|
||||
|
||||
|
||||
class EnhancedPsaMetrics(BaseModel):
|
||||
total_time_entries: int
|
||||
total_hours_logged: float
|
||||
avg_hours_per_session: float
|
||||
push_funnel: PsaFunnel
|
||||
daily_trend: list[PsaDailyTrend]
|
||||
|
||||
|
||||
class FlowPilotDashboard(BaseModel):
|
||||
period: str
|
||||
total_sessions: int
|
||||
|
||||
Reference in New Issue
Block a user