Sid-WC121
bugfix2 + update
8ac8526
Raw History Blame Contribute Delete
2.19 kB
"""Pydantic models for API I/O."""
from __future__ import annotations
from typing import Any
from pydantic import BaseModel
class ColumnInfo(BaseModel):
name: str
dtype: str
column_type: str
null_count: int = 0
unique_count: int = 0
min: Any = None
max: Any = None
mean: Any = None
std: Any = None
q25: Any = None
q50: Any = None
q75: Any = None
count: int = 0
has_numeric_stats: bool = False
median: float | None = None
iqr: float | None = None
class UploadResponse(BaseModel):
dataset_id: str
table_name: str
row_count: int
columns: list[ColumnInfo]
session_id: str
class SchemaResponse(BaseModel):
table_name: str
row_count: int
columns: list[ColumnInfo]
class ApplyOpRequest(BaseModel):
op_key: str = ""
params: dict[str, Any]
class ApplyOpResponse(BaseModel):
state_id: str
columns_schema: list[ColumnInfo]
row_count: int
sample_rows: list[dict[str, Any]]
class HistoryNode(BaseModel):
id: str
operation: str | None = None
params: dict[str, Any] = {}
parent_id: str | None = None
children: list[str] = []
is_current: bool = False
class HistoryResponse(BaseModel):
nodes: list[HistoryNode]
current_id: str | None = None
order: list[str] = []
class UndoRedoResponse(BaseModel):
state_id: str
operation: str | None = None
columns_schema: list[ColumnInfo] = []
row_count: int = 0
class ChartRequest(BaseModel):
chart_type: str # histogram, scatter, bar_topn, timeline, heatmap, map, pie, line, boxplot, area, violin, treemap, radar, stacked_bar
params: dict[str, Any]
class ChartResponse(BaseModel):
chart_type: str
spec: dict[str, Any]
class CheckpointResponse(BaseModel):
path: str
timestamp: str
state_id: str | None = None
class ExportResponse(BaseModel):
path: str
filename: str
class RowsRequest(BaseModel):
offset: int = 0
limit: int = 50
class OperationInfo(BaseModel):
key: str
label: str
description: str
param_schema: dict[str, Any]
class OperationsListResponse(BaseModel):
operations: list[OperationInfo]