Geofences could be drawn but not removed. VesselAPI Hormuz dots vanished
on restart and DVR skipped between the 5 daily polls. Sentinel-1 re-hit
STAC on every pan and often painted a neighbouring swath. Executive
briefs truncated; ticker stayed empty unless something was critical.
- Layer-panel list + polygon popup DELETE /api/geofences/{id}
- Persist VesselAPI polls to vessels (UTC-day purge, DVR as-of, boot hydrate)
- Cache Sentinel-1 by 2° cell; pick covering scene; clip Leaflet tiles
- Retry truncated LLM JSON; ticker falls back to medium/low; 3-min HUD poll
41 lines
1,008 B
Python
41 lines
1,008 B
Python
"""vessels — daily VesselAPI snapshots for DVR as-of
|
|
|
|
Revision ID: 009_vessels
|
|
Revises: 008_summary_kind
|
|
Create Date: 2026-08-29
|
|
"""
|
|
|
|
from alembic import op
|
|
|
|
revision = "009_vessels"
|
|
down_revision = "008_summary_kind"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.execute(
|
|
"""
|
|
CREATE TABLE IF NOT EXISTS vessels (
|
|
mmsi TEXT NOT NULL,
|
|
poll_at TIMESTAMPTZ NOT NULL,
|
|
lat DOUBLE PRECISION NOT NULL,
|
|
lon DOUBLE PRECISION NOT NULL,
|
|
heading DOUBLE PRECISION,
|
|
speed DOUBLE PRECISION,
|
|
label TEXT,
|
|
extra JSONB,
|
|
PRIMARY KEY (mmsi, poll_at)
|
|
)
|
|
"""
|
|
)
|
|
op.execute(
|
|
"CREATE INDEX IF NOT EXISTS ix_vessels_poll_at ON vessels (poll_at DESC)"
|
|
)
|
|
op.execute(
|
|
"CREATE INDEX IF NOT EXISTS ix_vessels_bbox ON vessels (lon, lat)"
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.execute("DROP TABLE IF EXISTS vessels")
|