Skip to main content
Loading navigation

Build an IFC Spatial Topology Query Locator — implementation

Prompt source

implementation68 lines11 sectionsNo variables1 code block
## Build
Extract exact containment hierarchies connecting localized equipment to parent site plots using the ifcquery utility. Traverse the spatial decomposition tree to map building components for facility management operations.

## User
Facility manager and BIM technician

## Workflow
1. Load IFC representations of commercial facilities via the ifcquery utility.
2. Traverse the spatial decomposition tree from IfcSite down to IfcSpace using a recursive function.
3. Identify disconnected equipment components lacking valid spatial containment relationships.
4. Output a flattened JSON topology map for facility management asset importing.

## Interface
Command-line interface with a tabular preview of spatial hierarchies and JSON export capabilities.

## Data
Utilize open buildingSMART sandbox IFC models or mock JSON hierarchy graphs representing spatial containment.
Starter examples below are synthetic. They are not downloaded records.

## Source
[IfcOpenShell](https://raw.githubusercontent.com/IfcOpenShell/IfcOpenShell/v0.8.0/README.md)
Utilizes the ifcquery CLI tool from the IfcOpenShell suite to inspect building model topologies.

## Tools
agno, ifcopenshell, pydantic.
Agno manages the workflow execution and maps graph traversal outputs into structured Pydantic data schemas.
General-purpose LLM for mapping complex spatial naming conventions to standard facility asset categories.

## Deliverables
Submit runnable source, pinned dependencies, setup commands, a working interface, example outputs, and a recorded end-to-end demo. Include tests and an action log.

## Acceptance
- Correctly traverses the containment tree to find the parent path of an asset.
- Accurately flags orphaned elements lacking spatial containment parents.
- Exports a strictly typed JSON topology dictionary representing the containment.

## Starter Examples
```json
[
  {
    "input": {
      "query_target": "Pump-01",
      "relationships": [
        {
          "parent": "Room-A",
          "child": "Pump-01"
        },
        {
          "parent": "Level-1",
          "child": "Room-A"
        }
      ]
    },
    "expected_output": {
      "asset_id": "Pump-01",
      "spatial_path": "Level-1/Room-A/Pump-01",
      "is_orphaned": false,
      "record_note": "simplified synthetic app record"
    }
  },
  {
    "input": {
      "query_target": "Chiller-99",
      "relationships": []
    },
    "expected_output": {
      "asset_id": "Chiller-99",
      "spatial_path": null,
      "is_orphaned": true,
      "record_note": "simplified synthetic app record"
    }
  }
]
```

## Safety
Performs read-only spatial inspections without altering original source IFC models.
Use mock external writes. Require human review before any real deployment.