1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//! Pattern records produced by analysis backends.
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
use sightloom_core::{EventId, PatternId, SubjectId};
/// Pattern kind tags.
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum PatternKind {
/// Time-of-day habit.
TimeOfDay,
/// Day-of-week habit.
DayOfWeek,
/// Visit periodicity.
VisitPeriodicity,
/// Dwell distribution.
DwellDistribution,
/// Route sequence.
RouteSequence,
/// Co-occurrence habit.
CoOccurrence,
/// Event-before-event chain.
EventBeforeEvent,
/// Expected absence window.
ExpectedAbsence,
/// Group formation.
GroupFormation,
/// Application-defined.
Custom,
}
/// Stored pattern record.
#[derive(Clone, Debug, PartialEq)]
pub struct PatternRecord {
/// Pattern id.
pub pattern_id: PatternId,
/// Kind.
pub kind: PatternKind,
/// Optional subject scope.
pub subject_id: Option<SubjectId>,
/// Confidence in `0.0..=1.0` (not clamped).
pub confidence: f32,
/// Supporting event ids.
pub evidence_events: Vec<EventId>,
/// Free-form host tag.
pub tag: u32,
}