Skip to content

Commit e75b396

Browse files
committed
fix: remove legacy SamplePtID references and update schema to use SamplePointID
1 parent bab253f commit e75b396

5 files changed

Lines changed: 0 additions & 17 deletions

File tree

alembic/versions/e71807682f57_add_sample_point_fields_to_minor_trace.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
import sqlalchemy as sa
1212
from alembic import op
13-
from sqlalchemy.dialects import postgresql
1413

1514
# revision identifiers, used by Alembic.
1615
revision: str = "e71807682f57"
@@ -21,10 +20,6 @@
2120

2221
def upgrade() -> None:
2322
"""Upgrade schema."""
24-
op.add_column(
25-
"NMA_MinorTraceChemistry",
26-
sa.Column("nma_SamplePtID", postgresql.UUID(as_uuid=True), nullable=False),
27-
)
2823
op.add_column(
2924
"NMA_MinorTraceChemistry",
3025
sa.Column("nma_SamplePointID", sa.String(length=10), nullable=False),
@@ -34,4 +29,3 @@ def upgrade() -> None:
3429
def downgrade() -> None:
3530
"""Downgrade schema."""
3631
op.drop_column("NMA_MinorTraceChemistry", "nma_SamplePointID")
37-
op.drop_column("NMA_MinorTraceChemistry", "nma_SamplePtID")

db/nma_legacy.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,6 @@ class NMA_MinorTraceChemistry(Base):
774774
- nma_global_id: Original UUID PK, now UNIQUE for audit
775775
- chemistry_sample_info_id: Integer FK to NMA_Chemistry_SampleInfo.id
776776
- nma_chemistry_sample_info_uuid: Legacy UUID FK for audit
777-
- nma_sample_pt_id: Legacy UUID FK (SamplePtID) for audit
778777
- nma_sample_point_id: Legacy SamplePointID string
779778
- nma_wclab_id: Legacy WCLab_ID string (audit)
780779
"""
@@ -809,9 +808,6 @@ class NMA_MinorTraceChemistry(Base):
809808
)
810809

811810
# Additional columns
812-
nma_sample_pt_id: Mapped[Optional[uuid.UUID]] = mapped_column(
813-
"nma_SamplePtID", UUID(as_uuid=True), nullable=False
814-
)
815811
nma_sample_point_id: Mapped[Optional[str]] = mapped_column(
816812
"nma_SamplePointID", String(10), nullable=False
817813
)

tests/test_minor_trace_chemistry_transfer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,4 @@ def test_row_to_dict_includes_wclab_id():
3636

3737
row_dict = transfer._row_to_dict(row)
3838
assert row_dict["nma_WCLab_ID"] == "LAB-123"
39-
assert row_dict["nma_SamplePtID"] == sample_pt_id
4039
assert row_dict["nma_SamplePointID"] == "POINT-1"

tests/test_nma_chemistry_lineage.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ def test_nma_minor_trace_chemistry_columns():
134134
"id", # Integer PK
135135
"nma_global_id", # Legacy UUID
136136
"chemistry_sample_info_id", # Integer FK
137-
"nma_sample_pt_id", # Legacy UUID FK
138137
"nma_sample_point_id", # Legacy sample point id
139138
# from legacy
140139
"analyte",
@@ -175,7 +174,6 @@ def test_nma_minor_trace_chemistry_save_all_columns(shared_thing):
175174
mtc = NMA_MinorTraceChemistry(
176175
nma_global_id=_next_global_id(),
177176
chemistry_sample_info=sample_info,
178-
nma_sample_pt_id=sample_info.nma_sample_pt_id,
179177
nma_sample_point_id=sample_info.nma_sample_point_id,
180178
analyte="As",
181179
sample_value=0.015,
@@ -197,7 +195,6 @@ def test_nma_minor_trace_chemistry_save_all_columns(shared_thing):
197195
assert mtc.id is not None # Integer PK
198196
assert mtc.nma_global_id is not None # Legacy UUID
199197
assert mtc.chemistry_sample_info_id == sample_info.id # Integer FK
200-
assert mtc.nma_sample_pt_id == sample_info.nma_sample_pt_id
201198
assert mtc.nma_sample_point_id == sample_info.nma_sample_point_id
202199
assert mtc.analyte == "As"
203200
assert mtc.sample_value == 0.015

transfers/minor_trace_chemistry_transfer.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
- nma_global_id: Legacy UUID PK (GlobalID), UNIQUE for audit
2626
- chemistry_sample_info_id: Integer FK to NMA_Chemistry_SampleInfo.id
2727
- nma_chemistry_sample_info_uuid: Legacy UUID FK for audit
28-
- nma_sample_pt_id: Legacy UUID FK (SamplePtID) for audit
2928
- nma_sample_point_id: Legacy SamplePointID string
3029
"""
3130

@@ -149,7 +148,6 @@ def _transfer_hook(self, session: Session) -> None:
149148
set_={
150149
"chemistry_sample_info_id": excluded.chemistry_sample_info_id,
151150
"nma_chemistry_sample_info_uuid": excluded.nma_chemistry_sample_info_uuid,
152-
"nma_SamplePtID": excluded.nma_SamplePtID,
153151
"nma_SamplePointID": excluded.nma_SamplePointID,
154152
"sample_value": excluded.sample_value,
155153
"units": excluded.units,
@@ -216,7 +214,6 @@ def _row_to_dict(self, row) -> Optional[dict[str, Any]]:
216214
"chemistry_sample_info_id": chemistry_sample_info_id,
217215
# Legacy UUID FK for audit
218216
"nma_chemistry_sample_info_uuid": legacy_sample_pt_id,
219-
"nma_SamplePtID": legacy_sample_pt_id,
220217
"nma_SamplePointID": sample_point_id,
221218
# Data columns
222219
"analyte": self._safe_str(row, "Analyte"),

0 commit comments

Comments
 (0)