mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-24 09:11:13 -05:00
Implement ML Anomaly Detection
Introduce statistical anomaly detection for metrics via edge function, hooks, and UI components. Adds detection algorithms (z-score, moving average, rate of change), anomaly storage, auto-alerts, and dashboard rendering of detected anomalies with run-once trigger and scheduling guidance.
This commit is contained in:
@@ -202,6 +202,111 @@ export type Database = {
|
||||
}
|
||||
Relationships: []
|
||||
}
|
||||
anomaly_detection_config: {
|
||||
Row: {
|
||||
alert_threshold_score: number
|
||||
auto_create_alert: boolean
|
||||
created_at: string
|
||||
detection_algorithms: string[]
|
||||
enabled: boolean
|
||||
id: string
|
||||
lookback_window_minutes: number
|
||||
metric_category: string
|
||||
metric_name: string
|
||||
min_data_points: number
|
||||
sensitivity: number
|
||||
updated_at: string
|
||||
}
|
||||
Insert: {
|
||||
alert_threshold_score?: number
|
||||
auto_create_alert?: boolean
|
||||
created_at?: string
|
||||
detection_algorithms?: string[]
|
||||
enabled?: boolean
|
||||
id?: string
|
||||
lookback_window_minutes?: number
|
||||
metric_category: string
|
||||
metric_name: string
|
||||
min_data_points?: number
|
||||
sensitivity?: number
|
||||
updated_at?: string
|
||||
}
|
||||
Update: {
|
||||
alert_threshold_score?: number
|
||||
auto_create_alert?: boolean
|
||||
created_at?: string
|
||||
detection_algorithms?: string[]
|
||||
enabled?: boolean
|
||||
id?: string
|
||||
lookback_window_minutes?: number
|
||||
metric_category?: string
|
||||
metric_name?: string
|
||||
min_data_points?: number
|
||||
sensitivity?: number
|
||||
updated_at?: string
|
||||
}
|
||||
Relationships: []
|
||||
}
|
||||
anomaly_detections: {
|
||||
Row: {
|
||||
alert_created: boolean
|
||||
alert_id: string | null
|
||||
anomaly_type: string
|
||||
anomaly_value: number
|
||||
baseline_value: number
|
||||
confidence_score: number
|
||||
created_at: string
|
||||
detected_at: string
|
||||
detection_algorithm: string
|
||||
deviation_score: number
|
||||
id: string
|
||||
metadata: Json | null
|
||||
metric_category: string
|
||||
metric_name: string
|
||||
severity: string
|
||||
time_window_end: string
|
||||
time_window_start: string
|
||||
}
|
||||
Insert: {
|
||||
alert_created?: boolean
|
||||
alert_id?: string | null
|
||||
anomaly_type: string
|
||||
anomaly_value: number
|
||||
baseline_value: number
|
||||
confidence_score: number
|
||||
created_at?: string
|
||||
detected_at?: string
|
||||
detection_algorithm: string
|
||||
deviation_score: number
|
||||
id?: string
|
||||
metadata?: Json | null
|
||||
metric_category: string
|
||||
metric_name: string
|
||||
severity: string
|
||||
time_window_end: string
|
||||
time_window_start: string
|
||||
}
|
||||
Update: {
|
||||
alert_created?: boolean
|
||||
alert_id?: string | null
|
||||
anomaly_type?: string
|
||||
anomaly_value?: number
|
||||
baseline_value?: number
|
||||
confidence_score?: number
|
||||
created_at?: string
|
||||
detected_at?: string
|
||||
detection_algorithm?: string
|
||||
deviation_score?: number
|
||||
id?: string
|
||||
metadata?: Json | null
|
||||
metric_category?: string
|
||||
metric_name?: string
|
||||
severity?: string
|
||||
time_window_end?: string
|
||||
time_window_start?: string
|
||||
}
|
||||
Relationships: []
|
||||
}
|
||||
approval_transaction_metrics: {
|
||||
Row: {
|
||||
created_at: string | null
|
||||
@@ -1894,6 +1999,36 @@ export type Database = {
|
||||
}
|
||||
Relationships: []
|
||||
}
|
||||
metric_time_series: {
|
||||
Row: {
|
||||
created_at: string
|
||||
id: string
|
||||
metadata: Json | null
|
||||
metric_category: string
|
||||
metric_name: string
|
||||
metric_value: number
|
||||
timestamp: string
|
||||
}
|
||||
Insert: {
|
||||
created_at?: string
|
||||
id?: string
|
||||
metadata?: Json | null
|
||||
metric_category: string
|
||||
metric_name: string
|
||||
metric_value: number
|
||||
timestamp?: string
|
||||
}
|
||||
Update: {
|
||||
created_at?: string
|
||||
id?: string
|
||||
metadata?: Json | null
|
||||
metric_category?: string
|
||||
metric_name?: string
|
||||
metric_value?: number
|
||||
timestamp?: string
|
||||
}
|
||||
Relationships: []
|
||||
}
|
||||
moderation_audit_log: {
|
||||
Row: {
|
||||
action: string
|
||||
@@ -6270,6 +6405,28 @@ export type Database = {
|
||||
}
|
||||
Relationships: []
|
||||
}
|
||||
recent_anomalies_view: {
|
||||
Row: {
|
||||
alert_created: boolean | null
|
||||
alert_id: string | null
|
||||
alert_message: string | null
|
||||
alert_resolved_at: string | null
|
||||
anomaly_type: string | null
|
||||
anomaly_value: number | null
|
||||
baseline_value: number | null
|
||||
confidence_score: number | null
|
||||
detected_at: string | null
|
||||
detection_algorithm: string | null
|
||||
deviation_score: number | null
|
||||
id: string | null
|
||||
metric_category: string | null
|
||||
metric_name: string | null
|
||||
severity: string | null
|
||||
time_window_end: string | null
|
||||
time_window_start: string | null
|
||||
}
|
||||
Relationships: []
|
||||
}
|
||||
}
|
||||
Functions: {
|
||||
anonymize_user_submissions: {
|
||||
|
||||
Reference in New Issue
Block a user