Skip to main content

nominal_api/conjure/objects/scout/compute/api/
stability_detection_ranges.rs

1/// Outputs a set of ranges where the input series is stable. For each point, the min and max are calculated over
2/// the specified lookback window, including the current point. A point is considered stable if its value does
3/// not deviate from the calculated min and the max by more than the threshold and the total number of points
4/// within the window is at least the specified amount. The threshold can be either fixed values or percentages
5/// of the value. The lookback window must be strictly positive. The minimum points threshold defaults to 2.
6#[derive(
7    Debug,
8    Clone,
9    conjure_object::serde::Serialize,
10    conjure_object::serde::Deserialize,
11    conjure_object::private::DeriveWith
12)]
13#[serde(crate = "conjure_object::serde")]
14#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
15#[conjure_object::private::staged_builder::staged_builder]
16#[builder(crate = conjure_object::private::staged_builder, update, inline)]
17pub struct StabilityDetectionRanges {
18    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
19    #[serde(rename = "input")]
20    input: Box<super::NumericSeries>,
21    #[builder(custom(type = super::StabilityWindowConfiguration, convert = Box::new))]
22    #[serde(rename = "windowConfiguration")]
23    window_configuration: Box<super::StabilityWindowConfiguration>,
24    #[builder(custom(type = super::Threshold, convert = Box::new))]
25    #[serde(rename = "threshold")]
26    threshold: Box<super::Threshold>,
27}
28impl StabilityDetectionRanges {
29    /// Constructs a new instance of the type.
30    #[inline]
31    pub fn new(
32        input: super::NumericSeries,
33        window_configuration: super::StabilityWindowConfiguration,
34        threshold: super::Threshold,
35    ) -> Self {
36        Self::builder()
37            .input(input)
38            .window_configuration(window_configuration)
39            .threshold(threshold)
40            .build()
41    }
42    #[inline]
43    pub fn input(&self) -> &super::NumericSeries {
44        &*self.input
45    }
46    #[inline]
47    pub fn window_configuration(&self) -> &super::StabilityWindowConfiguration {
48        &*self.window_configuration
49    }
50    #[inline]
51    pub fn threshold(&self) -> &super::Threshold {
52        &*self.threshold
53    }
54}