Skip to main content

shape_runtime/multi_table/
types.rs

1//! Result and data types for multi-series operations
2
3use super::config::AlignmentConfig;
4use crate::data::OwnedDataRow as RowValue;
5use chrono::{DateTime, Utc};
6use std::collections::HashMap;
7
8/// Result of multi-series alignment
9#[derive(Debug, Clone)]
10pub struct AlignedData {
11    /// Identifier names in order
12    pub ids: Vec<String>,
13    /// Aligned row data for each series
14    pub data: Vec<Vec<RowValue>>,
15    /// Common timestamps across all series
16    pub timestamps: Vec<i64>,
17    /// Alignment metadata
18    pub metadata: AlignmentMetadata,
19}
20
21/// Metadata about the alignment process
22#[derive(Debug, Clone)]
23pub struct AlignmentMetadata {
24    /// Total rows before alignment
25    pub original_count: HashMap<String, usize>,
26    /// Total rows after alignment
27    pub aligned_count: usize,
28    /// Number of gaps filled per series
29    pub gaps_filled: HashMap<String, usize>,
30    /// Time range of aligned data
31    pub time_range: (DateTime<Utc>, DateTime<Utc>),
32    /// Alignment configuration used
33    pub config: AlignmentConfig,
34}
35
36/// Divergence information
37#[derive(Debug, Clone)]
38pub struct Divergence {
39    pub timestamp: i64,
40    pub index: usize,
41    pub id1_trend: f64,
42    pub id2_trend: f64,
43    pub strength: f64,
44}
45
46/// Join type for temporal joins
47#[derive(Debug, Clone, Copy, PartialEq)]
48pub enum JoinType {
49    Inner,
50    Left,
51    Right,
52    Full,
53}