alert

package
v0.0.0-...-1a3a2fa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 11, 2026 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const URLTagLength = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type Alert

type Alert struct {
	Base
	Talkgroup *talkgroups.Talkgroup
	TGName    string
	Score     trending.Score[talkgroups.ID]
	Context   []TxCtx
}

Alert is a fat Alert record for rendering using notify templates.

func Make

func Make(ctx context.Context, score trending.Score[talkgroups.ID], origScore float64) (Alert, error)

Make creates an alert for later rendering or storage.

func (*Alert) ComputeContextRange

func (a *Alert) ComputeContextRange()

func (*Alert) FillTranscriptContext

func (a *Alert) FillTranscriptContext(ctx context.Context, count uint, threshold, lookback jsontypes.Duration) error

type Base

type Base struct {
	ID            int               `json:"-"`
	Timestamp     time.Time         `json:"timestamp"`
	TGID          talkgroups.ID     `json:"tg"`
	OrigScore     float64           `json:"origScore,omitzero"`
	Weight        float32           `json:"weight"`
	Suppressed    bool              `json:"suppressed,omitzero"`
	ContextWindow *common.TimeRange `json:"contextWindow,omitempty"`
	URLTag        *string           `json:"urlTag,omitempty"`
}

func (*Base) GetResourceName

func (a *Base) GetResourceName() string

type RenderedAlert

type RenderedAlert struct {
	*Alert

	Subject string
	Body    string
	URL     string
}

type RenderedAlertBatch

type RenderedAlertBatch struct {
	Alerts   []RenderedAlert
	TopIdx   int
	TopScore float64
}

func (*RenderedAlertBatch) Top

type TxCtx

type TxCtx struct {
	Date       time.Time `json:"ts"`
	Transcript string    `json:"tx"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL