-
Notifications
You must be signed in to change notification settings - Fork 4
fix: improve data handling in initializers and transferer, streamline constructor in radionuclides #480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
fix: improve data handling in initializers and transferer, streamline constructor in radionuclides #480
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
bab253f
fix: improve data handling in initializers and transferer, streamline…
jirhiker e75b396
fix: remove legacy SamplePtID references and update schema to use Sam…
jirhiker 27bb085
fix: add nma_sample_point_id to NMA_MinorTraceChemistry instances in …
jirhiker addee9d
fix: remove limit handling from data transfer methods in field_parame…
jirhiker 6890e45
Update alembic/versions/e71807682f57_add_sample_point_fields_to_minor…
jirhiker 3aa742d
Formatting changes
jirhiker 0eb415d
Update db/nma_legacy.py
jirhiker 732c79a
Update transfers/minor_trace_chemistry_transfer.py
jirhiker 99124f5
Update transfers/minor_trace_chemistry_transfer.py
jirhiker 9ebf6bd
Update alembic/versions/e71807682f57_add_sample_point_fields_to_minor…
jirhiker b0e1c06
```text fix: update error handling for missing SamplePointID in Minor…
jirhiker a5827ab
```text fix: update test to use nma_sample_point_id instead of nma_Sa…
jirhiker File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
alembic/versions/e71807682f57_add_sample_point_fields_to_minor_trace.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| """add sample point fields to minor trace | ||
|
|
||
| Revision ID: e71807682f57 | ||
| Revises: h1b2c3d4e5f6 | ||
| Create Date: 2026-02-10 20:07:25.586385 | ||
|
|
||
| """ | ||
|
|
||
| from typing import Sequence, Union | ||
|
|
||
| import sqlalchemy as sa | ||
| from alembic import op | ||
|
|
||
| # revision identifiers, used by Alembic. | ||
| revision: str = "e71807682f57" | ||
| down_revision: Union[str, Sequence[str], None] = "h1b2c3d4e5f6" | ||
| branch_labels: Union[str, Sequence[str], None] = None | ||
| depends_on: Union[str, Sequence[str], None] = None | ||
|
|
||
|
|
||
| def upgrade() -> None: | ||
| """Upgrade schema.""" | ||
| # Step 1: add the column as nullable with a temporary default so existing rows get a value. | ||
| op.add_column( | ||
| "NMA_MinorTraceChemistry", | ||
| sa.Column( | ||
| "nma_SamplePointID", | ||
| sa.String(length=10), | ||
| nullable=True, | ||
| server_default=sa.text("''"), | ||
| ), | ||
| ) | ||
|
|
||
| # Step 2: enforce NOT NULL now that all existing rows have a non-NULL value. | ||
| op.alter_column( | ||
| "NMA_MinorTraceChemistry", | ||
| "nma_SamplePointID", | ||
| existing_type=sa.String(length=10), | ||
| nullable=False, | ||
| ) | ||
|
|
||
| # Step 3: drop the temporary default so future inserts must supply a value explicitly. | ||
| op.alter_column( | ||
| "NMA_MinorTraceChemistry", | ||
| "nma_SamplePointID", | ||
| existing_type=sa.String(length=10), | ||
| server_default=None, | ||
| ) | ||
|
|
||
|
|
||
jirhiker marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| def downgrade() -> None: | ||
| """Downgrade schema.""" | ||
| op.drop_column("NMA_MinorTraceChemistry", "nma_SamplePointID") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.