Skip to content

radiens_core.models.kpi

KPI (Key Performance Indicator) signal metrics domain models and enums.

Attributes

FlexKpiMetricId module-attribute

FlexKpiMetricId = (
    KpiMetricId
    | str
    | tuple[KpiModeStr | KpiMode, str | KpiMetric]
)

KpiMetricId that also accepts a metric name string or a (mode, name) tuple.

Examples::

# String shorthand — defaults to KpiMode.BASE
metrics = ["mean", "rms", "snr"]

# Tuple shorthand
metrics = [("base", "mean"), ("avg", "rms"), (KpiMode.STREAM, "snr")]

# Full object (pass-through)
metrics = [KpiMetricId(mode=KpiMode.BASE, name=KpiMetric.MEAN)]

Classes

KpiMetric

Bases: IntEnum

KPI metric identifier. Values match proto common.KpiMetricsEnum.

KpiMetricId

Bases: BaseModel

Identifies a single KPI metric (mode + name pair).

mode The computation mode (BASE, AVG, or STREAM). name The metric to compute.

KpiMetricsResult

Bases: BaseModel

Result of a KPI metrics query.

values is a 2-D numpy array of shape (n_channels, n_metrics) where rows correspond to channel_indices and columns to metrics.

channel_indices Native channel indices (ntvIdxs) in row order. metrics KPI metric IDs in column order. signal_type Signal type for all channels in this result. values Metric values: shape (n_channels, n_metrics). time_range Time range over which these metrics were computed.

KpiMode

Bases: IntEnum

KPI computation mode. Values match proto common.KpiMetricsMode.

KpiStatus

Bases: BaseModel

Status of the KPI computation cache.

stream_group_id Stream group or datasource ID this status belongs to. num_packets_memory Number of KPI packets held in memory. packet_dur Duration of each KPI packet in seconds. update_period How often the KPI cache is updated, in seconds. persistence Exponential averaging persistence factor. beta Beta parameter for the averaging filter. is_tracking_signal_cache Whether the KPI cache is currently tracking the live signal cache. num_packets Total number of packets processed. memory_bytes Approximate memory used by the KPI cache in bytes. num_sigs Number of signals being tracked (None if not yet active). time_range Time range covered by the current KPI cache (None if not yet active).