Skip to main content
Loading navigation
Back to prompt library

Build a CityJSON 2.0 Building Extension Schema Inspector — implementation

Linked challenge: Build a CityJSON 2.0 Building Extension Schema Inspector

Prompt source

implementation104 lines11 sectionsNo variables1 code block
## Build
Inspect municipal CityJSON 2.0 models using custom extensions to verify taxation and historic status attributes. Validate custom object types and attribute bindings against official extension specs.

## User
City Data Governance Analyst

## Workflow
1. Ingest CityJSON 2.0 city models containing custom extension declarations in the extensions dictionary.
2. Inspect CityObjects for extended types prefixed with '+' and verify attribute schema rules.
3. Validate transform matrices and vertex coordinate bounds against declared geographical extents.
4. Generate a schema conformance report identifying unregistered extension fields or malformed types.

## Interface
A terminal CLI and web report viewer displaying schema conformance errors, extension definitions, and line numbers.

## Data
Construct small synthetic CityJSON files containing valid and invalid '+' extended attributes using standard JSON mocks.
Starter examples below are synthetic. They are not downloaded records.

## Source
[CityJSON](https://www.cityjson.org/specs/2.0.1/)
Leverages CityJSON Section 1 (extensions object) and Section 2 ('+' prefixed extended types) specifications.

## Tools
semantic-kernel, python, jsonschema.
Provides modular integration plugins for JSON Schema validation and natural language error explanation.
Instruction-following LLM to parse schema mismatches and output remediation recommendations.

## 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 all '+' prefixed extended types match an entry in the extensions block.
- Flags missing geographicalExtent arrays on first-level CityObjects.
- Emits clear validation status and actionable field error paths.

## Starter Examples
```json
[
  {
    "input": {
      "type": "CityJSON",
      "version": "2.0",
      "extensions": {
        "HeritageTax": {
          "url": "https://example.gov/schemas/v1/heritagetax.json",
          "version": "1.0"
        }
      },
      "CityObjects": {
        "BLDG-701": {
          "type": "+HeritageBuilding",
          "geographicalExtent": [
            10,
            20,
            0,
            30,
            40,
            15
          ],
          "attributes": {
            "+taxDistrict": "Historic_Core",
            "+preservationTier": 1
          }
        }
      }
    },
    "expected_output": {
      "status": "VALID",
      "registered_extensions": [
        "HeritageTax"
      ],
      "extended_objects_count": 1,
      "schema_errors": []
    }
  },
  {
    "input": {
      "type": "CityJSON",
      "version": "2.0",
      "extensions": {},
      "CityObjects": {
        "BLDG-999": {
          "type": "+UnregisteredExtensionBuilding",
          "attributes": {
            "yearBuilt": 1910
          }
        }
      }
    },
    "expected_output": {
      "status": "INVALID",
      "registered_extensions": [],
      "extended_objects_count": 1,
      "schema_errors": [
        {
          "object_id": "BLDG-999",
          "error": "Type '+UnregisteredExtensionBuilding' used without corresponding entry in extensions object",
          "path": "CityObjects.BLDG-999.type"
        },
        {
          "object_id": "BLDG-999",
          "error": "Missing geographicalExtent member on 1st-level CityObject",
          "path": "CityObjects.BLDG-999.geographicalExtent"
        }
      ]
    }
  }
]
```

## Safety
Read-only syntax verification tool with no write privileges to municipal cadastre systems.
Use mock external writes. Require human review before any real deployment.