Appearance
Entity: buildingEnergyBaseline
Entity Type: Database table
Description: The building's reference consumption at the point EnMS was introduced (referenceYear), reflecting real operation. Used to evaluate long-term targets and the overall benefit of EnMS. No history is required → one current row per building/medium is sufficient (new entry overwrites the previous one). Entered once by the energy manager at review time, supporting both manual entry and loading the value from existing data. Every row covers exactly one medium (medium is always set). There is no separate stored total-energy row — the building's total energy baseline is computed as SUM(value) across all active rows for that building/referenceYear wherever needed. If not all media used by a building are tracked in the system, the computed total will be understated.
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 | 018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2 |
| tenantId | Tenant this record belongs to. | UUID | - | Yes | No | UUID v7 | Foreign Key → tenant; must exist | - | 018fa51f-fda1-79f4-8461-2cb8f1cabc10 |
| buildingId | The building this baseline belongs to. | UUID | - | Yes | No | UUID v7 | Foreign Key → building; must exist | - | b2c3d4e5-… |
| medium | Energy medium this baseline value covers. | String (enum) | - | Yes | No | enum | One of GaugeMedium enum values | - | heat |
| referenceYear | The reference year this baseline reflects — the year EnMS was introduced for this building. | Integer | - | Yes | No | YYYY | Must match referenceYear of all other active rows for the same buildingId. A per-medium write with a different year is rejected; the year is changed for the whole building at once (bulk reference-year change), which moves every active row and keeps value and source. Per-medium and bulk writes of one building are serialized, so its active rows always share one year. | - | 2024 |
| value | The reference consumption for the given medium in the referenceYear. | Decimal | - | Yes | No | decimal(12,2) | - | - | 128500.00 |
| source | How the value was populated. | String (enum) | manual | Yes | No | enum | Must be one of the enum values | - | manual |
| legacyId | Legacy-system identifier; migration provenance. | String | null | No | No | - | - | UNIQUE (tenantId, legacySource, legacyId) WHERE legacyId IS NOT NULL | 2214 |
| legacySource | Which legacy table this record was migrated from. | String (enum) | null | No | No | enum: building_energy_managemet (sic — misspelled in the migration itself) | Must equal the listed value, or null | (composite with legacyId above) | building_energy_managemet |
| createdAt | Timestamp of when the record was created. | Timestamp with time zone | now() — set in code | Yes | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Cannot be null | - | 2026-07-30T11:00:00Z |
| updatedAt | Timestamp of the last update to the record. | Timestamp with time zone | now() — set in code | Yes | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Cannot be null | - | 2026-07-30T11:00:00Z |
| deletedAt | Timestamp of soft deletion. Null means the record is active. | Timestamp with time zone | null | No | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Immutable once set | - | null |
| createdBy | Identifier of the actor who created the record (user ID or system actor). | String | - | Yes | No | type:actor — e.g. user:uuid or system:migration | Non-empty | - | user:018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2 |
| updatedBy | Identifier of the actor who last updated the record (user ID or system actor). | String | - | Yes | No | type:actor — e.g. user:uuid or system:migration | Non-empty | - | user:018ed0b3-c298-7c7a-96d5-8b36f5a7f8d2 |
Audited fields
Recorded on created (in full), updated (changed only) and deleted (in full): buildingId, medium, referenceYear, value, source, legacyId, legacySource.
Excluded: none.
Not registered for entityName resolution, and has no independent human-readable attribute to register — identified by its buildingId/medium/referenceYear combination.