Initial commit
Dieser Commit ist enthalten in:
79
domain/repositories/analytics_repository.py
Normale Datei
79
domain/repositories/analytics_repository.py
Normale Datei
@ -0,0 +1,79 @@
|
||||
"""
|
||||
Analytics repository interface.
|
||||
"""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import List, Dict, Optional
|
||||
from datetime import datetime
|
||||
|
||||
from domain.entities.account_creation_event import AccountCreationEvent
|
||||
from domain.entities.error_event import ErrorEvent
|
||||
from domain.value_objects.error_summary import ErrorSummary
|
||||
|
||||
|
||||
class IAnalyticsRepository(ABC):
|
||||
"""Interface for analytics data persistence."""
|
||||
|
||||
@abstractmethod
|
||||
def save_account_event(self, event: AccountCreationEvent) -> None:
|
||||
"""Save an account creation event."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def save_error_event(self, event: ErrorEvent) -> None:
|
||||
"""Save an error event."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_account_events(self, platform: str = None,
|
||||
start_date: datetime = None,
|
||||
end_date: datetime = None) -> List[AccountCreationEvent]:
|
||||
"""Get account creation events with optional filters."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_error_events(self, platform: str = None,
|
||||
error_type: str = None,
|
||||
start_date: datetime = None,
|
||||
end_date: datetime = None) -> List[ErrorEvent]:
|
||||
"""Get error events with optional filters."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_success_rate(self, platform: str = None,
|
||||
start_date: datetime = None,
|
||||
end_date: datetime = None) -> float:
|
||||
"""Calculate success rate for account creation."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_error_summary(self, platform: str = None,
|
||||
days: int = 7) -> ErrorSummary:
|
||||
"""Get error summary for specified period."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_platform_statistics(self) -> Dict[str, Dict[str, int]]:
|
||||
"""Get statistics grouped by platform."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_hourly_distribution(self, platform: str = None,
|
||||
days: int = 7) -> Dict[int, int]:
|
||||
"""Get hourly distribution of account creation."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_fingerprint_performance(self, fingerprint_id: str) -> Dict[str, any]:
|
||||
"""Get performance metrics for a specific fingerprint."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def get_proxy_performance(self, days: int = 7) -> Dict[str, Dict[str, int]]:
|
||||
"""Get proxy performance metrics."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def cleanup_old_events(self, days_to_keep: int = 30) -> int:
|
||||
"""Remove events older than specified days. Returns count deleted."""
|
||||
pass
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren