Model Location Resolution
Resolve canonical room and door identities to deterministic model coordinates.
This module is deliberately independent of source databases and reference tables. It resolves an already-normalised building, floor, and room code against loaded model rooms. The resulting coordinate is a temporary modelling assumption, rather than an observed position: use the room polygon centroid when it is interior, otherwise an interior representative point.
DoorLocationResolution
dataclass
Result of resolving one canonical room identity to a model door.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
DoorResolutionStatus
|
Outcome of the room lookup and door selection. |
required |
room
|
Room | None
|
Matched model room, when one exists. |
required |
door
|
Door | None
|
Selected model door when the room has exactly one spatial door. |
required |
location
|
Location | None
|
Midpoint of the selected door segment, when resolution succeeds. |
required |
candidate_door_count
|
int
|
Number of model doors in the matched room. This allows callers to report unresolved multi-door records without re-inspecting geometry. |
required |
Source code in src/amr_hub_abm/location_resolution.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 | |
DoorResolutionStatus
Bases: StrEnum
Possible outcomes when resolving a canonical room identity to a door.
Source code in src/amr_hub_abm/location_resolution.py
54 55 56 57 58 59 60 61 62 | |
RoomLocationResolution
dataclass
Result of resolving one canonical room identity in a spatial model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
status
|
RoomResolutionStatus
|
Outcome of the room lookup and spatial placement. |
required |
room
|
Room | None
|
Matched model room, when one exists. |
required |
location
|
Location | None
|
Deterministic representative coordinate, when spatial resolution succeeds. |
required |
Source code in src/amr_hub_abm/location_resolution.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | |
RoomResolutionStatus
Bases: StrEnum
Possible outcomes when resolving a canonical room identity.
Source code in src/amr_hub_abm/location_resolution.py
24 25 26 27 28 29 | |
resolve_door_location(building, floor, room_code, rooms)
Resolve a canonical room identity to the midpoint of its unique door.
The source location description identifies a room rather than a model door. To avoid introducing an unsupported arbitrary selection rule, this function resolves only rooms with exactly one door. Rooms with no doors or multiple doors return explicit outcomes for later reconciliation. As with room resolution, this function has no source-data or persistence dependencies.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
building
|
str
|
Building name matching |
required |
floor
|
int
|
Floor number matching |
required |
room_code
|
str
|
Canonical room code matching |
required |
rooms
|
list[Room]
|
Rooms loaded from the spatial model. |
required |
Returns:
| Type | Description |
|---|---|
DoorLocationResolution
|
Resolution result with the unique door midpoint when exactly one spatial model door belongs to the resolved room. |
Source code in src/amr_hub_abm/location_resolution.py
167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
resolve_room_location(building, floor, room_code, rooms)
Resolve a canonical room identity to a deterministic model coordinate.
The function has no source-data or persistence dependencies. It is intended to be called after location ingestion has produced canonical identifiers. A room centroid is used as the temporary representative location. Concave polygons can have an exterior centroid, so the function falls back to an interior representative point to ensure that successful resolutions are valid positions in the model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
building
|
str
|
Building name matching |
required |
floor
|
int
|
Floor number matching |
required |
room_code
|
str
|
Canonical room code matching |
required |
rooms
|
list[Room]
|
Rooms loaded from the spatial model. |
required |
Returns:
| Type | Description |
|---|---|
RoomLocationResolution
|
Resolution result. A missing model room or a topological room without spatial geometry returns no coordinate. |
Source code in src/amr_hub_abm/location_resolution.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 | |