Metadata-Version: 2.4
Name: isa-data
Version: 1.0.2
Summary: isA_Data — data analytics, data-fabric, and data-product SDK for the isA platform
Author: Data Analytics Team
License: Proprietary
Requires-Python: >=3.12
Description-Content-Type: text/markdown
Requires-Dist: fastapi>=0.104.1
Requires-Dist: uvicorn[standard]>=0.24.0
Requires-Dist: python-multipart>=0.0.9
Requires-Dist: pydantic>=2.5.0
Requires-Dist: pydantic-settings>=2.0.0
Requires-Dist: asyncpg>=0.29.0
Requires-Dist: psycopg[binary]>=3.0.0
Requires-Dist: sqlalchemy[asyncio]>=2.0
Requires-Dist: duckdb>=0.9.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: pandas>=2.0.0
Requires-Dist: polars-lts-cpu>=0.20.0
Requires-Dist: pyarrow>=14.0.0
Requires-Dist: openpyxl>=3.1.0
Requires-Dist: matplotlib>=3.8.0
Requires-Dist: httpx>=0.25.2
Requires-Dist: aiohttp>=3.9.0
Requires-Dist: requests>=2.31.0
Requires-Dist: python-dotenv>=1.0.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: structlog>=23.2.0
Requires-Dist: python-logging-loki>=0.3.1
Requires-Dist: prometheus-client>=0.19.0
Requires-Dist: feast<0.50,>=0.40
Requires-Dist: redis>=5.0.0
Requires-Dist: isa-common>=0.6.0
Requires-Dist: isa-model[cloud]>=0.5.7
Provides-Extra: bigdata
Requires-Dist: deltalake>=1.2.0; extra == "bigdata"
Requires-Dist: minio>=7.2.0; extra == "bigdata"
Requires-Dist: pyiceberg[hive]>=0.7.0; extra == "bigdata"
Provides-Extra: dev
Requires-Dist: pytest>=8.0.0; extra == "dev"
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23.0; extra == "dev"
Requires-Dist: pytest-aiohttp>=1.0.0; extra == "dev"
Requires-Dist: aiosqlite>=0.19.0; extra == "dev"
Requires-Dist: papermill>=2.4.0; extra == "dev"
Requires-Dist: nbformat>=5.10; extra == "dev"
Requires-Dist: nbclient>=0.10; extra == "dev"
Requires-Dist: jupyter-client>=8.0.0; extra == "dev"
Requires-Dist: ipykernel>=6.29; extra == "dev"

# isA_Data

**Cloud Data Analytics & Processing Center**

## 🎯 Purpose

独立的数据分析云服务，处理数据处理、分析、可视化等任务。
从 `isA_MCP/tools/services/data_analytics_service` 迁移而来，提供 API 服务。

## 🏗️ Architecture

```
isA_Data/
├── app/
│   ├── main.py                    # FastAPI 主服务
│   ├── config.py                  # 配置管理
│   └── api/
│       ├── analytics.py           # 数据分析端点
│       ├── processing.py          # 数据处理端点
│       └── visualization.py       # 数据可视化端点
│
├── services/
│   ├── analytics/                 # [迁移自 isA_MCP]
│   │   ├── pandas_ops.py          # Pandas 操作
│   │   ├── statistical.py         # 统计分析
│   │   └── ml_analysis.py         # ML 分析
│   │
│   ├── processing/
│   │   ├── etl.py                 # ETL 处理
│   │   ├── cleaning.py            # 数据清洗
│   │   └── transformation.py      # 数据转换
│   │
│   └── storage/
│       ├── database.py            # 数据库操作
│       └── cache.py               # 缓存管理
│
├── core/
│   ├── logging.py
│   └── clients/
│       └── model_client.py        # ISA Model 客户端
│
├── deployment/
│   ├── docker/
│   │   └── Dockerfile
│   └── kubernetes/
│       └── deployment.yaml
│
├── tests/
│   └── test_analytics.py
│
├── requirements.txt
└── README.md
```

## 📡 API Endpoints

### Data Analytics
```
POST /api/v1/data/analyze
POST /api/v1/data/statistics
POST /api/v1/data/ml/predict
```

### Data Processing
```
POST /api/v1/data/clean
POST /api/v1/data/transform
POST /api/v1/data/aggregate
```

### Data Visualization
```
POST /api/v1/data/visualize/chart
POST /api/v1/data/visualize/dashboard
```

## 📦 Install (PyPI)

`isa-data` is published to PyPI — install it as an SDK to consume the canonical
data-product contracts and the lifted data-product DevEx engines:

```bash
pip install "isa-data>=1.0.1"
```

> Use **>=1.0.1**: 1.0.0 eagerly imported `intelligent_query_service` → `deltalake`
> (not a dependency), so the lightweight dataphin engines failed to import; #457
> made that import lazy.

### Data-product DevEx kit (consumed by towers, e.g. sn_commercial_tower)

The SDK ships the tower-agnostic engines a tower delegates to (see
[`docs/data-products/tower-onboarding.md`](docs/data-products/tower-onboarding.md)
and [ADR-0006](docs/adr/0006-data-product-deploy-contract-protocol.md)):

```python
from isa_data.contracts.data_products import build_artifact_inventory, ArtifactSurfaceSpec
from isa_data.services.data_fabric_service.federation.dataphin.scaffolding import scaffold
from isa_data.services.data_fabric_service.federation.dataphin.handoff import generate_handoff
from isa_data.services.data_fabric_service.federation.dataphin.deploy import build_plan_from_contract
from isa_data.services.product_spec.deploy_contract import load_ct_contract
```

These import without the heavy data-infra stack (deltalake/duckdb) — that is pulled
only if you use `IntelligentQueryService`.

## 🚀 Usage

### As Standalone Service
```bash
# Start server (FastAPI app)
uvicorn isa_data.main:app --host 0.0.0.0 --port 8084

# Or with Docker
docker-compose up
```

### Called from isA_MCP
```python
# isA_MCP 中通过 API 调用
from tools.services.data_analytics_service import ISA_Data_Client

client = ISA_Data_Client(base_url="http://localhost:8001")
result = await client.analyze_data(
    data=df,
    analysis_type="descriptive"
)
```

## 💡 Benefits

1. **专注**: 专门处理数据相关任务
2. **性能**: 可以部署在大内存机器上处理大数据
3. **隔离**: 数据处理故障不影响 MCP 主服务
4. **可复用**: 多个服务都可以调用数据分析能力
5. **扩展**: 未来可以添加更多数据源和分析能力

## 🔄 Migration Status

- [ ] Phase 1: 基础架构搭建
- [ ] Phase 2: 迁移 data_analytics 模块
- [ ] Phase 3: FastAPI 端点实现
- [ ] Phase 4: 数据库集成
- [ ] Phase 5: isA_MCP 集成测试
- [ ] Phase 6: 生产部署

## 🔗 Related Projects

- **isA_MCP**: MCP 工具层（API 调用端）
- **isA_OS**: Web & OS 操作云服务
- **isA_Model**: 模型服务
