## Changelog ### New Features #### Cable Graph Service - Add cable_graph.py for finding shortest path between landing points - Implement haversine distance calculation for great circle distances - Support for dateline crossing (longitude normalization) - NetworkX-based graph for optimal path finding #### Data Collectors - Add ArcGISCableCollector for fetching submarine cable data from ArcGIS GeoJSON API - Add FAOLandingPointCollector for fetching landing point data from FAO CSV API ### Backend Changes #### API Updates - auth.py: Update authentication logic - datasources.py: Add datasource endpoints and management - visualization.py: Add visualization API endpoints - config.py: Update configuration settings - security.py: Improve security settings #### Models & Schemas - task.py: Update task model with new fields - token.py: Update token schema #### Services - collectors/base.py: Improve base collector with better error handling - collectors/__init__.py: Register new collectors - scheduler.py: Update scheduler logic - tasks/scheduler.py: Add task scheduling ### Frontend Changes - AppLayout.tsx: Improve layout component - index.css: Add global styles - DataSources.tsx: Enhance data sources management page - vite.config.ts: Add Vite configuration for earth module
25 lines
950 B
Python
25 lines
950 B
Python
"""Collection Task model"""
|
|
|
|
from sqlalchemy import Column, DateTime, Integer, String, Text, Float
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.session import Base
|
|
|
|
|
|
class CollectionTask(Base):
|
|
__tablename__ = "collection_tasks"
|
|
|
|
id = Column(Integer, primary_key=True, autoincrement=True)
|
|
datasource_id = Column(Integer, nullable=False, index=True)
|
|
status = Column(String(20), nullable=False) # pending, running, success, failed, cancelled
|
|
started_at = Column(DateTime(timezone=True))
|
|
completed_at = Column(DateTime(timezone=True))
|
|
records_processed = Column(Integer, default=0)
|
|
total_records = Column(Integer, default=0) # Total records to process
|
|
progress = Column(Float, default=0.0) # Progress percentage (0-100)
|
|
error_message = Column(Text)
|
|
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
|
|
|
def __repr__(self):
|
|
return f"<CollectionTask {self.id}: {self.status}>"
|