Spaces:
Configuration error
Configuration error
| """Analytics metric snapshot model.""" | |
| from datetime import datetime | |
| from typing import Optional, Dict, Any | |
| from pydantic import BaseModel, Field | |
| class MetricModel(BaseModel): | |
| metric_id: str = Field(..., description="Unique metric identifier (UUID)") | |
| metric_type: str = Field(..., description="Type of metric") | |
| merchant_id: str = Field(..., description="Merchant this metric belongs to") | |
| period: str = Field(..., description="Aggregation period: hourly | daily | weekly | monthly") | |
| period_start: datetime = Field(..., description="Start of the aggregation period") | |
| period_end: datetime = Field(..., description="End of the aggregation period") | |
| value: float = Field(..., description="Metric value") | |
| dimensions: Optional[Dict[str, Any]] = Field(None, description="Breakdown dimensions (source, category, etc.)") | |
| metadata: Optional[Dict[str, Any]] = Field(None) | |
| created_at: datetime = Field(default_factory=datetime.utcnow) | |
| updated_at: Optional[datetime] = Field(None) | |