Appearance
Entity: gaugeSourceSetting
Entity Type: Database table
Description: Reading settings of one channel for one reading source. A channel (gauge record) read both ways has two settings — a manual one and a remote one — because the same parameter often arrives in a different unit and at a different interval from each source: gas read by hand in m³ monthly but delivered by the connector as pulses every hour, heat read as GJ but delivered in MWh. The settings therefore carry their own unit, reading frequency and coefficient instead of the gauge carrying one of each. Records follow the versioned / append-only pattern of gaugeSerialHistory: a change writes a new record with a new validFrom, the previous one is kept so historical consumption keeps being computed with the values that applied then, and a new record triggers recalculation of the affected consumption records from its validFrom. The remote record is pre-filled from the paired remoteEndPoint and is not editable by the user. Decided 22 September 2026; replaces the single unit and coefficient held on the gauge.
Data Attributes Table
| Attribute Name | Description | Data Type | Default Value | Required (= Nullable) | Unique | Format | Validations | Index | Example |
|---|---|---|---|---|---|---|---|---|---|
| id | Primary key of the entity. | UUID | Generated in code (app layer) | Yes | Yes | UUID v7 | - | Primary Key | 01960000-0000-7000-8000-000000000201 |
| tenantId | Tenant that owns this record. Denormalised from gauge for uniform data-scoping. | UUID | - | Yes | No | UUID v7 | Foreign Key → tenant; must equal the parent gauge.tenantId. | name: idx_gaugeSourceSetting_tenantId, type: btree | 01960000-0000-7000-8000-000000000099 |
| gaugeId | The channel these settings apply to. | UUID | - | Yes | No | UUID v7 | Foreign Key → gauge; must exist. | name: idx_gaugeSourceSetting_gaugeId_source_validFrom, type: btree (composite, validFrom DESC) | 01960000-0000-7000-8000-000000000005 |
| source | Reading source these settings belong to. A channel has at most one active record per source. | String | - | Yes | No | enum — ReadingSource | Values: manual, remote. invoice is not a configurable source here. Must be consistent with gauge.readingMethod. | - | manual |
| unit | Unit in which readings arrive from this source, before the coefficient is applied. May differ from gauge.unit, which stays the canonical unit consumption is stored in. | String | - | Yes | No | enum — Unit | Must be convertible to gauge.unit using coefficient. | - | imp |
| readingFrequency | How often a reading is expected from this source. Drives the manual reading-frequency check and the staleness check on remote feeds. | String | - | Yes | No | enum — GaugeBillingFrequency or interval code | Manual: daily to yearly. Remote: taken from the endpoint (15 min, hourly, daily). | - | monthly |
| coefficient | Multiplier applied to a raw value from this source to get the quantity in gauge.unit — pulse weight, transformer ratio or a correction of the installation. Versioned together with the rest of the record. | Decimal | 1.0 | Yes | No | Decimal(18,6) | Greater than zero. | - | 0.010000 |
| frequencyCheckEnabled | Whether a missing reading from this source raises a notice. Defaults to true for manual sources on gauges that are read by hand or both ways. | Boolean | true | Yes | No | - | - | - | true |
| remoteEndPointId | The paired connector endpoint this remote setting was pre-filled from. Null for manual settings. | UUID | null | No | No | UUID v7 | Foreign Key → remoteEndPoint; required when source = remote. | name: idx_gaugeSourceSetting_remoteEndPointId, type: btree | 01960000-0000-7000-8000-000000000301 |
| validFrom | Timestamp from which these settings apply. A change writes a new record instead of updating this one. | Timestamp with time zone | - | Yes | No | ISO 8601 | Unique per gaugeId + source. | name: idx_gaugeSourceSetting_gaugeId_source_validFrom, type: btree (composite) | 2026-09-22T08:00:00Z |
| createdAt | Timestamp of entity creation. Immutable. | Timestamp with time zone | Set in code | Yes | No | ISO 8601 | - | - | 2026-09-22T08:00:00Z |
| createdBy | Identifier of the actor who created this record. | String | - | Yes | No | type:actor | - | - | user:01960000-0000-7000-8000-000000000099 |
Audited fields
Recorded on created (in full) only — this table has no updatedAt/updatedBy columns and no deletedAt; a change is a new versioned record (new validFrom), never an update to an existing one: gaugeId, source, unit, readingFrequency, coefficient, frequencyCheckEnabled, remoteEndPointId, validFrom.
Excluded: none.
Every entry carries subjectEntityType = gauge / subjectEntityId = gaugeId — this table has no identity of its own beyond the gauge it belongs to.
Not registered for entityName resolution, and has no independent human-readable attribute to register — identified by its gaugeId/source/validFrom scope.
Notes
- Migration: the unit and coefficient held on the gauge today move into a manual record with
validFrom= migration date;gaugeCoefficienthistory maps onto the coefficient of the matching source. - A channel with
gauge.readingMethod = bothmust have exactly one active record per source; the API rejects a save that leaves a source without settings.