semantic-ds-toolkit
Version:
Performance-first semantic layer for modern data stacks - Stable Column Anchors & intelligent inference
107 lines • 3.58 kB
TypeScript
import { StableColumnAnchor, ColumnData } from '../types/anchor.types';
import { DriftType, DriftDetails } from './drift-detector';
export interface DriftAlert {
id: string;
timestamp: string;
severity: 'low' | 'medium' | 'high' | 'critical';
type: 'distribution' | 'format' | 'unit' | 'joinability' | 'confidence';
title: string;
description: string;
context: AlertContext;
remediation: RemediationPlan;
monitoring: MonitoringRecommendations;
business_impact: BusinessImpactAssessment;
technical_details: TechnicalDetails;
}
export interface AlertContext {
anchor_id: string;
column_name: string;
dataset_name?: string;
affected_rows: number;
detection_confidence: number;
historical_baseline: string;
drift_magnitude: number;
trend_analysis: TrendAnalysis;
}
export interface RemediationPlan {
immediate_actions: Action[];
investigative_steps: Action[];
long_term_solutions: Action[];
automation_opportunities: string[];
rollback_strategy?: string;
}
export interface Action {
action: string;
priority: 'urgent' | 'high' | 'medium' | 'low';
effort_estimate: string;
prerequisites: string[];
expected_outcome: string;
automation_available: boolean;
}
export interface MonitoringRecommendations {
increased_frequency: boolean;
alert_thresholds: {
warning: number;
critical: number;
};
additional_metrics: string[];
escalation_path: string[];
dashboard_updates: string[];
}
export interface BusinessImpactAssessment {
severity_score: number;
affected_processes: string[];
data_quality_impact: 'none' | 'minor' | 'moderate' | 'severe';
downstream_systems: string[];
customer_impact: 'none' | 'potential' | 'confirmed';
compliance_implications: string[];
}
export interface TechnicalDetails {
metric_values: Record<string, number>;
statistical_tests: Record<string, any>;
sample_comparisons: {
before: string[];
after: string[];
};
confidence_intervals: Record<string, [number, number]>;
historical_trends: HistoricalTrend[];
}
export interface TrendAnalysis {
direction: 'improving' | 'degrading' | 'stable' | 'volatile';
velocity: number;
acceleration: number;
prediction: {
next_period: number;
confidence: number;
};
}
export interface HistoricalTrend {
timestamp: string;
metric_value: number;
context: string;
}
export declare class AlertGenerator {
private readonly ALERT_TEMPLATES;
generateAlert(drift: DriftType, historicalAnchor: StableColumnAnchor, currentColumn: ColumnData, details: DriftDetails): Promise<DriftAlert>;
private generateAlertId;
private buildAlertContext;
private generateRemediationPlan;
private generateMonitoringRecommendations;
private assessBusinessImpact;
private compileTechnicalDetails;
private customizeTitle;
private generateDescription;
private calculateDetectionConfidence;
private analyzeTrend;
private simpleHash;
generateAlertsForBatch(drifts: DriftType[], anchors: StableColumnAnchor[], columns: ColumnData[], detailsList: DriftDetails[]): Promise<DriftAlert[]>;
prioritizeAlerts(alerts: DriftAlert[]): DriftAlert[];
summarizeAlerts(alerts: DriftAlert[]): {
total_alerts: number;
by_severity: Record<string, number>;
by_type: Record<string, number>;
critical_items: string[];
overall_health_score: number;
};
}
//# sourceMappingURL=alert-generator.d.ts.map