Skip to content

BDMS-520-1-1-Cleanup-2.0#456

Merged
jirhiker merged 1 commit intostagingfrom
BDMS-520-1-1-Cleanup-2.0
Jan 31, 2026
Merged

BDMS-520-1-1-Cleanup-2.0#456
jirhiker merged 1 commit intostagingfrom
BDMS-520-1-1-Cleanup-2.0

Conversation

@jirhiker
Copy link
Member

Why

This PR addresses the following problem / context:

  • Use bullet points here

How

Implementation summary - the following was changed / added / removed:

  • Use bullet points here

Notes

Any special considerations, workarounds, or follow-up work to note?

  • Use bullet points here

Copilot AI review requested due to automatic review settings January 31, 2026 13:35
@jirhiker jirhiker merged commit 1f00d38 into staging Jan 31, 2026
5 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR reorganizes the cleanup locations process to run earlier in the transfer pipeline and adds robust timestamp handling for deployment sorting.

Changes:

  • Moved cleanup locations logic from the main() function into Phase 5 of _transfer_parallel() to execute earlier in the pipeline
  • Added a helper function _install_ts() to safely convert various date formats to pandas Timestamps when sorting deployments by installation date

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
transfers/waterlevels_transducer_transfer.py Adds timestamp conversion helper to handle different date formats when sorting deployments
transfers/transfer.py Moves cleanup locations from end of main() to Phase 5 in _transfer_parallel() for earlier execution

return value
if hasattr(value, "date"):
return Timestamp(value)
return Timestamp(pd.to_datetime(value, errors="coerce"))
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When pd.to_datetime(value, errors='coerce') returns NaT (Not a Time), converting it to Timestamp could cause sorting issues. Consider adding error handling or validation to ensure valid timestamps are returned, or document that NaT values are acceptable for sorting.

Suggested change
return Timestamp(pd.to_datetime(value, errors="coerce"))
dt = pd.to_datetime(value, errors="coerce")
if pd.isna(dt):
# Use a maximal timestamp so invalid/missing dates sort last
return Timestamp.max
return Timestamp(dt)

Copilot uses AI. Check for mistakes.
logger.info(f"no {release_status} records for pointid {pointid}")
continue

def _install_ts(value):
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function name _install_ts is ambiguous. Consider renaming to _convert_to_timestamp or _normalize_installation_timestamp to better convey its purpose of converting various date formats to Timestamp objects.

Copilot uses AI. Check for mistakes.
# very time consuming and we want to run it alone in its own phase.

# =========================================================================
# PHASE 5: Cleanup locations. populate state, county, quadname
Copy link

Copilot AI Jan 31, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment uses lowercase 'populate' which is inconsistent with the capitalization style used in other phase comments. Consider capitalizing to 'Populate' for consistency.

Suggested change
# PHASE 5: Cleanup locations. populate state, county, quadname
# PHASE 5: Cleanup locations. Populate state, county, quadname

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant