analytics

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2025 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyticsConfig

type AnalyticsConfig struct {
	PredictiveEnabled       bool          `json:"predictive_enabled"`
	TrendAnalysisEnabled    bool          `json:"trend_analysis_enabled"`
	AnomalyDetectionEnabled bool          `json:"anomaly_detection_enabled"`
	DataRetention           time.Duration `json:"data_retention"`
	AnalysisInterval        time.Duration `json:"analysis_interval"`
	AutoAnalysis            bool          `json:"auto_analysis"`
	NotificationEnabled     bool          `json:"notification_enabled"`
}

AnalyticsConfig represents configuration for the analytics service

type AnalyticsService

type AnalyticsService struct {
	// contains filtered or unexported fields
}

AnalyticsService provides a unified interface for analytics operations

func NewAnalyticsService

func NewAnalyticsService() *AnalyticsService

NewAnalyticsService creates a new analytics service

func (*AnalyticsService) AnalyzeTrends

func (as *AnalyticsService) AnalyzeTrends(ctx context.Context, data []DataPoint) (*TrendAnalysis, error)

AnalyzeTrends analyzes trends in data

func (*AnalyticsService) CreateForecaster

func (as *AnalyticsService) CreateForecaster(ctx context.Context, forecaster *Forecaster) error

CreateForecaster creates a new forecaster

func (*AnalyticsService) CreateModel

func (as *AnalyticsService) CreateModel(ctx context.Context, model *PredictiveModel) error

CreateModel creates a new predictive model

func (*AnalyticsService) DetectAnomalies

func (as *AnalyticsService) DetectAnomalies(ctx context.Context, data []DataPoint) (*AnomalyReport, error)

DetectAnomalies detects anomalies in data

func (*AnalyticsService) GenerateForecast

func (as *AnalyticsService) GenerateForecast(ctx context.Context, forecasterID string, data []DataPoint) (*Forecast, error)

GenerateForecast generates a forecast

func (*AnalyticsService) GetAnalyticsStatus

func (as *AnalyticsService) GetAnalyticsStatus(ctx context.Context) (*AnalyticsStatus, error)

GetAnalyticsStatus returns the overall analytics status

func (*AnalyticsService) GetAnomalyDetector

func (s *AnalyticsService) GetAnomalyDetector() *AnomalyDetector

GetAnomalyDetector returns the anomaly detector

func (*AnalyticsService) GetConfig

func (as *AnalyticsService) GetConfig() *AnalyticsConfig

GetConfig returns the current analytics service configuration

func (*AnalyticsService) GetPredictiveEngine

func (s *AnalyticsService) GetPredictiveEngine() *PredictiveEngine

GetPredictiveEngine returns the predictive engine

func (*AnalyticsService) GetTrendAnalyzer

func (s *AnalyticsService) GetTrendAnalyzer() *TrendAnalyzer

GetTrendAnalyzer returns the trend analyzer

func (*AnalyticsService) SetConfig

func (as *AnalyticsService) SetConfig(config *AnalyticsConfig)

SetConfig updates the analytics service configuration

func (*AnalyticsService) Start

func (as *AnalyticsService) Start(ctx context.Context) error

Start starts the analytics service

func (*AnalyticsService) Stop

func (as *AnalyticsService) Stop(ctx context.Context) error

Stop stops the analytics service

func (*AnalyticsService) TrainModel

func (as *AnalyticsService) TrainModel(ctx context.Context, modelID string, data []DataPoint) error

TrainModel trains a predictive model

type AnalyticsStatus

type AnalyticsStatus struct {
	OverallStatus string                 `json:"overall_status"`
	Models        map[string]int         `json:"models"`
	Forecasters   map[string]int         `json:"forecasters"`
	LastAnalysis  time.Time              `json:"last_analysis"`
	Metadata      map[string]interface{} `json:"metadata,omitempty"`
}

AnalyticsStatus represents the overall analytics status

type Anomaly

type Anomaly struct {
	ID         string                 `json:"id"`
	Timestamp  time.Time              `json:"timestamp"`
	Value      float64                `json:"value"`
	Expected   float64                `json:"expected"`
	Deviation  float64                `json:"deviation"`
	Severity   string                 `json:"severity"`   // low, medium, high, critical
	Type       string                 `json:"type"`       // statistical, trend, seasonal, etc.
	Confidence float64                `json:"confidence"` // 0-1 confidence score
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

Anomaly represents a detected anomaly

type AnomalyConfig

type AnomalyConfig struct {
	Sensitivity     float64       `json:"sensitivity"` // 0-1, lower = more sensitive
	WindowSize      int           `json:"window_size"`
	MinDataPoints   int           `json:"min_data_points"`
	RetentionPeriod time.Duration `json:"retention_period"`
	AutoThreshold   bool          `json:"auto_threshold"`
	Threshold       float64       `json:"threshold"`
}

AnomalyConfig represents configuration for anomaly detection

type AnomalyDetector

type AnomalyDetector struct {
	// contains filtered or unexported fields
}

AnomalyDetector detects anomalies in data

func NewAnomalyDetector

func NewAnomalyDetector() *AnomalyDetector

NewAnomalyDetector creates a new anomaly detector

func (*AnomalyDetector) DetectAnomalies

func (ad *AnomalyDetector) DetectAnomalies(ctx context.Context, data []DataPoint) (*AnomalyReport, error)

DetectAnomalies detects anomalies in data

func (*AnomalyDetector) GetConfig

func (ad *AnomalyDetector) GetConfig() *AnomalyConfig

GetConfig returns the current anomaly detector configuration

func (*AnomalyDetector) SetConfig

func (ad *AnomalyDetector) SetConfig(config *AnomalyConfig)

SetConfig updates the anomaly detector configuration

type AnomalyReport

type AnomalyReport struct {
	ID          string                 `json:"id"`
	Anomalies   []Anomaly              `json:"anomalies"`
	TotalCount  int                    `json:"total_count"`
	Severity    string                 `json:"severity"` // low, medium, high, critical
	GeneratedAt time.Time              `json:"generated_at"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

AnomalyReport represents the result of anomaly detection

type DataPoint

type DataPoint struct {
	Timestamp time.Time              `json:"timestamp"`
	Value     float64                `json:"value"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

DataPoint represents a data point for training/forecasting

type Forecast

type Forecast struct {
	ID           string                 `json:"id"`
	ForecasterID string                 `json:"forecaster_id"`
	Target       string                 `json:"target"`
	Predictions  []Prediction           `json:"predictions"`
	GeneratedAt  time.Time              `json:"generated_at"`
	Horizon      time.Duration          `json:"horizon"`
	Accuracy     float64                `json:"accuracy"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

Forecast represents a forecast result

type Forecaster

type Forecaster struct {
	ID        string                 `json:"id"`
	Name      string                 `json:"name"`
	ModelID   string                 `json:"model_id"`
	Target    string                 `json:"target"`    // what to forecast
	Horizon   time.Duration          `json:"horizon"`   // forecast horizon
	Frequency time.Duration          `json:"frequency"` // forecast frequency
	Enabled   bool                   `json:"enabled"`
	LastRun   time.Time              `json:"last_run"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

Forecaster represents a forecasting component

type Prediction

type Prediction struct {
	ID         string                 `json:"id"`
	ModelID    string                 `json:"model_id"`
	Target     string                 `json:"target"`
	Value      float64                `json:"value"`
	Confidence float64                `json:"confidence"` // 0-1 confidence score
	Timestamp  time.Time              `json:"timestamp"`
	Horizon    time.Duration          `json:"horizon"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

Prediction represents a prediction result

type PredictiveConfig

type PredictiveConfig struct {
	MaxModels        int           `json:"max_models"`
	TrainingInterval time.Duration `json:"training_interval"`
	ForecastInterval time.Duration `json:"forecast_interval"`
	DataRetention    time.Duration `json:"data_retention"`
	AutoTraining     bool          `json:"auto_training"`
	AutoForecasting  bool          `json:"auto_forecasting"`
}

PredictiveConfig represents configuration for the predictive engine

type PredictiveEngine

type PredictiveEngine struct {
	// contains filtered or unexported fields
}

PredictiveEngine provides predictive analytics capabilities

func NewPredictiveEngine

func NewPredictiveEngine() *PredictiveEngine

NewPredictiveEngine creates a new predictive analytics engine

func (*PredictiveEngine) CreateForecaster

func (pe *PredictiveEngine) CreateForecaster(ctx context.Context, forecaster *Forecaster) error

CreateForecaster creates a new forecaster

func (*PredictiveEngine) CreateModel

func (pe *PredictiveEngine) CreateModel(ctx context.Context, model *PredictiveModel) error

CreateModel creates a new predictive model

func (*PredictiveEngine) GenerateForecast

func (pe *PredictiveEngine) GenerateForecast(ctx context.Context, forecasterID string, data []DataPoint) (*Forecast, error)

GenerateForecast generates a forecast using a forecaster

func (*PredictiveEngine) GetConfig

func (pe *PredictiveEngine) GetConfig() *PredictiveConfig

GetConfig returns the current predictive engine configuration

func (*PredictiveEngine) GetForecaster

func (pe *PredictiveEngine) GetForecaster(ctx context.Context, forecasterID string) (*Forecaster, error)

GetForecaster retrieves a forecaster

func (*PredictiveEngine) GetModel

func (pe *PredictiveEngine) GetModel(ctx context.Context, modelID string) (*PredictiveModel, error)

GetModel retrieves a predictive model

func (*PredictiveEngine) ListForecasters

func (pe *PredictiveEngine) ListForecasters(ctx context.Context) ([]*Forecaster, error)

ListForecasters lists all forecasters

func (*PredictiveEngine) ListModels

func (pe *PredictiveEngine) ListModels(ctx context.Context) ([]*PredictiveModel, error)

ListModels lists all predictive models

func (*PredictiveEngine) SetConfig

func (pe *PredictiveEngine) SetConfig(config *PredictiveConfig)

SetConfig updates the predictive engine configuration

func (*PredictiveEngine) TrainModel

func (pe *PredictiveEngine) TrainModel(ctx context.Context, modelID string, data []DataPoint) error

TrainModel trains a predictive model

type PredictiveModel

type PredictiveModel struct {
	ID          string                 `json:"id"`
	Name        string                 `json:"name"`
	Type        string                 `json:"type"`     // linear, exponential, arima, lstm, etc.
	Category    string                 `json:"category"` // cost, performance, capacity, security
	Parameters  map[string]interface{} `json:"parameters"`
	Accuracy    float64                `json:"accuracy"`
	LastTrained time.Time              `json:"last_trained"`
	Status      string                 `json:"status"` // active, training, inactive
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

PredictiveModel represents a predictive model

type TrendAnalysis

type TrendAnalysis struct {
	ID          string                 `json:"id"`
	Trend       string                 `json:"trend"`      // increasing, decreasing, stable, volatile
	Strength    float64                `json:"strength"`   // 0-1 trend strength
	Direction   float64                `json:"direction"`  // slope of trend
	Volatility  float64                `json:"volatility"` // measure of volatility
	Seasonality bool                   `json:"seasonality"`
	Period      time.Duration          `json:"period,omitempty"`
	Confidence  float64                `json:"confidence"` // 0-1 confidence score
	GeneratedAt time.Time              `json:"generated_at"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

TrendAnalysis represents the result of trend analysis

type TrendAnalyzer

type TrendAnalyzer struct {
	// contains filtered or unexported fields
}

TrendAnalyzer analyzes trends in data

func NewTrendAnalyzer

func NewTrendAnalyzer() *TrendAnalyzer

NewTrendAnalyzer creates a new trend analyzer

func (*TrendAnalyzer) AnalyzeTrends

func (ta *TrendAnalyzer) AnalyzeTrends(ctx context.Context, data []DataPoint) (*TrendAnalysis, error)

AnalyzeTrends analyzes trends in data

func (*TrendAnalyzer) CalculateTrendPoints

func (ta *TrendAnalyzer) CalculateTrendPoints(ctx context.Context, data []DataPoint, windowSize int) ([]TrendPoint, error)

CalculateTrendPoints calculates trend points for visualization

func (*TrendAnalyzer) DetectTrendChanges

func (ta *TrendAnalyzer) DetectTrendChanges(ctx context.Context, data []DataPoint) ([]TrendChange, error)

DetectTrendChanges detects significant trend changes

func (*TrendAnalyzer) GetConfig

func (ta *TrendAnalyzer) GetConfig() *TrendConfig

GetConfig returns the current trend analyzer configuration

func (*TrendAnalyzer) SetConfig

func (ta *TrendAnalyzer) SetConfig(config *TrendConfig)

SetConfig updates the trend analyzer configuration

type TrendChange

type TrendChange struct {
	ID           string                 `json:"id"`
	Timestamp    time.Time              `json:"timestamp"`
	FromTrend    string                 `json:"from_trend"`
	ToTrend      string                 `json:"to_trend"`
	FromStrength float64                `json:"from_strength"`
	ToStrength   float64                `json:"to_strength"`
	Significance float64                `json:"significance"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

TrendChange represents a significant trend change

type TrendConfig

type TrendConfig struct {
	MinDataPoints   int           `json:"min_data_points"`
	WindowSize      int           `json:"window_size"`
	Sensitivity     float64       `json:"sensitivity"`
	RetentionPeriod time.Duration `json:"retention_period"`
}

TrendConfig represents configuration for trend analysis

type TrendPoint

type TrendPoint struct {
	Timestamp time.Time `json:"timestamp"`
	Value     float64   `json:"value"`
	Trend     string    `json:"trend"`
	Strength  float64   `json:"strength"`
}

TrendPoint represents a point in a trend

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL