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

Entity: volumeCoefficient ​

Entity Type: Database table

Description: A versioned multiplier that corrects what a gauge reports into the quantity it actually measured — a pulse weight, a transformer ratio, or a correction for a meter's rated against actual throughput. It is a property of the meter and its installation, taken from the protocol or the installation certificate.

It is applied to the gauge's readings before consumption is written. It does not convert one quantity into another: turning a volume of fuel into energy is a property of the fuel, not of the meter, and is stated as a calorificValue.

Two histories per gauge. A gauge read both by hand and remotely can need different correction for each, because the two paths deliver the value differently — the legacy system kept exactly this separation in two tables. readingSource says which series a row corrects, and each series has its own independent validity history.

Records are append-only: no row is updated or deleted after creation. A row entered in error is voided (isVoided), which excludes it from every calculation while keeping it visible; the corrected value is written as a new row.

Data Attributes Table ​

Attribute NameDescriptionData TypeDefault ValueRequired (= Nullable)UniqueFormatValidationsIndexExample
idPrimary key of the entity.UUIDGenerated in code (app layer)YesYesUUID v7-Primary Key018f9c4d-2c11-7a3e-9b77-4f0d3a5e6b61
tenantIdTenant this record belongs to.UUID-YesNoUUID v7Foreign Key → tenant; must existname: idx_volume_coefficient_tenantId, type: btree018fa51f-fda1-79f4-8461-2cb8f1cabc10
gaugeIdThe gauge this coefficient applies to.UUID-YesPart of composite uniqueUUID v7Foreign Key → gauge; must existPart of the unique index below018f6e2a-…
readingSourceWhich reading series this coefficient corrects: values entered by hand, or values delivered by a remote connection. Each has its own history for the same gauge.Enum-YesPart of composite uniqueEnum - ReadingSourceOnly manual and remote are valid: an invoiced quantity is already a quantity, and a calculated value is derived from corrected ones.Part of the unique index belowremote
validFromThe date from which this coefficient applies. It applies to every consumption computed on or after this date, up to the next non-voided row for the same gauge and reading source.Date-YesPart of composite uniqueYYYY-MM-DDUnique per (gaugeId, readingSource, validFrom) among non-voided rows.Part of the unique index below2024-01-01
valueThe multiplier applied to the raw value before consumption is stored.Decimal-YesNonumeric(10,6)Must be > 0.-1.023400
noteFree-text explanation of why the coefficient was set to this value.StringnullNoNo-Max 500 characters.-Protokol o výměně měřidla 2024-03
isVoidedMarks a row entered in error. A voided row is ignored by every calculation and is never physically deleted.BooleanfalseYesNo-Once true, cannot be set back to false.-false
voidedAtWhen the row was voided.Timestamp with time zonenullNoNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZMust be set when isVoided is true and null otherwise.-null
voidedByActor who voided the row.StringnullNoNotype:actorMust be set when isVoided is true and null otherwise.-null
legacyIdIdentifier of the row this one was migrated from.StringnullNoNo---48213
legacySourceWhich legacy table the row came from, which is how the two histories are reconstructed on migration.StringnullNoNo-One of the legacy coefficient tables.-gauge_volume_ratio
createdAtTimestamp of record creation.Timestamp with time zonenow() — set in codeYesNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZCannot be null.-2024-03-01T08:00:00Z
updatedAtTimestamp of the last update.Timestamp with time zonenow() — set in codeYesNoISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZCannot be null.-2024-03-01T08:00:00Z
createdByActor who created the record.String-YesNotype:actorNon-empty.-user:018ed0b3-…
updatedByActor who last updated the record.String-YesNotype:actorNon-empty.-user:018ed0b3-…

Indexes ​

NameColumnsTypeWhy
uq_volume_coefficient_valid_fromtenantId, gaugeId, readingSource, validFrom where isVoided is falseUnique, partialOne coefficient per gauge, series and start date; a voided row must not block re-entering the same date.
idx_volume_coefficient_tenantIdtenantIdbtreeTenant predicate.

Soft deletion ​

This entity has no deletedAt. Its append-only pattern uses isVoided / voidedAt / voidedBy instead, because a coefficient is never removed — it is superseded, and the superseded value is still what reproduces the consumption it produced.

Audited fields ​

Recorded on created (in full) and on voiding (in full): gaugeId, readingSource, validFrom, value, note, isVoided.

Excluded: legacyId and legacySource — migration provenance, set once by the migration and never changed by a user.

Not registered for entityName resolution, and has no independent human-readable attribute to register — identified by its gaugeId/readingSource/validFrom scope.