/

Developer Guide

Building Management Context

Subdomain type: Core · Grounded in: User Stories BM-1 through BM-5

This page describes the design-time model of the Building Management context — the structural backbone of the platform that the live-data contexts decorate. Concrete APIs and storage are left as decisions for whoever builds this model.

The context models the physical reality being monitored: buildings, the rooms inside them, and the geometry that places those rooms in the 3D digital twin.


Ubiquitous Language

TermMeaning in this context
BuildingA monitored physical structure, scoped to one or more domains.
RoomA bounded space inside a Building with a capacity and a position.
GeometryThe position and dimensions that render a Room in the 3D twin.

The Building Aggregate

We model Building as the single aggregate root, with Room as an entity that lives inside it. A Room has no meaning on its own — it is always created and changed in the context of its Building — which is why we draw the aggregate boundary around the Building rather than promoting Room to a root of its own.

classDiagram
    class Building {
        <<Aggregate Root>>
        +id
        +name
        +domain[] domains
        +Room[] rooms
    }
    class Room {
        <<Entity>>
        +id
        +name
        +Coordinates position
        +Dimensions dimensions
        +color
    }
    class Coordinates {
        <<Value Object>>
        +x
        +y
        +z
    }
    class Dimensions {
        <<Value Object>>
        +width
        +height
        +depth
    }

    Building "1" *-- "many" Room : contains
    Room "1" *-- "1" Coordinates : positioned at
    Room "1" *-- "1" Dimensions : sized by

Aggregate Root: Building

The aggregate as a whole, created in one coherent act with the system assigning identity, is what answers story BM-1.

Entity: Room

Value Objects: Coordinates and Dimensions

Geometry is modelled as immutable, identity-less value objects. Two rooms sharing the same coordinates are not “the same place” — position is defined entirely by its values, which is exactly the value-object contract, and the one story BM-5 rests on.


Multi-Tenancy as a Domain Rule

A guiding decision for this context is that it should enforce tenancy without depending on the Identity & Access context at request time. The principal’s memberships arrive with the request (in the identity token), and a Building already records the domains it belongs to, so the rule can be evaluated entirely within this context.

sequenceDiagram
    participant C as Client
    participant B as Building Management
    C->>B: request buildings for a domain (with identity token)
    Note over B: check the domain is among the principal's memberships
    Note over B: select buildings associated with that domain
    B-->>C: authorized buildings

This is the intended shape of the rule — the one story BM-4 asks for — with the important property that answering it needs no call back to Identity & Access. How the check is wired and how buildings are queried are left open at the model level.


Relationships to Other Contexts

This context is meant to act as an upstream supplier to three downstream contexts. The model assumes that, when a Building comes into existence, the downstream contexts are given the baseline they need.

Downstream ContextWhat this context is expected to supplyPattern
Telemetry IngestionA threshold baseline describing the Building’s rooms.Customer / Supplier
Telemetry DistributionA default set of display preferences, plus the structural metrics the Building itself owns.Customer / Supplier
Knowledge & AssistanceRead-only access to Building and Room data.Anti-Corruption Layer

Design decision: provisioning is best-effort

We intend the downstream provisioning to be best-effort rather than transactional: if seeding a downstream context does not succeed, creating the Building should still be allowed to complete, and the baseline can be re-established later. This deliberately softens the aggregate’s consistency boundary at the network edge, trading strict consistency for availability. It is a decision we expect to revisit if the downstream baselines become safety-critical.