AccelerUpDocs
Data warehouse/SQL alerts/Directions

Directions

Let the data say whether a rise or a fall is the problem, per row.

Sometimes the same query returns rows where a rise is bad and rows where a fall is bad. A drift report is the usual example: for some segments a spike is the anomaly, for others a collapse is.

A direction column lets the row say which.

How it works

Add a text column to your query whose value names the direction:

sql
SELECT
    segment,
    drift_sigma,
    CASE WHEN observed > expected THEN 'spike' ELSE 'drop' END AS anomaly_kind
FROM ...

Name anomaly_kind as the condition's direction column. Each row is then evaluated with the operator and threshold that row's direction carries.

The vocabulary

AccelerUp recognises the words people actually put in these columns:

DirectionRecognised as
Upwardspike, up, rise, increase, above, high, over, gt
Downwarddrop, down, fall, decrease, below, low, under, lt
Eitherboth, any, either, abs

Matching is case-insensitive and ignores surrounding whitespace.

Mapping directions explicitly

The editor lists every distinct value your query emits in that column and lets you map each one:

For rows carrying…Do
spikegt 2.5, severity high
droplt -2.5, severity critical
seasonalnot alertable
unknown(unmapped — see below)

Each mapping can carry its own operator, its own threshold (or a band, with both ends), and its own severity.

Tip

"Either way" is a first-class option: it compares the absolute value, so a single threshold covers a move in both directions without two mappings.

Unmapped values

A row whose direction is not mapped reports a fault. It is not guessed at and it is not skipped.

Important

This is deliberate and it is the whole point of the feature. A wrong guess inverts the condition — alerting on a drop when the row meant a spike — and a silent skip turns a monitored row into an unmonitored one that still looks monitored. A fault is the only honest third option.

The editor pre-fills suggestions from the vocabulary above when you first pick the column, so the common cases are one click. A suggestion is a pre-fill, never a fallback: if you delete it, the value becomes unmapped again.

Bands per direction

A direction can carry a between or outside band rather than a single threshold. Both ends are required, and if you leave one blank the condition's own band is inherited.

When not to use this

If every row wants the same direction, do not add the column — set the operator on the condition. The direction column exists for genuinely mixed result sets, and adding one where it is not needed is an extra thing that can be wrong.

Where this behaviour lives: backend/internal/domain/dwh_direction.go. If the code and this page disagree, the code is right — please fix the page.

Part of Data warehouseQuerying the warehouse, and alerting on what the query returns.