iqengine_plugin/server/
annotation.rs

1#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
2pub struct Annotation {
3    /// A human-readable comment
4    #[serde(rename = "core:comment", skip_serializing_if = "Option::is_none")]
5    pub core_colon_comment: Option<String>,
6    /// The frequency (Hz) of the lower edge of the feature described by this annotation.
7    #[serde(
8        rename = "core:freq_lower_edge",
9        skip_serializing_if = "Option::is_none"
10    )]
11    pub core_colon_freq_lower_edge: Option<f32>,
12    /// The frequency (Hz) of the upper edge of the feature described by this annotation.
13    #[serde(
14        rename = "core:freq_upper_edge",
15        skip_serializing_if = "Option::is_none"
16    )]
17    pub core_colon_freq_upper_edge: Option<f32>,
18    /// Human-readable name of the entity that created this annotation.
19    #[serde(rename = "core:generator", skip_serializing_if = "Option::is_none")]
20    pub core_colon_generator: Option<String>,
21    /// A short form human/machine-readable label for the annotation. CAN BE USED TO LABEL CLASSIFIER OUTPUT
22    #[serde(rename = "core:label", skip_serializing_if = "Option::is_none")]
23    pub core_colon_label: Option<String>,
24    /// The number of samples that this Segment applies to.
25    #[serde(rename = "core:sample_count")]
26    pub core_colon_sample_count: i32,
27    /// The sample index at which this Segment takes effect
28    #[serde(rename = "core:sample_start")]
29    pub core_colon_sample_start: i32,
30    /// RFC-4122 unique identifier.
31    #[serde(rename = "core:uuid", skip_serializing_if = "Option::is_none")]
32    pub core_colon_uuid: Option<uuid::Uuid>,
33}
34
35impl Annotation {
36    pub fn new(core_colon_sample_count: i32, core_colon_sample_start: i32) -> Annotation {
37        Annotation {
38            core_colon_comment: None,
39            core_colon_freq_lower_edge: None,
40            core_colon_freq_upper_edge: None,
41            core_colon_generator: None,
42            core_colon_label: None,
43            core_colon_sample_count,
44            core_colon_sample_start,
45            core_colon_uuid: None,
46        }
47    }
48}