# airbee-project/kasane-logic architecture

> Architecture diagram of the GitHub repository airbee-project/kasane-logic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/airbee-project/kasane-logic
- Repository: https://github.com/airbee-project/kasane-logic

## Overview

Kasane-Logic is a Rust core library for high-precision conversion of geometric shapes into spatial IDs, with spatial-ID collections and composable queries as major runtime capabilities. The documented user workflow is to provide geometry and obtain spatial coverage; the sampled query code additionally shows query construction, validation, and execution into a table. The README is brief and most geometry and collection implementations were not excerpted, so detailed conversion and storage links are limited to documented or indexed evidence.

Main entry points: [`src/spatial_id/collection/query/execution/mod.rs`](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/query/execution/mod.rs) (Query Execution), [`src/geometry/traits.rs`](https://github.com/airbee-project/kasane-logic/blob/main/src/geometry/traits.rs) (Spatial Coverage), [`src/spatial_id/single_id`](https://github.com/airbee-project/kasane-logic/tree/main/src/spatial_id/single_id) (ID Types), [`src/spatial_id/collection/flex_tree/core/node.rs`](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/flex_tree/core/node.rs) (Flex Tree)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_geometry["Geometry"]
  node_points["Coordinate Types<br/>[impls.rs]"]
  node_shapes["Geometric Shapes"]
  node_regionmesh["RegionMesh<br/>[regionmesh.rs]"]
  node_coverage["Spatial Coverage<br/>[traits.rs]"]
end

subgraph group_ids["Spatial IDs"]
  node_id_types["ID Types"]
  node_zoom["Zoom Levels<br/>[zoom_level.rs]"]
  node_time["Temporal Intervals"]
end

subgraph group_collections["Collections"]
  node_flex_tree["Flex Tree<br/>[node.rs]"]
  node_id_set["Spatial ID Set<br/>[impls.rs]"]
  node_id_table[("Spatial ID Table<br/>[mod.rs]")]
end

subgraph group_queries["Queries"]
  node_query_builder["Query Builder<br/>[mod.rs]"]
  node_unary_ops["Unary Operators"]
  node_binary_ops["Binary Operators"]
  node_merge_policy["Merge Policies<br/>[mod.rs]"]
  node_query_execution["Query Execution<br/>[mod.rs]"]
  node_source["Query Source<br/>[source.rs]"]
end

node_geometry_input(("Geometry Input"))

node_geometry_input -.->|"provides shapes"| node_shapes
node_geometry_input -.->|"provides coordinates"| node_points
node_shapes -.->|"covers IDs"| node_coverage
node_points -.->|"converts to IDs"| node_coverage
node_regionmesh -.->|"converts geometry"| node_coverage
node_coverage -.->|"produces spatial IDs"| node_id_types
node_id_types -->|"uses zoom levels"| node_zoom
node_id_types -.->|"supports temporal IDs"| node_time
node_flex_tree -->|"backs set"| node_id_set
node_flex_tree -.->|"backs table"| node_id_table
node_source -->|"reads source"| node_query_execution
node_query_builder -->|"wraps operators"| node_unary_ops
node_query_builder -->|"runs binary queries"| node_binary_ops
node_query_builder -->|"validates and runs"| node_query_execution
node_unary_ops -->|"uses policies"| node_merge_policy
node_query_execution -->|"returns table"| node_id_table
node_query_execution -->|"uses summaries"| node_flex_tree

click node_points "https://github.com/airbee-project/kasane-logic/blob/main/src/geometry/point/coordinate/impls.rs"
click node_shapes "https://github.com/airbee-project/kasane-logic/tree/main/src/geometry/shape"
click node_regionmesh "https://github.com/airbee-project/kasane-logic/blob/main/src/geometry/geodata_formats/regionmesh.rs"
click node_coverage "https://github.com/airbee-project/kasane-logic/blob/main/src/geometry/traits.rs"
click node_id_types "https://github.com/airbee-project/kasane-logic/tree/main/src/spatial_id/single_id"
click node_zoom "https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/zoom_level.rs"
click node_time "https://github.com/airbee-project/kasane-logic/tree/main/src/spatial_id/time"
click node_flex_tree "https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/flex_tree/core/node.rs"
click node_id_set "https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/flex_tree/set/impls.rs"
click node_id_table "https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/flex_tree/table/mod.rs"
click node_query_builder "https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/query/execution/mod.rs"
click node_unary_ops "https://github.com/airbee-project/kasane-logic/tree/main/src/spatial_id/collection/query/ops/unary"
click node_binary_ops "https://github.com/airbee-project/kasane-logic/tree/main/src/spatial_id/collection/query/ops/binary"
click node_merge_policy "https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/query/merge_policy/mod.rs"
click node_query_execution "https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/query/execution/mod.rs"
click node_source "https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/query/source.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_points,node_shapes,node_regionmesh,node_coverage toneBlue
class node_id_types,node_zoom,node_time toneAmber
class node_flex_tree,node_id_set,node_id_table toneMint
class node_query_builder,node_unary_ops,node_binary_ops,node_merge_policy,node_query_execution,node_source toneRose
class node_geometry_input toneIndigo
```

## Components

### Geometry

- [Coordinate Types](https://github.com/airbee-project/kasane-logic/blob/main/src/geometry/point/coordinate/impls.rs): `src/geometry/point/coordinate/impls.rs`
- [Geometric Shapes](https://github.com/airbee-project/kasane-logic/tree/main/src/geometry/shape): `src/geometry/shape`
- [RegionMesh](https://github.com/airbee-project/kasane-logic/blob/main/src/geometry/geodata_formats/regionmesh.rs): `src/geometry/geodata_formats/regionmesh.rs`
- [Spatial Coverage](https://github.com/airbee-project/kasane-logic/blob/main/src/geometry/traits.rs): `src/geometry/traits.rs`

### Spatial IDs

- [ID Types](https://github.com/airbee-project/kasane-logic/tree/main/src/spatial_id/single_id): `src/spatial_id/single_id`
- [Zoom Levels](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/zoom_level.rs): `src/spatial_id/zoom_level.rs`
- [Temporal Intervals](https://github.com/airbee-project/kasane-logic/tree/main/src/spatial_id/time): `src/spatial_id/time`

### Collections

- [Flex Tree](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/flex_tree/core/node.rs): `src/spatial_id/collection/flex_tree/core/node.rs`
- [Spatial ID Set](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/flex_tree/set/impls.rs): `src/spatial_id/collection/flex_tree/set/impls.rs`
- [Spatial ID Table](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/flex_tree/table/mod.rs): `src/spatial_id/collection/flex_tree/table/mod.rs`

### Queries

- [Query Builder](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/query/execution/mod.rs): `src/spatial_id/collection/query/execution/mod.rs`
- [Unary Operators](https://github.com/airbee-project/kasane-logic/tree/main/src/spatial_id/collection/query/ops/unary): `src/spatial_id/collection/query/ops/unary`
- [Binary Operators](https://github.com/airbee-project/kasane-logic/tree/main/src/spatial_id/collection/query/ops/binary): `src/spatial_id/collection/query/ops/binary`
- [Merge Policies](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/query/merge_policy/mod.rs): `src/spatial_id/collection/query/merge_policy/mod.rs`
- [Query Execution](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/query/execution/mod.rs): `src/spatial_id/collection/query/execution/mod.rs`
- [Query Source](https://github.com/airbee-project/kasane-logic/blob/main/src/spatial_id/collection/query/source.rs): `src/spatial_id/collection/query/source.rs`

### Other components

- **Geometry Input**

## Connections

- Geometry Input → Geometric Shapes: provides shapes
- Geometry Input → Coordinate Types: provides coordinates
- Geometric Shapes → Spatial Coverage: covers IDs
- Coordinate Types → Spatial Coverage: converts to IDs (evidence: `src/geometry/point/coordinate/impls.rs`)
- RegionMesh → Spatial Coverage: converts geometry
- Spatial Coverage → ID Types: produces spatial IDs
- ID Types → Zoom Levels: uses zoom levels (evidence: `src/spatial_id/zoom_level.rs`)
- ID Types → Temporal Intervals: supports temporal IDs (evidence: `src/spatial_id/mod.rs`)
- Flex Tree → Spatial ID Set: backs set
- Flex Tree → Spatial ID Table: backs table
- Query Source → Query Execution: reads source (evidence: `src/spatial_id/collection/query/execution/mod.rs`)
- Query Builder → Unary Operators: wraps operators (evidence: `src/spatial_id/collection/query/ops/unary/shift/query.rs`)
- Query Builder → Binary Operators: runs binary queries (evidence: `src/spatial_id/collection/query/execution/mod.rs`)
- Query Builder → Query Execution: validates and runs (evidence: `src/spatial_id/collection/query/execution/mod.rs`)
- Unary Operators → Merge Policies: uses policies (evidence: `src/spatial_id/collection/query/ops/unary/falloff/query.rs`)
- Query Execution → Spatial ID Table: returns table (evidence: `src/spatial_id/collection/query/execution/mod.rs`)
- Query Execution → Flex Tree: uses summaries (evidence: `src/spatial_id/collection/query/execution/mod.rs`)
