Skip to main content
Loading navigation
Back to prompt library

Build a CityJSON Bridge Constructive Element Hierarchy Auditor — implementation

Linked challenge: Build a CityJSON Bridge Constructive Element Hierarchy Auditor

Prompt source

implementation97 lines11 sectionsNo variables1 code block
## Build
Parse CityJSON 2.0 Bridge objects and child elements to verify structural parentage and municipal address records. Flag disconnected bridge constructive components prior to asset database ingestion.

## User
Municipal Infrastructure Engineer

## Workflow
1. Parse CityJSON 2.0 city models containing Bridge, BridgePart, and BridgeConstructiveElement objects.
2. Traverse children and parents arrays to identify broken topological relationships or orphaned bridge elements.
3. Check address objects for required municipal jurisdiction attributes and multi-surface geometry validity.
4. Produce a structured bridge asset compliance scorecard highlighting missing parents or invalid addresses.

## Interface
A municipal GIS inspection dashboard showing bridge object hierarchies, attribute tables, and topology error maps.

## Data
Generate local synthetic CityJSON 2.0 bridge files following Section 2.2 specifications without requiring proprietary municipal data.
Starter examples below are synthetic. They are not downloaded records.

## Source
[CityJSON](https://www.cityjson.org/specs/2.0.1/)
Extracts Bridge, BridgePart, and BridgeConstructiveElement hierarchy rules and address structures from Section 2.2 of CityJSON 2.0.

## Tools
mastra-ai, python, fastapi.
Coordinates multi-step validation workflows across complex nested 3D geometric object hierarchies.
Instruction-tuned hosted model capable of parsing nested structural hierarchies and returning clean JSON.

## 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
- Verifies that BridgeConstructiveElement instances always declare an explicit parent.
- Detects missing address entries on primary Bridge parent objects.
- Outputs structured validation summaries matching the CityJSON 2.0 Bridge schema.

## Starter Examples
```json
[
  {
    "input": {
      "cityjson_id": "BRIDGE-METRO-01",
      "city_objects": {
        "Bridge-Main": {
          "type": "Bridge",
          "address": [
            {
              "city": "Springfield",
              "country": "US"
            }
          ],
          "children": [
            "Element-Deck-01"
          ]
        },
        "Element-Deck-01": {
          "type": "BridgeConstructiveElement",
          "parents": [
            "Bridge-Main"
          ]
        }
      }
    },
    "expected_output": {
      "cityjson_id": "BRIDGE-METRO-01",
      "is_valid": true,
      "hierarchy_errors": [],
      "elements_checked": 2
    }
  },
  {
    "input": {
      "cityjson_id": "BRIDGE-METRO-02",
      "city_objects": {
        "Bridge-West": {
          "type": "Bridge",
          "address": [],
          "children": []
        },
        "Element-Pier-05": {
          "type": "BridgeConstructiveElement",
          "parents": []
        }
      }
    },
    "expected_output": {
      "cityjson_id": "BRIDGE-METRO-02",
      "is_valid": false,
      "hierarchy_errors": [
        {
          "object_id": "Bridge-West",
          "error": "Missing required bridge address metadata"
        },
        {
          "object_id": "Element-Pier-05",
          "error": "BridgeConstructiveElement lacks mandatory parent identifier"
        }
      ],
      "elements_checked": 2
    }
  }
]
```

## Safety
Maintains read-only operations on city spatial models without triggering municipal GIS state changes.
Use mock external writes. Require human review before any real deployment.