kcg-monitoring/prediction/models/ais.py
htlee 83b3d80c6d feat: Python 어선 분류기 + 배포 설정 + 백엔드 모니터링 프록시
- prediction/: FastAPI 7단계 분류 파이프라인 + 6개 탐지 알고리즘
  - snpdb 궤적 조회 → 인메모리 캐시(13K척) → 분류 → kcgdb 저장
  - APScheduler 5분 주기, Python 3.9 호환
  - 버그 수정: @property last_bucket, SQL INTERVAL 바인딩, rollback, None 가드
  - 보안: DB 비밀번호 하드코딩 제거 → env 환경변수 필수
- deploy/kcg-prediction.service: systemd 서비스 (redis-211, 포트 8001)
- deploy.yml: prediction CI/CD 배포 단계 추가 (192.168.1.18:32023)
- backend: PredictionProxyController (health/status/trigger 프록시)
- backend: AppProperties predictionBaseUrl + AuthFilter 인증 예외

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 12:07:40 +09:00

39 lines
721 B
Python

from dataclasses import dataclass, field
from typing import List, Dict
import pandas as pd
@dataclass
class AISPoint:
mmsi: str
ts: pd.Timestamp
lat: float
lon: float
sog: float
cog: float
state: str = 'UNKNOWN'
@dataclass
class VesselTrajectory:
mmsi: str
points: List[AISPoint] = field(default_factory=list)
vessel_type: str = 'UNKNOWN'
cluster_id: int = -1
season: str = 'UNKNOWN'
fishing_pct: float = 0.0
features: Dict = field(default_factory=dict)
@dataclass
class ClassificationResult:
mmsi: str
vessel_type: str
confidence: float
dominant_state: str
fishing_pct: float
cluster_id: int
season: str
feature_vector: Dict