bluegreencity-ki

ADR-001: Vector-First Architecture

Status

Accepted

Context

The BlueGreenCity-KI system needs to process urban tree data with various spatial and non-spatial attributes to compute risk scores. The data comes from multiple sources including:

We need to decide on the fundamental data processing approach:

  1. Should we process everything as raster data (grid-based)?
  2. Should we process everything as vector data (feature-based)?
  3. Should we use a hybrid approach?

Key constraints:

Decision

We will adopt a vector-first architecture where:

  1. All scoring computations operate on vector data (GeoPandas DataFrames)
  2. Each tree is a row with a unique identifier (index)
  3. Raster inputs are sampled once at tree locations and cached as DataFrame columns
  4. All criterion scores are pandas Series aligned by tree ID
  5. Final aggregation produces a per-tree DataFrame with all scores and risk

The workflow is:

Raster Data → Sample at tree points → Cached columns
                                           ↓
Tree Vector Data + Cached Raster Values → Criteria Scoring → Results DataFrame

Consequences

Positive Consequences

Negative Consequences

Neutral Consequences

Alternatives Considered

Alternative 1: Raster-First Architecture

Description: Rasterize all data (trees, roads, attributes) and perform all computations on grids.

Pros:

Cons:

Reason for rejection: Trees are fundamentally discrete point features, and risk assessment is inherently per-tree. Rasterization would lose critical information and add conversion overhead.

Alternative 2: Hybrid Processing (Both Raster and Vector Pipelines)

Description: Process some criteria on rasters (temperature, land use) and others on vectors (age, vitality), then merge results.

Pros:

Cons:

Reason for rejection: Added complexity outweighs benefits. Sampling raster values once is sufficient for our use cases, and maintaining two pipelines would increase maintenance burden.

Alternative 3: Pure DataFrame (No Spatial)

Description: Convert all data to non-spatial pandas DataFrames, dropping geometry.

Pros:

Cons:

Reason for rejection: Spatial operations are essential for several criteria (planting structure, street proximity), and spatial outputs are required for stakeholders.

References


Date: 2024-03-15
Author: BlueGreenCity-KI Team
Reviewers: Architecture Review Board