feat: engineer SBAS timeseries production workflow

This commit is contained in:
2026-04-29 14:43:31 +08:00
parent dace8b20f6
commit 4c0d1f2c2b
54 changed files with 5843 additions and 201 deletions
+7 -1
View File
@@ -15,6 +15,8 @@ from .orm import (
PairingMetricCacheORM,
PairingNetworkRunORM,
PairingNetworkEdgeORM,
TimeseriesStackPlanORM,
TimeseriesStackPlanItemORM,
HazardPointORM,
SystemTaskORM,
TaskLogORM,
@@ -59,6 +61,9 @@ from .schemas import (
RadarPair,
PairingResponse,
PsRequest,
TimeseriesStackPlan,
TimeseriesStackPlanItem,
TimeseriesStackPlanDetail,
TaskInfo,
AuthUserInfo,
AuthAuditLogInfo,
@@ -84,6 +89,7 @@ __all__ = [
"ResultIssueORM", "ResultCatalogStateORM",
"PairingCacheStateORM", "PairingDirtySceneORM", "PairingMetricCacheORM",
"PairingNetworkRunORM", "PairingNetworkEdgeORM",
"TimeseriesStackPlanORM", "TimeseriesStackPlanItemORM",
"SystemTaskORM", "TaskLogORM", "SystemJobORM", "ScanStateORM",
"ManagedRootORM", "ScanCursorORM", "PathInventoryORM",
"WorkflowDefORM", "WorkflowRunORM", "WorkflowStepORM", "WorkflowArtifactORM",
@@ -99,7 +105,7 @@ __all__ = [
"HazardPoint", "DinsarResult", "ScanRequest", "ManagedRootInfo", "ScanCursorInfo",
"RadarData", "RadarDataPage", "DinsarResultPage",
"PairingRequest", "RadarPair", "PairingResponse",
"PsRequest", "TaskInfo",
"PsRequest", "TimeseriesStackPlan", "TimeseriesStackPlanItem", "TimeseriesStackPlanDetail", "TaskInfo",
"AuthUserInfo", "AuthAuditLogInfo", "RadarPreviewStatusInfo",
"DinsarTaskBatch", "DinsarTaskItem", "PsTaskBatch", "PsTaskItem", "PsTimeseriesRun",
"WaterDetectRequest", "WaterDetectResponse",
+71
View File
@@ -442,6 +442,72 @@ class PairingNetworkEdgeORM(Base):
)
class TimeseriesStackPlanORM(Base):
__tablename__ = "timeseries_stack_plans"
id = Column(Integer, primary_key=True, autoincrement=True)
plan_id = Column(String(64), unique=True, index=True, nullable=False)
strategy = Column(String(32), index=True, nullable=False, default="sbas_stack")
request_hash = Column(String(64), index=True, nullable=True)
request_params_json = Column(JSON, nullable=True)
aoi_source = Column(String(32), nullable=True)
aoi_hash = Column(String(64), index=True, nullable=True)
aoi_summary_json = Column(JSON, nullable=True)
direction = Column(String(32), index=True, nullable=True)
scene_count = Column(Integer, nullable=False, default=0)
stack_key = Column(String(128), index=True, nullable=True)
group_key = Column(String(128), index=True, nullable=True)
status = Column(String(16), index=True, nullable=False, default="READY")
created_by = Column(String(64), nullable=True)
created_at = Column(DateTime, server_default=func.now(), nullable=False)
updated_at = Column(DateTime, server_default=func.now(), onupdate=func.now())
items = relationship(
"TimeseriesStackPlanItemORM",
back_populates="plan",
cascade="all, delete-orphan",
)
__table_args__ = (
Index("idx_timeseries_stack_plans_direction_created", "direction", "created_at"),
)
class TimeseriesStackPlanItemORM(Base):
__tablename__ = "timeseries_stack_plan_items"
id = Column(Integer, primary_key=True, autoincrement=True)
plan_ref_id = Column(
Integer,
ForeignKey("timeseries_stack_plans.id", ondelete="CASCADE"),
index=True,
nullable=False,
)
radar_data_ref_id = Column(
Integer,
ForeignKey("radar_data.id", ondelete="SET NULL"),
index=True,
nullable=True,
)
scene_rank = Column(Integer, nullable=False, default=0)
file_path = Column(String, nullable=False)
satellite = Column(String, nullable=True)
imaging_date = Column(String, nullable=True)
imaging_mode = Column(String, nullable=True)
polarization = Column(String, nullable=True)
has_orbit_data = Column(Boolean, nullable=False, default=False)
selection_meta_json = Column(JSON, nullable=True)
created_at = Column(DateTime, server_default=func.now(), nullable=False)
plan = relationship("TimeseriesStackPlanORM", back_populates="items")
radar_data = relationship("RadarDataORM")
__table_args__ = (
UniqueConstraint("plan_ref_id", "scene_rank", name="uq_timeseries_plan_items_plan_rank"),
Index("idx_timeseries_plan_items_plan_date", "plan_ref_id", "imaging_date"),
)
class HazardPointORM(Base):
__tablename__ = 'hazard_points'
@@ -901,6 +967,8 @@ class PsTaskBatchORM(Base):
batch_id = Column(String, unique=True, index=True, nullable=False)
name = Column(String, nullable=True)
direction = Column(String, nullable=True)
plan_id = Column(String(64), index=True, nullable=True)
plan_strategy = Column(String(32), nullable=True)
status = Column(String, index=True, nullable=False, default="PENDING")
total_items = Column(Integer, default=0)
completed_items = Column(Integer, default=0)
@@ -915,6 +983,7 @@ class PsTaskItemORM(Base):
id = Column(Integer, primary_key=True, autoincrement=True)
batch_id = Column(String, ForeignKey("ps_task_batches.batch_id"), index=True, nullable=False)
plan_item_ref_id = Column(Integer, index=True, nullable=True)
file_path = Column(String, nullable=False)
satellite = Column(String, nullable=True)
@@ -937,6 +1006,8 @@ class PsTimeseriesRunORM(Base):
id = Column(Integer, primary_key=True, autoincrement=True)
run_id = Column(String(64), unique=True, index=True, nullable=False)
batch_id = Column(String, ForeignKey("ps_task_batches.batch_id"), index=True, nullable=False)
plan_id = Column(String(64), index=True, nullable=True)
plan_strategy = Column(String(32), nullable=True)
product_family = Column(String(32), index=True, nullable=True)
run_name = Column(String(255), nullable=False)
+58 -2
View File
@@ -194,6 +194,15 @@ class RadarData(BaseModel):
preview_cache_version: Optional[str] = None
preview_cache_updated_at: Optional[datetime] = None
preview_cache_error: Optional[str] = None
stack_plan_id: Optional[str] = None
stack_plan_item_id: Optional[int] = None
stack_scene_rank: Optional[int] = None
stack_group_key: Optional[str] = None
stack_key: Optional[str] = None
stack_common_aoi_coverage_ratio: Optional[float] = None
stack_coverage_consistency_ratio: Optional[float] = None
stack_threshold_satisfied: Optional[bool] = None
stack_selection_mode: Optional[str] = None
model_config = ConfigDict(from_attributes=True)
@@ -342,8 +351,50 @@ class PairingResponse(BaseModel):
class PsRequest(BaseModel):
"""PS-InSAR 时序分析数据准备的请求模型。"""
initial_overlap_threshold: float = 0.3
final_overlap_threshold: float = 0.95
initial_overlap_threshold: float = Field(default=0.3, ge=0.0, le=1.0)
final_overlap_threshold: float = Field(default=0.95, ge=0.0, le=1.0)
class TimeseriesStackPlanItem(BaseModel):
id: int
plan_ref_id: int
radar_data_ref_id: Optional[int] = None
scene_rank: int
file_path: str
satellite: Optional[str] = None
imaging_date: Optional[str] = None
imaging_mode: Optional[str] = None
polarization: Optional[str] = None
has_orbit_data: bool
selection_meta_json: Optional[Dict[str, Any]] = None
created_at: datetime
model_config = ConfigDict(from_attributes=True)
class TimeseriesStackPlan(BaseModel):
id: int
plan_id: str
strategy: str
request_hash: Optional[str] = None
request_params_json: Optional[Dict[str, Any]] = None
aoi_source: Optional[str] = None
aoi_hash: Optional[str] = None
aoi_summary_json: Optional[Dict[str, Any]] = None
direction: Optional[str] = None
scene_count: int
stack_key: Optional[str] = None
group_key: Optional[str] = None
status: str
created_by: Optional[str] = None
created_at: datetime
updated_at: Optional[datetime] = None
model_config = ConfigDict(from_attributes=True)
class TimeseriesStackPlanDetail(TimeseriesStackPlan):
items: List[TimeseriesStackPlanItem] = Field(default_factory=list)
class TaskInfo(BaseModel):
@@ -446,6 +497,8 @@ class PsTaskBatch(BaseModel):
batch_id: str
name: Optional[str] = None
direction: Optional[str] = None
plan_id: Optional[str] = None
plan_strategy: Optional[str] = None
status: str
total_items: int
completed_items: int
@@ -458,6 +511,7 @@ class PsTaskBatch(BaseModel):
class PsTaskItem(BaseModel):
id: int
batch_id: str
plan_item_ref_id: Optional[int] = None
file_path: str
satellite: Optional[str] = None
imaging_date: Optional[str] = None
@@ -474,6 +528,8 @@ class PsTaskItem(BaseModel):
class PsTimeseriesRun(BaseModel):
run_id: str
batch_id: str
plan_id: Optional[str] = None
plan_strategy: Optional[str] = None
product_family: Optional[str] = None
run_name: str
catalog_name: str