Skip to content

water-elevation-layer#591

Merged
jirhiker merged 1 commit intostagingfrom
water-elevation-layer
Mar 10, 2026
Merged

water-elevation-layer#591
jirhiker merged 1 commit intostagingfrom
water-elevation-layer

Conversation

@jirhiker
Copy link
Copy Markdown
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 March 10, 2026 06:14
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 75f727d5b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +61 to +69
AND lower(trim(o.unit)) IN (
'm',
'meter',
'meters',
'metre',
'metres',
'ft',
'foot',
'feet'
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include ftbgs units when selecting groundwater observations

The new unit whitelist in _create_water_elevation_view() excludes observations whose unit is ftbgs, even though ftbgs is a valid lexicon unit (core/lexicon.json, around line 843). For wells whose latest (or only) groundwater-level observation uses ftbgs, this CTE now drops the record entirely, so ogc_water_elevation_wells can lose rows after this migration. Please add handling for ftbgs (and its depth semantics) instead of filtering it out.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
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 updates the ogc_water_elevation_wells materialized view to make units explicit and ensure groundwater level observations recorded in meters are normalized to feet for the derived OGC “water elevation” layer.

Changes:

  • Update the ogc_water_elevation_wells materialized view to compute depth-to-water in feet (handling both m and ft units) and rename output columns with explicit unit suffixes.
  • Update existing OGC tests to use the renamed unit-explicit columns.
  • Add a new test covering normalization of meter-based groundwater level observations to feet.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/test_ogc.py Updates assertions for renamed unit-explicit columns and adds a test for meter→feet normalization behavior.
alembic/versions/n7a8b9c0d1e2_fix_water_elevation_units_to_feet.py Alters the view definition to normalize depth-to-water units to feet and renames view columns to include unit suffixes; includes downgrade restoration.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +355 to +357
meter_observation = groundwater_level_observation.__class__(
observation_datetime=datetime(2025, 1, 2, 0, 4, 0),
sample_id=groundwater_level_observation.sample_id,
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

observation_datetime is passed a naive datetime(...) while other observation fixtures use UTC timestamps (e.g., ISO strings with Z). For a timestamp with time zone column, naive datetimes are interpreted in the DB/session timezone, which can make the “latest” observation selection in the view depend on environment settings. Use a timezone-aware UTC datetime (e.g., datetime(..., tzinfo=timezone.utc)) or an explicit ...Z timestamp string for consistency.

Copilot uses AI. Check for mistakes.
@jirhiker jirhiker merged commit 60b1c01 into staging Mar 10, 2026
12 checks passed
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.

2 participants