Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions admin/views/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ class DeploymentAdmin(OcotilloModelView):
"recording_interval",
"release_status",
"created_at",
"nma_WI_Duration",
"nma_WI_EndFrequency",
"nma_WI_Magnitude",
"nma_WI_MicGain",
"nma_WI_MinSoundDepth",
"nma_WI_StartFrequency",
]

fields_default_sort = [
Expand All @@ -65,6 +71,12 @@ class DeploymentAdmin(OcotilloModelView):
"recording_interval_units",
"release_status",
"created_at",
"nma_WI_Duration",
"nma_WI_EndFrequency",
"nma_WI_Magnitude",
"nma_WI_MicGain",
"nma_WI_MinSoundDepth",
"nma_WI_StartFrequency",
]

page_size = 50
Expand All @@ -85,6 +97,12 @@ class DeploymentAdmin(OcotilloModelView):
"hanging_point_height",
"hanging_point_description",
"notes",
"nma_WI_Duration",
"nma_WI_EndFrequency",
"nma_WI_Magnitude",
"nma_WI_MicGain",
"nma_WI_MinSoundDepth",
"nma_WI_StartFrequency",
# Release Status
"release_status",
# Audit Fields
Expand Down
46 changes: 46 additions & 0 deletions alembic/versions/263109252fb1_add_legacy_equipment_fields.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""add legacy equipment fields

Revision ID: 263109252fb1
Revises: c1d2e3f4a5b6
Create Date: 2026-01-28 10:05:10.122531

"""

from typing import Sequence, Union

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "263109252fb1"
down_revision: Union[str, Sequence[str], None] = "3a9c1f5b7d2e"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
FIELDS = (
"WI_Duration",
"WI_EndFrequency",
"WI_Magnitude",
"WI_MicGain",
"WI_MinSoundDepth",
"WI_StartFrequency",
)


def upgrade() -> None:
"""Upgrade schema."""

for field in FIELDS:
op.add_column(
"deployment",
sa.Column(
f"nma_{field}",
sa.Integer(),
nullable=True,
),
)


def downgrade() -> None:
"""Downgrade schema."""
for field in FIELDS:
op.drop_column("deployment", f"nma_{field}")
7 changes: 7 additions & 0 deletions db/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ class Deployment(Base, AutoBaseMixin, ReleaseMixin):
hanging_point_description: Mapped[str] = mapped_column(Text, nullable=True)
notes: Mapped[str] = mapped_column(Text, nullable=True)

nma_WI_Duration: Mapped[int] = mapped_column(Integer, nullable=True)
nma_WI_EndFrequency: Mapped[int] = mapped_column(Integer, nullable=True)
nma_WI_Magnitude: Mapped[int] = mapped_column(Integer, nullable=True)
nma_WI_MicGain: Mapped[int] = mapped_column(Integer, nullable=True)
nma_WI_MinSoundDepth: Mapped[int] = mapped_column(Integer, nullable=True)
nma_WI_StartFrequency: Mapped[int] = mapped_column(Integer, nullable=True)

# --- Relationships ---
# Many-To-One: A Deployment is for one Thing.
thing: Mapped["Thing"] = relationship("Thing", back_populates="deployments")
Expand Down
6 changes: 6 additions & 0 deletions transfers/sensor_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ def _group_step(self, session: Session, row: pd.Series, db_item: Base):
hanging_cable_length=row.HangingCableLength,
hanging_point_height=row.HangingPointHgt,
hanging_point_description=row.HangingPointDescription,
nma_WI_Duration=row.WI_Duration,
nma_WI_EndFrequency=row.WI_EndFrequency,
nma_WI_Magnitude=row.WI_Magnitude,
nma_WI_MicGain=row.WI_MicGain,
nma_WI_MinSoundDepth=row.WI_MinSoundDepth,
nma_WI_StartFrequency=row.WI_StartFrequency,
)
session.add(deployment)
logger.info(
Expand Down
Loading