Skip to main content

oxirs_embed/
enterprise_knowledge_engine.rs

1//! Recommendation engine, market analysis, and enterprise metrics types.
2
3use crate::enterprise_knowledge_product::CategoryPerformance;
4use chrono::{DateTime, Utc};
5use serde::{Deserialize, Serialize};
6use std::collections::HashMap;
7
8/// Recommendation engine
9#[derive(Debug, Clone)]
10pub struct RecommendationEngine {
11    /// Engine type
12    pub engine_type: RecommendationEngineType,
13    /// Model parameters
14    pub parameters: HashMap<String, f64>,
15    /// Performance metrics
16    pub performance: RecommendationPerformance,
17    /// Last update
18    pub last_update: DateTime<Utc>,
19}
20
21/// Types of recommendation engines
22#[derive(Debug, Clone)]
23pub enum RecommendationEngineType {
24    CollaborativeFiltering,
25    ContentBased,
26    MatrixFactorization,
27    DeepLearning,
28    Hybrid,
29}
30
31/// Recommendation engine performance
32#[derive(Debug, Clone, Serialize, Deserialize)]
33pub struct RecommendationPerformance {
34    /// Precision at K
35    pub precision_at_k: HashMap<u32, f64>,
36    /// Recall at K
37    pub recall_at_k: HashMap<u32, f64>,
38    /// NDCG scores
39    pub ndcg_scores: HashMap<u32, f64>,
40    /// Click-through rate
41    pub click_through_rate: f64,
42    /// Conversion rate
43    pub conversion_rate: f64,
44    /// Revenue impact
45    pub revenue_impact: f64,
46}
47
48/// Market analysis results
49#[derive(Debug, Clone, Serialize, Deserialize)]
50pub struct MarketAnalysis {
51    /// Performance by category
52    pub category_performance: HashMap<String, CategoryPerformance>,
53    /// Trending products
54    pub trending_products: Vec<String>,
55    /// Customer segment distribution
56    pub segment_distribution: HashMap<String, u32>,
57    /// Market opportunities
58    pub market_opportunities: Vec<String>,
59    /// Competitive landscape
60    pub competitive_landscape: HashMap<String, f64>,
61    /// Market forecast
62    pub forecast: HashMap<String, f64>,
63}
64
65/// Enterprise analytics and metrics
66#[derive(Debug, Clone, Serialize, Deserialize)]
67pub struct EnterpriseMetrics {
68    /// Total products
69    pub total_products: usize,
70    /// Total employees
71    pub total_employees: usize,
72    /// Total customers
73    pub total_customers: usize,
74    /// Total revenue
75    pub total_revenue: f64,
76    /// Average customer satisfaction
77    pub avg_customer_satisfaction: f64,
78    /// Employee engagement score
79    pub employee_engagement: f64,
80    /// Organizational efficiency
81    pub organizational_efficiency: f64,
82    /// Innovation index
83    pub innovation_index: f64,
84    /// Top performing products
85    pub top_products: Vec<String>,
86    /// Top performing employees
87    pub top_employees: Vec<String>,
88    /// High-value customers
89    pub high_value_customers: Vec<String>,
90}