Skip to main content

dsfb_srd/
event.rs

1use std::fmt;
2
3#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)]
4pub enum RegimeLabel {
5    Baseline,
6    Degradation,
7    Shock,
8    Recovery,
9}
10
11impl RegimeLabel {
12    pub fn as_str(self) -> &'static str {
13        match self {
14            Self::Baseline => "baseline",
15            Self::Degradation => "degradation",
16            Self::Shock => "shock",
17            Self::Recovery => "recovery",
18        }
19    }
20}
21
22impl fmt::Display for RegimeLabel {
23    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
24        f.write_str((*self).as_str())
25    }
26}
27
28#[derive(Clone, Debug)]
29pub struct StructuralEvent {
30    pub event_id: usize,
31    pub time_index: usize,
32    pub channel_id: usize,
33    pub latent_state: f64,
34    pub predicted_value: f64,
35    pub observed_value: f64,
36    pub residual: f64,
37    pub envelope: f64,
38    pub trust: f64,
39    pub regime_label: RegimeLabel,
40}