You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
add an actively_monitored_wells OGC collection backed by ogc_actively_monitored_wells
define the collection as a plain view over ogc_water_well_summary filtered to the Water Level Network group
remove deprecated well-type collections from the runtime pygeoapi config and add a forward Alembic migration that drops the corresponding ogc_* views in upgraded databases
Details
r2s3t4u5v6w7 creates ogc_actively_monitored_wells as a normal view, validates that the required group tables exist, and requires ogc_water_well_summary to be present
s4t5u6v7w8x9 drops the obsolete well-type OGC views on upgrade and recreates them on downgrade
the pygeoapi runtime config now mounts actively_monitored_wells and no longer mounts the removed well-type collections
the OGC tests were updated to build the app client explicitly and verify that wells in the Water Level Network group appear in the new collection
Validation
black alembic/versions/d5e6f7a8b9c0_create_pygeoapi_supporting_views.py alembic/versions/s4t5u6v7w8x9_drop_unused_well_type_ogc_views.py
JOIN group_thing_association AS gta ON gta.group_id = g.id
JOIN ogc_water_well_summary AS wws ON wws.id = gta.thing_id
WHERE lower(trim(g.name)) = 'water level network'
Filter the active-wells view by current monitoring status
When a project group contains wells whose latest Monitoring Status is Not currently monitored, this view still publishes them because it only filters on g.name. ProjectGroupTransferer._step() adds every prefixed well to the Water Level Network group and only uses monitoring status to set the group's type (transfers/group_transfer.py:57-83), so /ogcapi/collections/actively_monitored_wells will over-report inactive wells in normal production data.
JOIN ogc_water_well_summary AS wws ON wws.id = gta.thing_id
Stop excluding active wells that have no observations yet
This inner join makes the collection depend on ogc_water_well_summary, and that materialized view keeps only wells with at least one groundwater-level observation (l5e6f7a8b9c0_add_water_well_summary_materialized_view.py:98-115). A well can already be Currently monitored before its first reading is loaded (transfers/well_transfer.py:777-791), so newly onboarded active wells disappear from this OGC collection until after the first observation arrives.
De-duplicate group memberships during project transfer
On any rerun of ProjectGroupTransferer, these statements create a fresh GroupThingAssociation for every matching thing without checking whether the link already exists. group_thing_association has no uniqueness constraint (db/group.py:63-76), so repeated transfers duplicate memberships and any group-based consumer—including ogc_actively_monitored_wells—can emit the same well multiple times.
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
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.
Summary
actively_monitored_wellsOGC collection backed byogc_actively_monitored_wellsogc_water_well_summaryfiltered to theWater Level Networkgroupogc_*views in upgraded databasesDetails
r2s3t4u5v6w7createsogc_actively_monitored_wellsas a normal view, validates that the required group tables exist, and requiresogc_water_well_summaryto be presents4t5u6v7w8x9drops the obsolete well-type OGC views on upgrade and recreates them on downgradeactively_monitored_wellsand no longer mounts the removed well-type collectionsWater Level Networkgroup appear in the new collectionValidation
black alembic/versions/d5e6f7a8b9c0_create_pygeoapi_supporting_views.py alembic/versions/s4t5u6v7w8x9_drop_unused_well_type_ogc_views.pyflake8 alembic/versions/d5e6f7a8b9c0_create_pygeoapi_supporting_views.py alembic/versions/s4t5u6v7w8x9_drop_unused_well_type_ogc_views.pypytest tests/integration/test_alembic_migrations.py -k "multiple_heads or current_revision_matches_head" -qpytest tests/test_ogc.py -q