Back to prompt library
Build a CityJSON Bridge Constructive Element Asset Register — implementation
Linked challenge: Build a CityJSON Bridge Constructive Element Asset Register
Prompt source
implementation122 lines11 sectionsNo variables1 code block
## Build
Parse CityJSON 2.0 Bridge objects and associated BridgeConstructiveElement instances into structured municipal asset registers. Validate parent-child relations and flag missing bridge addresses before asset management import.
## User
Municipal infrastructure maintenance engineer
## Workflow
1. Upload CityJSON files containing Bridge and BridgeConstructiveElement objects.
2. Traverse CityObjects hierarchy to check parents array conformance.
3. Extract address and geographical extent metadata for municipal tagging.
4. Simulate asset record ingestion and produce audit summary.
## Interface
Web dashboard with JSON schema validator, spatial tree hierarchy inspector, and CSV register export.
## Data
Download standard CityJSON 2.0 minimal models from cityjson.org or mock synthetic CityJSON bridge snippets in sandbox.
Starter examples below are synthetic. They are not downloaded records.
## Source
[CityJSON](https://www.cityjson.org/specs/2.0.1/)
Extracts CityJSON 2.0 Bridge and BridgeConstructiveElement object definitions, checking parent references and address properties from section 2.2.
## Tools
pydantic-ai, fastapi, pydantic.
Pydantic AI provides strict schema enforcement to parse nested CityJSON hierarchical structures and parent-child relations safely.
Fast inference model via API or local vLLM for JSON attribute reasoning and validation.
## 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
- Flags second-level BridgeConstructiveElement instances missing a valid parents key.
- Verifies CityJSON version is 2.0 and type is CityJSON.
- Extracts address records when present or outputs missing address notices.
## Starter Examples
```json
[
{
"input": {
"type": "CityJSON",
"version": "2.0",
"transform": {
"scale": [
1,
1,
1
],
"translate": [
0,
0,
0
]
},
"CityObjects": {
"bridge-1": {
"type": "Bridge",
"address": [
{
"city": "Rotterdam",
"country": "NL"
}
],
"children": [
"elem-101"
]
},
"elem-101": {
"type": "BridgeConstructiveElement",
"parents": [
"bridge-1"
]
}
},
"vertices": []
},
"expected_output": {
"valid": true,
"bridge_count": 1,
"element_count": 1,
"records": [
{
"id": "elem-101",
"parent_bridge": "bridge-1",
"location_address": "Rotterdam, NL",
"status": "ready"
}
],
"issues": []
}
},
{
"input": {
"type": "CityJSON",
"version": "2.0",
"transform": {
"scale": [
1,
1,
1
],
"translate": [
0,
0,
0
]
},
"CityObjects": {
"elem-999": {
"type": "BridgeConstructiveElement",
"parents": []
}
},
"vertices": []
},
"expected_output": {
"valid": false,
"bridge_count": 0,
"element_count": 1,
"records": [],
"issues": [
"elem-999: BridgeConstructiveElement must have at least one parent ID."
]
}
}
]
```
## Safety
Simulates municipal database synchronization; never issues physical structural certifications.
Use mock external writes. Require human review before any real deployment.