Skip to content
Updated Sep 26, 2026 by Barča Dvořáková · Owner: analysisactiveentityconfluence-migration Edit on GitHub

Entity: clientTolerance ​

Entity Definition ​

  • Entity Name: clientTolerance

  • Entity Type: Database table

  • Description: Stores per-client overrides to the system-wide consumption tolerance bands. A row exists only when the client has explicitly overridden the default (±20%). The lookup key is the combination of clientId, medium and primarySource. When no matching row exists, the system falls back to the hardcoded defaults.

    The same toleranceMin / toleranceMax values are used in two contexts: (1) validating manually entered reading values, and (2) detecting anomalous consumption in automated readings. The UI presents these as two separate sections on the Tolerances tab, but both read from this single entity. The UI slider is capped at ±25%.

    Invoice validation tolerances are not covered by this entity — they are out of scope for v1.

Data Attributes Table ​

Attribute NameDescriptionData TypeDefault ValueRequired (= Nullable)UniqueFormatValidationsIndexExample
idPrimary keyUUIDGenerated in code (app layer)YesYesUUID v7-Primary Key018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2
tenantIdTenant this record belongs to.UUID-YesNoUUID v7FK → tenant; must existname: idx_client_tolerance_tenantId, type: btree018fa51f-fda1-79f4-8461-2cb8f1cabc10
clientIdClient this tolerance override applies toUUID-YesNoUUID v7FK → client; must exist — see clientname: idx_client_tolerance_clientId, type: btree018fa51f-fda1-79f4-8461-2cb8f1cabc10
mediumEnergy medium this tolerance applies toString-YesNoSee Enum - GaugeMediumMust be a valid GaugeMedium string value. Composite unique with (clientId, primarySource).name: idx_client_tolerance_clientId_medium_primarySource, type: btree (unique)electricity
primarySourceEnergy medium this tolerance applies to. Null means the override applies to all sources of the medium.Integer-NoNoSee Enum - PrimarySourceNullable; must be a valid PrimarySource integer value if set-17
toleranceMinLower tolerance bound as a percentage deviation (negative value). Used for both manual reading validation and consumption anomaly detection. System default: −20. UI slider limit: −25.Integer-YesNo-Negative integer; range −25 to −1--20
toleranceMaxUpper tolerance bound as a percentage deviation (positive value). Used for both manual reading validation and consumption anomaly detection. System default: +20. UI slider limit: +25.Integer-YesNo-Positive integer; range 1 to 25-20
createdAtTimestamp of when the record was created. Immutable after insert.Timestamp with time zonenow() — set in codeYesNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZCannot be null; cannot be modified after creation-2025-03-16T18:00:00Z
updatedAtTimestamp of the last update to the record.Timestamp with time zonenow() — set in codeYesNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZCannot be null-2025-03-16T18:00:00Z
deletedAtTimestamp of soft deletion. Null means active. Once set, immutable.Timestamp with time zone-NoNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZImmutable once set. Active records: WHERE deletedAt IS NULL-2025-06-01T09:00:00Z
createdByIdentifier of the actor who created the recordString-YesNotype:actorNon-empty-user:018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2
updatedByIdentifier of the actor who last updated the recordString-YesNotype:actorNon-empty-user:018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2

Note: the source page states primarySource is "nullable" and describes the unique constraint as composite (clientId, medium, primarySource) — reflected in the index name — but the medium row's Validations text says "Composite unique with (clientId, primarySource)", omitting medium itself from that phrase (self-referential omission, likely just imprecise wording rather than a real conflict, since the index name lists all three columns). Carried over verbatim; flagging in case the source wording should be tightened.

Audited fields ​

Recorded on created (in full), updated (changed only) and deleted (in full): clientId, medium, primarySource, toleranceMin, toleranceMax.

Excluded: none.

A missing row is a valid, meaningful state (the system falls back to hardcoded defaults) — its absence is not itself an audited fact, only the creation, change or removal of an explicit override row is.

Not registered for entityName resolution, and has no independent human-readable attribute to register — identified by its clientId/medium/primarySource scope.