src.dackar.RCA.orchestrators.temporal_relations

Attributes

PRECEDES

OVERLAPS

CONTAINS

DURING

FOLLOWS

CAUSAL_PRIORITY

RELATION_SCORE

Classes

Interval

A closed time interval [start, end]. For point events set end == start.

Functions

allen_relation(a, b[, epsilon_hours, interval_type])

Classify the temporal relation of interval A relative to reference interval B.

onset_lag_hours(a, b)

Signed lag in hours from A onset to B onset (b.start − a.start).

Module Contents

src.dackar.RCA.orchestrators.temporal_relations.PRECEDES = 'precedes'[source]
src.dackar.RCA.orchestrators.temporal_relations.OVERLAPS = 'overlaps'[source]
src.dackar.RCA.orchestrators.temporal_relations.CONTAINS = 'contains'[source]
src.dackar.RCA.orchestrators.temporal_relations.DURING = 'during'[source]
src.dackar.RCA.orchestrators.temporal_relations.FOLLOWS = 'follows'[source]
src.dackar.RCA.orchestrators.temporal_relations.CAUSAL_PRIORITY: Tuple[str, ...][source]
src.dackar.RCA.orchestrators.temporal_relations.RELATION_SCORE: dict[str, float][source]
class src.dackar.RCA.orchestrators.temporal_relations.Interval[source]

A closed time interval [start, end]. For point events set end == start.

start: datetime.datetime[source]
end: datetime.datetime[source]
src.dackar.RCA.orchestrators.temporal_relations.allen_relation(a, b, epsilon_hours=0.5, interval_type='closed')[source]

Classify the temporal relation of interval A relative to reference interval B.

Returns (relation_name, base_rca_relevance_score).

b is the event interval; a is an anomaly or maintenance window. epsilon_hours absorbs timestamp noise and near-simultaneous boundary cases — boundaries within epsilon are treated as touching. interval_type controls whether anomaly endpoints are interpreted as closed/open when evaluating boundary-touching cases.

Decision logic (evaluated in order):

  1. FOLLOWS — a starts meaningfully after b ends

  2. PRECEDES — a ends meaningfully before b starts

  3. CONTAINS — a started before b AND ends after b (encompasses event)

  4. OVERLAPS — a started before b, ends within b (degradation active at onset)

  5. DURING — everything else: a started at or after b onset, including

    “started inside b and ended after b” (consequential anomaly)

Parameters:
Return type:

Tuple[str, float]

src.dackar.RCA.orchestrators.temporal_relations.onset_lag_hours(a, b)[source]

Signed lag in hours from A onset to B onset (b.start − a.start).

Positive → A predates B onset (causal candidate). Negative → A postdates B onset (symptom candidate).

Parameters:
Return type:

float