21 lines
397 B
Python
21 lines
397 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass, asdict
|
|
from typing import Dict, Any
|
|
import json
|
|
|
|
|
|
@dataclass
|
|
class AnomalySignal:
|
|
timestamp: float
|
|
anomaly_type: str
|
|
location: str
|
|
severity: str
|
|
confidence: float
|
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
return asdict(self)
|
|
|
|
def to_json(self) -> str:
|
|
return json.dumps(self.to_dict())
|