Skip to content

Commit 50767d2

Browse files
Gemini CLIclaude
andcommitted
feat(fusion): v7.0 multi-modal fusion engine enhancements + benchmarks
Four major v7.0 capabilities: - Vector embedding semantic matching (Gemini text-embedding-004, Tier 2.5) - LLM-enhanced strategy routing (Gemini 2.0 Flash, strategy="llm_auto") - Geographic knowledge graph (networkx DiGraph, 7 entity types, 5 relations) - Distributed/chunked computing (dask + fiona, >500K rows auto-chunked) Benchmark suite (9 metrics, all passing): - Semantic matching: P=1.00, R=0.95, F1=0.98 - Strategy selection: 100% accuracy (30/30 scenarios) - Unit conversion: zero error (8 conversion pairs) - Compatibility scoring: 100% band accuracy - Fusion quality: mean 0.96 ± 0.10 (8 strategies) - Defect detection: 100% (7/7 defect types) - Data preservation: row 1.00, geometry 1.00 - Coverage: 5/5 modalities, 10/10 strategies, 11/11 type pairs - Performance: ~30K rows/s at 10K scale Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c9a2435 commit 50767d2

26 files changed

Lines changed: 5124 additions & 76 deletions

CLAUDE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
44

55
## Project Overview
66

7-
GIS Data Agent (ADK Edition) v4.0 — an AI-powered geospatial analysis platform built on **Google Agent Developer Kit (ADK)**. It uses LLM-based semantic routing to dispatch user requests across three specialized pipelines for data governance, land-use optimization (via Deep Reinforcement Learning), and general spatial intelligence. The frontend is a custom React three-panel SPA served via **Chainlit** with password/OAuth2 authentication.
7+
GIS Data Agent (ADK Edition) v7.0 — an AI-powered geospatial analysis platform built on **Google Agent Developer Kit (ADK)**. It uses LLM-based semantic routing to dispatch user requests across three specialized pipelines for data governance, land-use optimization (via Deep Reinforcement Learning), and general spatial intelligence. The frontend is a custom React three-panel SPA served via **Chainlit** with password/OAuth2 authentication.
88

99
## Commands
1010

@@ -16,7 +16,7 @@ Default login: `admin` / `admin123` (seeded on first run). In-app self-registrat
1616

1717
### Run tests
1818
```bash
19-
# All tests (1180+ tests)
19+
# All tests (1330+ tests)
2020
.venv/Scripts/python.exe -m pytest data_agent/ --ignore=data_agent/test_knowledge_agent.py -q
2121

2222
# Single test file
@@ -130,11 +130,12 @@ All endpoints use JWT cookie auth. Routes mounted before Chainlit catch-all via
130130
| `multimodal.py` | Multimodal input processing — image/PDF classification, Gemini Part builders |
131131
| `workflow_engine.py` | Multi-step workflow engine — CRUD, execution, webhook push, cron scheduling |
132132
| `fusion_engine.py` | Multi-modal data fusion — profiling, compatibility, alignment, 10 fusion strategies |
133+
| `knowledge_graph.py` | Geographic knowledge graph — networkx-based entity-relationship modeling |
133134
| `evals/agent.py` | Evaluation umbrella agent — wraps 4 pipelines as sub_agents for ADK AgentEvaluator |
134135
| `run_evaluation.py` | Multi-pipeline ADK evaluation runner with per-metric scoring and charts |
135136

136-
### Toolsets (18 modules in `toolsets/`)
137-
Exploration, GeoProcessing, Visualization (10 tools incl. `generate_3d_map`, `control_map_layer`), Analysis, Database, SemanticLayer (9 tools), DataLake (8 tools), Streaming (5 tools), Team (8 tools), Location, Memory, Admin, File, RemoteSensing, SpatialStatistics, SkillBundles, McpHub, Fusion (4 tools).
137+
### Toolsets (19 modules in `toolsets/`)
138+
Exploration, GeoProcessing, Visualization (10 tools incl. `generate_3d_map`, `control_map_layer`), Analysis, Database, SemanticLayer (9 tools), DataLake (8 tools), Streaming (5 tools), Team (8 tools), Location, Memory, Admin, File, RemoteSensing, SpatialStatistics, SkillBundles, McpHub, Fusion (4 tools), KnowledgeGraph (3 tools).
138139

139140
### Data Loading (`_load_spatial_data` in `agent.py`)
140141
Supported formats: CSV, Excel (.xlsx/.xls), Shapefile, GeoJSON, GPKG, KML, KMZ. CSV/Excel auto-detect coordinate columns (lng/lat, lon/lat, longitude/latitude, x/y).

README.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
[English](./README_en.md) | **中文**
22

3-
# GIS Data Agent (ADK Edition) v6.0
3+
# GIS Data Agent (ADK Edition) v7.0
44

5-
基于 **Google Agent Developer Kit (ADK)** 构建的 AI 驱动地理空间分析平台。通过自然语言语义路由,自动调度四大专业管道完成空间数据治理、用地优化、多源数据融合和商业智能分析。前端为 React 三面板 SPA,后端集成 30 个 REST API,支持多模态输入、3D 可视化和工作流编排
5+
基于 **Google Agent Developer Kit (ADK)** 构建的 AI 驱动地理空间分析平台。通过自然语言语义路由,自动调度四大专业管道完成空间数据治理、用地优化、多源数据融合和商业智能分析。前端为 React 三面板 SPA,后端集成 30 个 REST API,支持多模态输入、3D 可视化、工作流编排和知识图谱推理
66

77
## 核心能力
88

9-
### 多源数据智能融合 (v5.5–v6.0)
9+
### 多源数据智能融合 (v5.5–v7.0)
1010
- **五阶段流水线**:画像 → 评估 → 对齐 → 融合 → 验证
1111
- **10 种融合策略**:空间连接、属性连接、分区统计、点采样、波段叠加、矢量叠加、时态融合、点云高度赋值、栅格矢量化、最近邻连接
1212
- **5 种数据模态**:矢量、栅格、表格、点云 (LAS/LAZ)、实时流
13-
- **智能语义匹配**:目录驱动等价组 + 分词相似度(camelCase↔snake_case)+ 类型兼容检查 + 单位自动转换
13+
- **智能语义匹配**
14+
- 四层渐进式匹配:精确 → 等价组 → 单位感知 → 模糊匹配
15+
- **v7.0 向量嵌入匹配**:Gemini text-embedding-004 语义相似度(可选启用)
16+
- 目录驱动等价组 + 分词相似度 + 类型兼容检查 + 单位自动转换
17+
- **LLM 增强策略路由 (v7.0)**:Gemini 2.0 Flash 根据用户意图智能推荐融合策略
18+
- **分布式/核外计算 (v7.0)**:大数据集(>50万行/500MB)自动分块处理,避免 OOM
19+
- **地理知识图谱 (v7.0)**:networkx 实体关系建模,空间邻接/包含关系检测,N跳邻居查询
1420
- **栅格自动处理**:CRS 重投影、分辨率重采样、大栅格窗口采样
1521
- **增强质量验证**:10 项检查(空值率、几何有效性、拓扑验证、KS 分布偏移检测等)
1622

@@ -120,7 +126,11 @@ cd frontend && npm install && npm run dev
120126
| | NL 图层控制 | 自然语言 显示/隐藏/样式/移除 地图图层 |
121127
| | MCP 工具市场 | 配置驱动的 MCP 服务器连接 + 工具聚合 |
122128
| **数据融合** | 融合引擎 (MMFE) | 五阶段流水线(画像→评估→对齐→融合→验证),10 种策略,5 种模态 |
123-
| | 语义匹配 | 目录驱动等价组 + 分词相似度 + 类型兼容检查 + 单位自动转换 |
129+
| | 语义匹配 | 五层渐进匹配:精确 → 等价组 → 嵌入相似度 → 单位感知 → 模糊 |
130+
| | 嵌入匹配 (v7.0) | Gemini text-embedding-004 向量语义匹配(可选启用) |
131+
| | LLM 策略路由 (v7.0) | Gemini 2.0 Flash 意图感知策略推荐 (`strategy="llm_auto"`) |
132+
| | 知识图谱 (v7.0) | networkx 空间实体关系建模,N跳邻居查询,最短路径 |
133+
| | 分布式计算 (v7.0) | 大数据集 (>500K行) 自动分块读取和处理 |
124134
| | 栅格处理 | 自动 CRS 重投影、分辨率重采样、大栅格窗口采样 |
125135
| | 点云 & 流数据 | LAS/LAZ 高度赋值、CSV/JSON 流数据时态融合(时间窗口+空间聚合) |
126136
| | 质量验证 | 10 项检查:空值/几何/拓扑/CRS/微面/异常值/KS分布偏移 |
@@ -180,22 +190,24 @@ data_agent/
180190
├── workflow_engine.py # 工作流引擎:CRUD、执行、Webhook、Cron 调度
181191
├── multimodal.py # 多模态输入:图片/PDF 分类、Gemini Part 构建
182192
├── mcp_hub.py # MCP Hub Manager:配置驱动的 MCP 服务器管理
183-
├── fusion_engine.py # 多模态数据融合引擎(MMFE,~1750 行)
193+
├── fusion_engine.py # 多模态数据融合引擎(MMFE,~2100 行)
194+
├── knowledge_graph.py # 地理知识图谱引擎(networkx,~625 行)
184195
├── pipeline_runner.py # 无头管道执行器 (run_pipeline_headless)
185-
├── toolsets/ # 18 个 BaseToolset 模块
196+
├── toolsets/ # 19 个 BaseToolset 模块
186197
│ ├── visualization_tools.py # 10 个工具:分级设色、热力图、3D、图层控制
187198
│ ├── fusion_tools.py # 数据融合工具集(4 个工具)
199+
│ ├── knowledge_graph_tools.py # 知识图谱工具集(3 个工具)
188200
│ ├── mcp_hub_toolset.py # MCP 工具桥接
189201
│ ├── skill_bundles.py # 5 个命名工具集分组
190202
│ └── ... # 探查、地理处理、分析、数据库、语义层等
191203
├── prompts/ # 3 个 YAML 提示词文件
192-
├── migrations/ # 18 个 SQL 迁移脚本 (001-018)
204+
├── migrations/ # 19 个 SQL 迁移脚本 (001-019)
193205
├── locales/ # 国际化:zh.yaml + en.yaml
194206
├── db_engine.py # 连接池单例
195207
├── health.py # K8s 健康检查 API
196208
├── observability.py # 结构化日志 + Prometheus
197209
├── i18n.py # 国际化:YAML + t() 函数
198-
├── test_*.py # 61 个测试文件 (1290+ 测试)
210+
├── test_*.py # 62 个测试文件 (1330+ 测试)
199211
└── run_evaluation.py # Agent 评估运行器
200212
201213
frontend/
@@ -270,7 +282,7 @@ docs/ # 文档
270282
## 运行测试
271283

272284
```bash
273-
# 全量测试 (1290+ 测试)
285+
# 全量测试 (1330+ 测试)
274286
python -m pytest data_agent/ --ignore=data_agent/test_knowledge_agent.py -q
275287

276288
# 单个模块
@@ -305,9 +317,10 @@ GitHub Actions 工作流(`.github/workflows/ci.yml`)在 push 到 `main`/`dev
305317
| v5.4 | 工作流编排(引擎 + 编辑器 + Cron + Webhook) | 完成 |
306318
| v5.5 | 多模态数据融合引擎 MMFE(5 模态、10 策略、语义匹配) | 完成 |
307319
| v5.6 | MGIM 启发增强(模糊匹配、单位转换、数据感知策略、多源编排) | 完成 |
308-
| v6.0 | 融合引擎不足修复(栅格重投影、点云高度、流数据时态、语义增强、质量验证) | **当前** |
320+
| v6.0 | 融合引擎不足修复(栅格重投影、点云高度、流数据时态、语义增强、质量验证) | 完成 |
309321
| v6.1 | 高级分析引擎(时空预测、场景模拟、网络分析) | 计划中 |
310-
| v7.0 | 实时协作、知识图谱、边缘部署 | 规划中 |
322+
| v7.0 | 向量嵌入匹配、LLM 策略路由、地理知识图谱、分布式计算 | **当前** |
323+
| v8.0 | 实时协作、边缘部署、数据连接器生态 | 规划中 |
311324

312325
## 许可证
313326

README_en.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
**English** | [中文](./README.md)
22

3-
# GIS Data Agent (ADK Edition) v6.0
3+
# GIS Data Agent (ADK Edition) v7.0
44

5-
An AI-powered geospatial analysis platform that turns natural language into spatial intelligence. Built on **Google Agent Developer Kit (ADK)** with semantic intent routing, four specialized pipelines, a React three-panel frontend, and enterprise-grade security. Features multi-source data fusion, multimodal input, 3D visualization, and workflow orchestration.
5+
An AI-powered geospatial analysis platform that turns natural language into spatial intelligence. Built on **Google Agent Developer Kit (ADK)** with semantic intent routing, four specialized pipelines, a React three-panel frontend, and enterprise-grade security. Features multi-source data fusion, multimodal input, 3D visualization, workflow orchestration, and geographic knowledge graph.
66

77
## Core Capabilities
88

9-
### Multi-Source Data Fusion (v5.5–v6.0)
9+
### Multi-Source Data Fusion (v5.5–v7.0)
1010
- **Five-stage pipeline**: Profile → Assess → Align → Fuse → Validate
1111
- **10 fusion strategies**: spatial join, attribute join, zonal statistics, point sampling, band stack, overlay, temporal fusion, point cloud height assignment, raster vectorize, nearest join
1212
- **5 data modalities**: vector, raster, tabular, point cloud (LAS/LAZ), real-time stream
13-
- **Intelligent semantic matching**: catalog-driven equivalence groups + tokenized similarity (camelCase↔snake_case) + type compatibility + automatic unit conversion
13+
- **Intelligent semantic matching**:
14+
- Five-tier progressive matching: exact → equivalence groups → embedding similarity → unit-aware → fuzzy
15+
- **v7.0 Vector embedding matching**: Gemini text-embedding-004 cosine similarity (opt-in)
16+
- Catalog-driven equivalence groups + tokenized similarity + type compatibility + auto unit conversion
17+
- **LLM-enhanced strategy routing (v7.0)**: Gemini 2.0 Flash intent-aware strategy recommendation
18+
- **Distributed/out-of-core computing (v7.0)**: Auto-chunked processing for large datasets (>500K rows / >500MB)
19+
- **Geographic knowledge graph (v7.0)**: networkx entity-relationship modeling, spatial adjacency/containment detection, N-hop neighbor queries
1420
- **Raster auto-processing**: CRS reprojection, resolution resampling, windowed sampling for large rasters
1521
- **Enhanced quality validation**: 10 checks (null rate, geometry validity, topology, KS distribution shift, etc.)
1622

@@ -120,7 +126,11 @@ Default login: `admin` / `admin123` (seeded on first run). In-app self-registrat
120126
| | NL Layer Control | Natural language show/hide/style/remove map layers via `control_map_layer` tool |
121127
| | MCP Tool Market | Config-driven MCP server connection + tool aggregation |
122128
| **Data Fusion** | Fusion Engine (MMFE) | Five-stage pipeline (Profile→Assess→Align→Fuse→Validate), 10 strategies, 5 modalities |
123-
| | Semantic Matching | Catalog-driven equivalence groups + tokenized similarity + type compatibility + auto unit conversion |
129+
| | Semantic Matching | Five-tier progressive: exact → equivalence groups → embedding similarity → unit-aware → fuzzy |
130+
| | Embedding Matching (v7.0) | Gemini text-embedding-004 vector semantic matching (opt-in) |
131+
| | LLM Strategy Routing (v7.0) | Gemini 2.0 Flash intent-aware strategy recommendation (`strategy="llm_auto"`) |
132+
| | Knowledge Graph (v7.0) | networkx spatial entity-relationship modeling, N-hop queries, shortest path |
133+
| | Distributed Computing (v7.0) | Auto-chunked processing for large datasets (>500K rows) |
124134
| | Raster Processing | Auto CRS reprojection, resolution resampling, windowed sampling for large rasters |
125135
| | Point Cloud & Stream | LAS/LAZ height assignment, CSV/JSON stream temporal fusion (time window + spatial aggregation) |
126136
| | Quality Validation | 10 checks: null rate, geometry, topology, CRS, micro-polygons, outliers, KS distribution shift |
@@ -180,22 +190,24 @@ data_agent/
180190
├── workflow_engine.py # Workflow engine: CRUD, execution, webhook, cron
181191
├── multimodal.py # Multimodal input: image/PDF classification, Gemini Parts
182192
├── mcp_hub.py # MCP Hub Manager: config-driven MCP server management
183-
├── fusion_engine.py # Multi-modal Data Fusion Engine (MMFE, ~1750 lines)
193+
├── fusion_engine.py # Multi-modal Data Fusion Engine (MMFE, ~2100 lines)
194+
├── knowledge_graph.py # Geographic Knowledge Graph Engine (networkx, ~625 lines)
184195
├── pipeline_runner.py # Headless pipeline executor (run_pipeline_headless)
185-
├── toolsets/ # 18 BaseToolset modules
196+
├── toolsets/ # 19 BaseToolset modules
186197
│ ├── visualization_tools.py # 10 tools: choropleth, heatmap, 3D, layer control
187198
│ ├── fusion_tools.py # Data fusion toolset (4 tools)
199+
│ ├── knowledge_graph_tools.py # Knowledge graph toolset (3 tools)
188200
│ ├── mcp_hub_toolset.py # MCP tool bridge
189201
│ ├── skill_bundles.py # 5 named toolset groupings
190202
│ └── ... # exploration, geo processing, analysis, database, etc.
191203
├── prompts/ # 3 YAML prompt files
192-
├── migrations/ # 18 SQL migration scripts (001-018)
204+
├── migrations/ # 19 SQL migration scripts (001-019)
193205
├── locales/ # i18n: zh.yaml + en.yaml
194206
├── db_engine.py # Connection pool singleton
195207
├── health.py # K8s health check API
196208
├── observability.py # Structured logging + Prometheus
197209
├── i18n.py # i18n: YAML dict + t() function
198-
├── test_*.py # 61 test files (1290+ tests)
210+
├── test_*.py # 62 test files (1330+ tests)
199211
└── run_evaluation.py # Agent evaluation runner
200212
201213
frontend/
@@ -271,7 +283,7 @@ Custom React SPA replacing Chainlit's default UI:
271283
## Running Tests
272284

273285
```bash
274-
# All tests (1290+ tests)
286+
# All tests (1330+ tests)
275287
python -m pytest data_agent/ --ignore=data_agent/test_knowledge_agent.py -q
276288

277289
# Single module
@@ -306,9 +318,10 @@ GitHub Actions workflow (`.github/workflows/ci.yml`) runs on push to `main`/`dev
306318
| v5.4 | Workflow Builder (Engine + Editor + Cron + Webhook) | Done |
307319
| v5.5 | Multi-Modal Data Fusion Engine MMFE (5 modalities, 10 strategies, semantic matching) | Done |
308320
| v5.6 | MGIM-Inspired Enhancements (fuzzy matching, unit conversion, data-aware scoring, multi-source) | Done |
309-
| v6.0 | Fusion Engine Improvements (raster reprojection, point cloud, stream temporal, semantic+quality) | **Current** |
321+
| v6.0 | Fusion Engine Improvements (raster reprojection, point cloud, stream temporal, semantic+quality) | Done |
310322
| v6.1 | Advanced Analytics Engine (spatiotemporal prediction, scenario simulation, network analysis) | Planned |
311-
| v7.0 | Real-time Collaboration, Knowledge Graph, Edge Deployment | Future |
323+
| v7.0 | Vector Embedding Matching, LLM Strategy Routing, Knowledge Graph, Distributed Computing | **Current** |
324+
| v8.0 | Real-time Collaboration, Edge Deployment, Data Connector Ecosystem | Future |
312325

313326
## License
314327

data_agent/agent.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
DataLakeToolset,
4848
McpHubToolset,
4949
FusionToolset,
50+
KnowledgeGraphToolset,
5051
)
5152

5253
# ArcPy conditional function lists (for governance agents needing specific subsets)
@@ -297,6 +298,7 @@
297298
DataLakeToolset(),
298299
McpHubToolset(pipeline="general"),
299300
FusionToolset(),
301+
KnowledgeGraphToolset(),
300302
] + _arcpy_tools,
301303
)
302304

@@ -384,6 +386,7 @@ def _make_planner_processor(name: str, **overrides) -> LlmAgent:
384386
DatabaseToolset(tool_filter=["import_to_postgis"]),
385387
McpHubToolset(pipeline="planner"),
386388
FusionToolset(),
389+
KnowledgeGraphToolset(),
387390
] + _arcpy_tools,
388391
)
389392
defaults.update(overrides)

data_agent/app.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@
121121
ensure_chainlit_tables()
122122
from data_agent.workflow_engine import ensure_workflow_tables
123123
ensure_workflow_tables()
124+
from data_agent.fusion_engine import ensure_fusion_tables
125+
ensure_fusion_tables()
126+
from data_agent.knowledge_graph import ensure_knowledge_graph_tables
127+
ensure_knowledge_graph_tables()
124128
except Exception as _startup_err:
125129
logger.warning("DB initialization partially failed: %s", _startup_err)
126130
# Ensure resolve_semantic_context/build_context_prompt are importable even on failure

0 commit comments

Comments
 (0)