feat(ogc): publish a well water-column layer - #885
Merged
jirhiker merged 1 commit intoAug 24, 2026
Merged
Conversation
A well's construction record says how deep the hole goes and its water-level record says how far down the water sits, but nothing in the catalogue published the difference -- the standing column of water in the well, which is the number that says whether a well still holds usable water. ogc_well_water_column (and its unfiltered ogc_internal_ twin) carries one row per water well with the same well and location fields the water_wells layer publishes, plus four derived depths in feet: the well depth less the latest depth to water, less the mean depth to water, less the shallowest reading on record, and less the deepest. Shallowest water leaves the most in the well and deepest the least, hence maximum/minimum naming the column rather than the reading. Readings are manual groundwater-level observations taken below ground surface as value minus measuring-point height, the same convention water_well_summary and latest_depth_to_water_wells already use, so the three layers cannot disagree about what a depth to water is. Continuous transducer readings are not counted. Negative results are clamped to zero: a reading deeper than the recorded well depth is a contradiction between two records rather than a well holding negative water. The contradiction itself stays visible in water_well_summary, which publishes the raw shallowest and deepest readings beside the well depth. Wells with no recorded depth, or no usable reading, are left out -- all four columns would be NULL and the row would say nothing. Materialized, because every column but the latest aggregates a well's whole reading history. The nightly pg_cron job refreshes every matview in the public schema by name, so the two are picked up with no change to the schedule, and both carry a unique index on id so a manual refresh can run CONCURRENTLY. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
likithabommasani21
force-pushed
the
feat/ogc-well-water-column-layer
branch
from
August 24, 2026 19:38
f321d7e to
8a0c3ce
Compare
Contributor
Coverage✅ 79.49% total — gate is 75%. No measured coverage for the Python files changed here. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stacked on #884 — base is
feat/BDMS-976-group-a-last-observation-date, and this migration chains after that PR'sb8c9d0e1f2a3. The diff here is the single commit on top; #884 (and the chain under it) merges first.What
A well's construction record says how deep the hole goes and its water-level record says how far down the water sits, but nothing in the catalogue published the difference — the standing column of water in the well, which is the number that says whether a well still holds usable water.
ogc_well_water_columnand its unfilteredogc_internal_twin carry one row per water well: the same well and location fields thewater_wellslayer publishes, plus four derived depths in feet.water_column_latestwater_column_averagewater_column_maximumwater_column_minimumMax/min name the column, not the reading: the shallowest water level leaves the most water in the well.
Decisions
value - measuring_point_heightwith a missing height treated as ground level — the same conventionwater_well_summaryandlatest_depth_to_water_wellsalready use, so the three layers cannot disagree about what a depth to water is. Continuous transducer readings are not counted.water_well_summary, which publishes the raw shallowest and deepest readings beside the well depth.idso a manual refresh can runCONCURRENTLY.Also in the diff
Collection entries in both pygeoapi configs (public and internal) and field descriptions for the four calculated columns, so they are documented on
/schemaand/queryables.Tests
Two new tests in
tests/test_ogc.py: the arithmetic including the clamp (a 10 ft well with readings at 5, 2 and 14 ft below ground surface), and public-vs-internal release filtering (a well whose only reading is private drops out of the public layer and reports on the internal one). The collection is added to the catalogue and items-endpoint assertions.Local runs:
pytest --ignore=tests/transfers→ 1151 passed, 84 skipped, 6 xpassed.behave --tags="@backend and @production and not @skip"→ 88 scenarios passed.Deploy note
Schema migration only — no data migration pending. The new matviews are empty until first refreshed; the nightly job covers that, or run
oco refresh-matview --concurrentlyto populate them at deploy time.🤖 Generated with Claude Code