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

Entity: building ​

Entity Type: Database table

Description: A node in the location hierarchy representing any physical or organisational location whose energy consumption is tracked. Buildings form a self-referential tree of unlimited depth via parentId. Every gauge belongs to exactly one building node. The levelType attribute is a UI hint describing the role of the node (portfolio, campus, floor, etc.) but is not enforced as a structural constraint. Degree-day normalisation for this building is computed on demand from climate data (see climate data / degree-day normalisation) — it is not stored against the building itself. buildingParameter.temperatureReference supplies the building's reference temperature used as an input to that calculation.

Data Attributes Table ​

Attribute NameDescriptionData TypeDefault ValueRequired (= Nullable)UniqueFormatValidationsIndexExample
idPrimary key of the entityUUIDGenerated in code (app layer)YesYesUUID v7-Primary Keya1b2c3d4-…
tenantIdTenant that owns this building. All queries are scoped to a tenant.UUID-YesNoUUID v7Foreign Key → tenant; must existname: idx_building_tenantId, type: btreee5f6a7b8-…
parentIdReference to the parent building node. Null marks a root node (top of the hierarchy for this tenant).UUIDnullNoNoUUID v7Foreign Key → building (self-referential); must not create a cyclename: idx_building_parentId, type: btreec9d0e1f2-…
levelTypeUI hint describing what organisational level this node represents. Not enforced as a structural constraint.EnumnullNoNoenum--campus
nameDisplay name of the building node.String-YesNo-Max 255 characters-School Campus Brno
typeObject type controlling which form sections and fields are displayed.Enum-YesNoenumImmutable after creation without special role-building
sectorIdSector classification from the tenant-defined codebook.UUID-YesNoUUID v7Foreign Key → sector; must exist; immutable after creation without special role-d3e4f5a6-…
streetStreet name of the building address.StringnullNoNo-Required when type = building; max 255 characters-Náměstí Svobody
houseNumberHouse / descriptive number of the building (číslo popisné).StringnullNoNo-Required when type = building; max 20 characters-12
referenceNumberOrientation number of the building (číslo orientační). Optional complement to houseNumber. Migrated from legacy reference_number column.StringnullNoNo-Max 20 characters-4a
cityCity of the building address.StringnullNoNo-Required when type = building; max 255 characters. Auto-populated from ZIP (when zip available); can be overridden manually.-Brno
zipPostal code of the building address.StringnullNoNo-Required when type = building; exactly 5 digits-60200
addressLegacy raw address string, kept alongside the decomposed street/houseNumber/city/zip fields above as a separate, intentionally-retained legacy field.StringnullNoNo---Náměstí Svobody 8, 602 00 Brno
ownerIdReference to the organisation acting as the building's owner.UUIDnullNoNoUUID v7Foreign Key → organisation; must exist if set-018fa51f-fda1-79f4-8461-2cb8f1cabc10
managerIdReference to the organisation acting as the building's manager.UUIDnullNoNoUUID v7Foreign Key → organisation; must exist if set-018fa51f-fda1-79f4-8461-2cb8f1cabc10
delegatedManagerIdReference to the organisation acting as the delegated manager (přenesená správa).UUIDnullNoNoUUID v7Foreign Key → organisation; must exist if set-018fa51f-fda1-79f4-8461-2cb8f1cabc10
ownerIcoCzech company tax ID (IČO) of the building owner. Read-only snapshot of the linked organisation once ownerId is set; null for natural persons without IČO.StringnullNoNo-Exactly 8 digits; stored as zero-padded string; leading zeros preserved. Null when owner is a natural person.-00064581
ownerNameName of the building owner. Read-only snapshot of the linked organisation once ownerId is set.StringnullNoNo-Max 255 characters-Statutární město Brno
managerIcoCzech company tax ID (IČO) of the building manager. Read-only snapshot of the linked organisation once managerId is set; null for natural persons without IČO.StringnullNoNo-Exactly 8 digits; stored as zero-padded string; leading zeros preserved. Null when manager is a natural person.-44994575
managerNameName of the building manager. Read-only snapshot of the linked organisation once managerId is set.StringnullNoNo-Max 255 characters-Správa nemovitostí Brno s.r.o.
delegatedManagerIcoCzech company tax ID (IČO) of the delegated manager (přenesená správa). Read-only snapshot of the linked organisation once delegatedManagerId is set; null for natural persons without IČO.StringnullNoNo-Exactly 8 digits; stored as zero-padded string; leading zeros preserved. Null when delegated manager is a natural person.-00064582
delegatedManagerName of the delegated manager (přenesená správa). Read-only snapshot of the linked organisation once delegatedManagerId is set.StringnullNoNo-Max 255 characters-Technická správa komunikací hl. m. Prahy
gidGlobal identifier used in Prague-region asset management systems. Specific to Prague-region clients. Migrated from legacy gid column.StringnullNoNo-Max 255 characters-MHMP-12345
ucehUnique energy management identifier (UČEH). Client-specific code used in some energy management systems. Migrated from legacy uceh column on building_properties.StringnullNoNo-Max 255 characters-UCEH-2024-00123
legacyIdLegacy-system identifier; migration provenance.StringnullNoNo--UNIQUE (tenantId, legacySource, legacyId) WHERE legacyId IS NOT NULL4821
legacySourceWhich legacy table this building was migrated from.String (enum)nullNoNoenum: ground, buildingMust be one of the listed values, or null(composite with legacyId above)building
isPartOfEnmsIndicates whether the building is part of the client's energy management system scope. Migrated from legacy client_energy_management on building_properties.BooleantrueYesNo---true
isOperationPartOfEnmsIndicates whether the operation of this building is part of the client's energy management system scope. Migrated from legacy client_working_energy_management on building_properties.BooleantrueYesNo---true
latGeocoded GPS latitude of the building, derived automatically from the address. Used as fallback when latCustom is not set. Must be provided together with lng. Migrated from legacy map_lat.DecimalnullNoNodecimal(9,6)Range -90 to 90; must be null if lng is null and vice versa-49.195060
lngGeocoded GPS longitude of the building, derived automatically from the address. Used as fallback when lngCustom is not set. Must be provided together with lat. Migrated from legacy map_lng.DecimalnullNoNodecimal(9,6)Range -180 to 180; must be null if lat is null and vice versa-16.608660
latCustomUser-defined GPS latitude override. When set, takes precedence over lat for map display and Mapy.com link generation. Must be provided together with lngCustom. Migrated from legacy map_lat_custom.DecimalnullNoNodecimal(9,6)Range -90 to 90; must be null if lngCustom is null and vice versa-49.195120
lngCustomUser-defined GPS longitude override. When set, takes precedence over lng for map display and Mapy.com link generation. Must be provided together with latCustom. Migrated from legacy map_lng_custom.DecimalnullNoNodecimal(9,6)Range -180 to 180; must be null if latCustom is null and vice versa-16.608790
mapyComUrl (computed, not persisted)Read-only URL to the building's location on Mapy.com. Generated on-the-fly from effective coordinates: latCustom/lngCustom if set, otherwise lat/lng. Not stored in the database. Null when no coordinates are available.String---URLRead-only; not writable via API. Not persisted.Not indexed (not persisted)https://mapy.com/cs?x=16.6088&y=49.1951&z=17
showOnMapControls whether the building is displayed on the map view.BooleantrueYesNo---true
yearBuiltYear the building was constructed. Migrated from legacy built_year column.IntegernullNoNosmallintRange 1800–current year-1978
descriptionFree-text description of the building. During migration, the legacy organization field (from building_properties) is appended here as "[Legacy organization: {value}]" for records where the value is not already present in ownerName or managerName.StringnullNoNo---Main administrative building of the campus.
photoFileIdReference to the file entity containing the building photo.UUIDnullNoNoUUID v7Foreign Key → file; JPEG or PNG; max 20 MB-f1e2d3c4-…
isHeritageIndicates whether the building is a listed heritage site. Migrated from legacy protected column on building_properties.BooleanfalseYesNo---false
climateStationIdReference to the WeatherStation linked to this building for degree-day normalisation.UUIDnullNoNoUUID v7Foreign Key → weatherStation; must exist if set-b3c4d5e6-…
isArchivedSoft-delete flag. Archived buildings are excluded from active lists but retained for historical data. Derived during migration from legacy disabled_at IS NOT NULL.BooleanfalseYesNo--name: idx_building_tenantId_isArchived, type: btree (composite with tenantId)false
archivedAtTimestamp of when the building was archived. Migrated from legacy disabled_at column.TimestampnullNoNoYYYY-MM-DDTHH:mm:ss.SSS+00Must be set when isArchived = true-2025-01-15T10:00:00.000+00
archiveReasonReason for archiving the building. Migrated from legacy disabled_reason INT enum (1→saleDemolition, 2→transfer, 3→outOfScope, 8→other).EnumnullNoNoenumRequired when isArchived = true-transfer
showArchivedInReportsControls whether historical data from this archived building appears in reports and charts.BooleanfalseYesNo---false
createdAtTimestamp of when the record was created.Timestampnow()YesNoYYYY-MM-DDTHH:mm:ss.SSS+00--2024-03-01T08:00:00.000+00
updatedAtTimestamp of the last update to the record.Timestampnow()YesNoYYYY-MM-DDTHH:mm:ss.SSS+00--2024-06-15T14:22:00.000+00
deletedAtTimestamp of soft-deletion. Once set (non-null), this value is immutable and cannot be changed. Records where deletedAt IS NULL are considered active; all default queries must filter by this condition. Permanent deletion is an admin-only operation; for user-initiated end-of-life use isArchived instead.TimestampnullNoNoYYYY-MM-DDTHH:mm:ss.SSS+00Once set, immutable — cannot be changed or unset-2025-06-01T12:00:00.000+00
createdByIdentifier of the actor who created the record (user ID or system).String-YesNotype:actorNon-empty-user:a1b2c3d4 / system
updatedByIdentifier of the actor who last updated the record (user ID or system).String-YesNotype:actorNon-empty-user:a1b2c3d4 / system

Note: mapyComUrl is a computed, non-persisted read-only field kept in the DAT for documentation completeness (per source); it does not participate in the persisted attribute ordering (§3.2) since it has no storage.

Audited fields ​

Recorded on created (in full), updated (changed only) and deleted (in full): parentId, levelType, name, type, sectorId, street, houseNumber, referenceNumber, city, zip, address, ownerId, managerId, delegatedManagerId, ownerIco, ownerName, managerIco, managerName, delegatedManagerIco, delegatedManager, gid, uceh, isPartOfEnms, isOperationPartOfEnms, lat, lng, latCustom, lngCustom, showOnMap, yearBuilt, description, photoFileId, isHeritage, climateStationId, isArchived, archivedAt, archiveReason, showArchivedInReports, legacyId, legacySource.

Excluded:

  • mapyComUrl — computed at read time from lat/lng (or latCustom/lngCustom when set); not a persisted column, so it never appears in changedFields.

Every other entity in this batch (buildingCalculatedConsumption, buildingEnergyBaseline, buildingEnergyProfile, buildingParameter, buildingSchedule) files its entries against this entity as subject, so a building's full history is one indexed read.

Registered for entityName resolution — resolves to name (architecture 61-audit-log.md §7.4 in the code repo).