Skip to content
Updated Oct 5, 2026 by Pablo Coufal · Owner: analysisdraftentitygauge-managementplatform Edit on GitHub

Entity: usageType ​

Entity Type: Database table (platform schema)

Description: Platform-level catalogue of what measured consumption is used for (účel užití): heating, hot water, cooling, lighting, vehicle charging, irrigation … It replaces the compile-time union behind ConsumptionUsageType for gauge channels (the enum stays for buildingCalculatedConsumption). One catalogue for every tenant (decision R7, 1 Oct 2026 — tenant sub-items under other are a v2 candidate), maintained by the Porsenna superadmin; no tenantId, no RLS, the same precedent as platform.contract_item_type and distributionRate. Each item carries what the rest of the system needs from it: a category for grouping, the climate-normalisation method (Epic 3.2 normalises only hdd / cdd items), and the media × channel meanings it may be offered on (K1 matrix). A channel refers to it through gaugeUsageAllocationItem. Decided 1 Oct 2026 (R1–R7); the offer matrix (K1–K4) awaits stakeholder confirmation.

Data Attributes Table ​

Attribute NameDescriptionData TypeDefault ValueRequired (= Nullable)UniqueFormatValidationsIndexExample
idPrimary key of the entity.UUIDGenerated in code (app layer)YesYesUUID v7-Primary Key01960000-0000-7000-8000-000000000701
codeStable machine code.String-YesYeslowerCamelCase — heating, hotWater, cooling, ventilation, lighting, baseLoad, cooking, evCharging, transport, sanitary, processWater, irrigation, otherMax 40 characters; unique among active rows.name: idx_usageType_code, type: btree (unique, partial deletedAt IS NULL)hotWater
nameCsCzech label shown in the gauge form, the allocation modal and reports.String-YesNo-Max 100 characters; non-empty.-Ohřev teplé vody
labelByMediumOptional medium-specific label (K2: a water meter shows Teplá voda for hotWater, an energy meter Ohřev teplé vody).JSON (map medium → label)nullNoNo{"water": "Teplá voda"}Keys from enum Medium.-{"water": "Teplá voda"}
categoryGrouping for reports and the modal: heat, technology, electric, fuel, water, production, other.String-YesNoenum (fixed list above)--heat
normalizationMethodHow Epic 3.2 normalises consumption of this usage: none, hdd (heating degree days), cdd (cooling degree days).StringnoneYesNoenum--none
allowedForWhich channels may carry this usage: list of (medium, purpose meaning) pairs — the K1 matrix as data, not two independent lists (N01).JSON (array of {medium, purpose})[]YesNo[{"medium":"electricity","purpose":"consumption"}, …]Non-empty for an active row; media from enum Medium, purposes from the gauge purpose meanings consumption / production / export. v1 lists consumption only (K3).-[{"medium":"gas","purpose":"consumption"},{"medium":"heat","purpose":"consumption"}]
sortOrderDisplay order within the filtered offer (N10).Integer0YesNo---20
isActiveWhether the item is offered for new assignments. Deactivating keeps existing allocations readable (N09).BooleantrueYesNo---true
em2CodeEM2 gauge_consumption_usage code the item migrates from (1 heating, 2 hot water, 5 other, 6 lighting, 7 other non-weather). Null for new items.IntegernullNoNo---2
createdAtTimestamp of creation. Immutable.Timestamp with time zoneSet in codeYesNoISO 8601--2026-10-05T10:00:00Z
updatedAtTimestamp of last update.Timestamp with time zoneSet in codeYesNoISO 8601--2026-10-05T10:00:00Z
deletedAtSoft-delete timestamp.Timestamp with time zonenullNoNoISO 8601--null
createdByActor who created the record.String-YesNotype:actor--system:seed
updatedByActor who last updated the record.String-YesNotype:actor--system:seed

Notes ​

  • Seed (v1, full set — decision R4): heating (HDD), hotWater, cooling (CDD), ventilation, lighting, baseLoad (Ostatní provoz — bez vlivu počasí), cooking, evCharging, transport, sanitary, processWater, irrigation, other. gridExport and sharing are not seeded as consumption usages — production, export and sharing stay outside the v1 split (K3) and are classified by the channel's purpose. No item is a default for any channel (D01): a new channel is Neurčeno until the user chooses.
  • Offer per medium (K1, consumption channels): electricity — heating, hotWater, cooling, ventilation, lighting, baseLoad, cooking, evCharging, other · gas — heating, hotWater, cooking, other · heat — heating, hotWater, other · cold — cooling, other · water — sanitary, hotWater, processWater, irrigation, other · solid and liquid fuel — heating, hotWater, other · vehicle fuel — transport, other. KVP channels carry no usage.
  • EM2 codes 3, 4, 8 (combi heating measured / combi coefficient / combi hot water measured) are not usages — they become the mode of gaugeUsageAllocation. EM2 code 0 migrates as no allocation (null), not as other, so the gap stays visible.
  • Administration: superadmin read in v1 (same read-only pattern as the distribution-rate catalogue); the tenant reads GET /v1/usage-types?medium=&purpose= for the select and the modal; the backend validates every allocation against allowedFor (N10 — no second matrix in the frontend).