Skip to main content

shape_runtime/metadata/
methods.rs

1//! Method metadata for Column and other generic types
2
3use super::types::MethodInfo;
4
5/// Get column methods
6pub fn column_methods() -> Vec<MethodInfo> {
7    vec![
8        // Implemented methods
9        MethodInfo {
10            name: "shift".to_string(),
11            signature: "shift(periods: Number) -> Column".to_string(),
12            description: "Shifts the series by specified periods".to_string(),
13            return_type: "Column".to_string(),
14            implemented: true,
15        },
16        MethodInfo {
17            name: "rolling".to_string(),
18            signature: "rolling(window: Number) -> RollingWindow".to_string(),
19            description: "Creates a rolling window over the series".to_string(),
20            return_type: "RollingWindow".to_string(),
21            implemented: true,
22        },
23        MethodInfo {
24            name: "mean".to_string(),
25            signature: "mean() -> Number".to_string(),
26            description: "Calculates the mean of the series".to_string(),
27            return_type: "Number".to_string(),
28            implemented: true,
29        },
30        MethodInfo {
31            name: "sum".to_string(),
32            signature: "sum() -> Number".to_string(),
33            description: "Calculates the sum of the series".to_string(),
34            return_type: "Number".to_string(),
35            implemented: true,
36        },
37        MethodInfo {
38            name: "min".to_string(),
39            signature: "min() -> Number".to_string(),
40            description: "Finds the minimum value in the series".to_string(),
41            return_type: "Number".to_string(),
42            implemented: true,
43        },
44        MethodInfo {
45            name: "max".to_string(),
46            signature: "max() -> Number".to_string(),
47            description: "Finds the maximum value in the series".to_string(),
48            return_type: "Number".to_string(),
49            implemented: true,
50        },
51        MethodInfo {
52            name: "first".to_string(),
53            signature: "first() -> Number".to_string(),
54            description: "Gets the first value in the series".to_string(),
55            return_type: "Number".to_string(),
56            implemented: true,
57        },
58        MethodInfo {
59            name: "last".to_string(),
60            signature: "last() -> Number".to_string(),
61            description: "Gets the last value in the series".to_string(),
62            return_type: "Number".to_string(),
63            implemented: true,
64        },
65        MethodInfo {
66            name: "diff".to_string(),
67            signature: "diff(periods?: Number) -> Column".to_string(),
68            description: "Computes differences between consecutive values".to_string(),
69            return_type: "Column".to_string(),
70            implemented: true,
71        },
72        MethodInfo {
73            name: "pct_change".to_string(),
74            signature: "pct_change(periods?: Number) -> Column".to_string(),
75            description: "Computes percentage change between values".to_string(),
76            return_type: "Column".to_string(),
77            implemented: true,
78        },
79        MethodInfo {
80            name: "slice".to_string(),
81            signature: "slice(start: Number, end: Number) -> Column".to_string(),
82            description: "Extracts a portion of the series".to_string(),
83            return_type: "Column".to_string(),
84            implemented: true,
85        },
86        MethodInfo {
87            name: "filter".to_string(),
88            signature: "filter(predicate: Function) -> Column".to_string(),
89            description: "Filters the series using a predicate function".to_string(),
90            return_type: "Column".to_string(),
91            implemented: true,
92        },
93        MethodInfo {
94            name: "map".to_string(),
95            signature: "map(transform: Function) -> Column".to_string(),
96            description: "Transforms each value in the series".to_string(),
97            return_type: "Column".to_string(),
98            implemented: true,
99        },
100        MethodInfo {
101            name: "reduce".to_string(),
102            signature: "reduce(reducer: Function, initial?: Any) -> Any".to_string(),
103            description: "Reduces the series to a single value".to_string(),
104            return_type: "Any".to_string(),
105            implemented: true,
106        },
107        MethodInfo {
108            name: "forEach".to_string(),
109            signature: "forEach(callback: Function) -> Unit".to_string(),
110            description: "Executes a function for each element".to_string(),
111            return_type: "Unit".to_string(),
112            implemented: true,
113        },
114        MethodInfo {
115            name: "find".to_string(),
116            signature: "find(predicate: Function) -> Any".to_string(),
117            description: "Finds the first element matching a predicate".to_string(),
118            return_type: "Any".to_string(),
119            implemented: true,
120        },
121        MethodInfo {
122            name: "some".to_string(),
123            signature: "some(predicate: Function) -> Boolean".to_string(),
124            description: "Tests if any element matches a predicate".to_string(),
125            return_type: "Boolean".to_string(),
126            implemented: true,
127        },
128        MethodInfo {
129            name: "every".to_string(),
130            signature: "every(predicate: Function) -> Boolean".to_string(),
131            description: "Tests if all elements match a predicate".to_string(),
132            return_type: "Boolean".to_string(),
133            implemented: true,
134        },
135        // Simulation method - generic event processing
136        MethodInfo {
137            name: "simulate".to_string(),
138            signature: "simulate(handler: Function, config?: Object) -> SimulationResult"
139                .to_string(),
140            description: "Runs a simulation over the series, calling handler for each element."
141                .to_string(),
142            return_type: "SimulationResult".to_string(),
143            implemented: true,
144        },
145        // Not yet implemented methods
146        MethodInfo {
147            name: "stddev".to_string(),
148            signature: "stddev() -> Number".to_string(),
149            description: "Calculates the standard deviation of the series".to_string(),
150            return_type: "Number".to_string(),
151            implemented: false,
152        },
153        MethodInfo {
154            name: "groupBy".to_string(),
155            signature: "groupBy(keyFn: Function) -> GroupedColumn".to_string(),
156            description: "Groups series elements by key".to_string(),
157            return_type: "GroupedColumn".to_string(),
158            implemented: false,
159        },
160        MethodInfo {
161            name: "resample".to_string(),
162            signature: "resample(target: String) -> Column".to_string(),
163            description: "Resamples the series to a different frequency/timeframe".to_string(),
164            return_type: "Column".to_string(),
165            implemented: false,
166        },
167    ]
168}