Appearance
Entity: weatherStation
Entity Type: Database table
Description: Represents a meteorological measurement point that provides climate data (temperature, heating days) used across the system for energy consumption normalisation and reporting. The catalogue is split into two tiers: global stations (tenantId = null), maintained by the superadmin and visible to all tenants; and tenant-owned stations (tenantId set), visible only to their tenant. A global station's data is not tied to any specific provider — origin is tracked per-record via climateData.source, not by station tier. Both tenant-owned and global stations may be connected to the remote connection infrastructure for automated data ingestion. The relationship is stored on remoteEndPoint.weatherStationId — a station may have any number of connected endpoints, each distinguished by measurement type. Assignments of stations to clients are stored in a separate client-station assignment page. Stations with an automated external feed (e.g. ČHMÚ) are identified via wsi, used to pair incoming feed records to this station. Deletion is implemented as soft-delete (deletedAt).
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 station belongs to. Null = global station visible to all tenants; UUID = tenant-owned station visible only to that tenant. | UUID | - | No | No | UUID v7 or null | Foreign Key → tenant when non-null. Null is valid for global stations. | name: idx_weatherStation_tenantId, type: btree | 018fa51f-fda1-79f4-8461-2cb8f1cabc10 |
| name | Name of the station as displayed in the UI and station catalogue. | String | - | Yes | No | - | Non-empty, max 255 chars. | - | Praha-Ruzyně (P1PRUZ01) |
| lat | GPS latitude of the station location. | Decimal | - | No | No | Decimal degrees (WGS84) | Range −90 to 90. | - | 50.1008 |
| lng | GPS longitude of the station location. | Decimal | - | No | No | Decimal degrees (WGS84) | Range −180 to 180. | - | 14.2632 |
| altitude | Altitude of the station above sea level in metres. Used for display in the station catalogue. | Integer | - | No | No | Metres above sea level | - | - | 364 |
| dataAvailableFromYear | Year from which short-term climate data is expected to be available for this station. Input to a data-completeness check. | Integer | - | No | No | YYYY | Reasonable calendar year (e.g. ≥ 1900). | - | 2015 |
| wsi | WIGOS Station Identifier — external identifier used to pair the station with an automated data feed. | String | - | No | No | - | Not validated against any external registry; format and correctness are the responsibility of whoever enters it. | - | 0-20000-0-11406 |
| createdAt | Timestamp of when the record was created. Immutable after insert. | Timestamp with time zone | now() — set in code | Yes | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Cannot be null; cannot be modified after creation. | - | 2025-03-16T18:00:00Z |
| updatedAt | Timestamp of the last update to the record. Set on insert and updated on every change. | Timestamp with time zone | now() — set in code | Yes | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Cannot be null. | - | 2025-03-16T18:00:00Z |
| deletedAt | Timestamp of soft deletion. Null means the record is active. Once set, immutable. | Timestamp with time zone | - | No | No | ISO 8601 — YYYY-MM-DDTHH:mm:ss.SSSZ | Immutable once set. Active records: WHERE deletedAt IS NULL | - | 2025-06-01T09:00:00Z |
| createdBy | Identifier of the actor who created the record. | 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. | String | - | Yes | No | type:actor — e.g. user:uuid or system:migration | Non-empty. | - | system:migration-v25 |
Audited fields
Recorded on created (in full), updated (changed only) and deleted (in full): tenantId, name, lat, lng, altitude, dataAvailableFromYear, wsi.
Excluded: none.
tenantId is included here even though it is normally a pure scoping column, not an audited business fact — for this entity specifically, per its own description, tenantId distinguishes a global station (null) from a tenant-owned one (a UUID), and a station can move between the two states (an ownership change), which is itself a meaningful fact worth a trail entry, not merely which schema the row lives in.
Registered for entityName resolution — resolves to name in the shared weather-station catalogue (architecture 61-audit-log.md §7.4 in the code repo).