Skip to content

Jir feature collections#580

Merged
jirhiker merged 9 commits intostagingfrom
jir-feature-collections
Mar 3, 2026
Merged

Jir feature collections#580
jirhiker merged 9 commits intostagingfrom
jir-feature-collections

Conversation

@jirhiker
Copy link
Member

@jirhiker jirhiker commented Mar 3, 2026

Summary

Adds new OGC/pygeoapi well analytics views and updates existing OGC support views/config, including:

  • Latest TDS and Average TDS well outputs (with date-based fields/fallback behavior)
  • Depth-to-water trend classification view
  • Water well summary view
  • OGC view schema cleanup and metadata alignment
  • pygeoapi OpenAPI generation fixes and refresh CLI updates

What Changed

1. New/updated Alembic OGC views

2. pygeoapi config updates

  • core/pygeoapi-config.yml
    • Added/updated collections:
      • latest_tds_wells
      • depth_to_water_trend_wells
      • water_well_summary
    • Renamed title:
      • Latest Depth to Water (Wells) -> Latest Depth to Water (Water Wells)

3. pygeoapi runtime OpenAPI generation fix

  • core/pygeoapi.py
    • Switched from placeholder OpenAPI content to pygeoapi-generated OpenAPI
    • Added safer generation behavior for invalid collections during startup
    • Improved DB env fallback (PYGEOAPI_POSTGRES_* -> POSTGRES_*)

4. CLI refresh defaults and tests

  • cli/cli.py

    • refresh-pygeoapi-materialized-views default set now includes:
      • ogc_latest_depth_to_water_wells
      • ogc_avg_tds_wells
      • ogc_depth_to_water_trend_wells
      • ogc_water_well_summary
    • ogc_latest_tds_wells removed from refresh defaults (it is a regular view)
  • Tests updated:

Notes / Compatibility

  • ogc_latest_tds_wells is intentionally a non-materialized view.
  • TDS observation field naming moved to _date (not _datetime) for TDS date outputs.
  • Consumers should update any references to old TDS datetime column names.

Verification

  • Python compile checks passed for changed migration/CLI/test files.
  • Alembic head at: l5e6f7a8b9c0.

Copilot AI review requested due to automatic review settings March 3, 2026 04:53
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 expands the OGC/pygeoapi feature collections for well analytics by adding new SQL views/materialized views, wiring them into the pygeoapi config, and improving runtime OpenAPI generation and CLI refresh behavior.

Changes:

  • Add new OGC views/materialized views for latest/avg TDS, depth-to-water trend classification, and water well summary metrics.
  • Update pygeoapi runtime/config to expose the new collections and generate OpenAPI via pygeoapi at startup.
  • Update CLI refresh defaults and add/adjust tests for OpenAPI and TDS date fallback logic.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
alembic/versions/d5e6f7a8b9c0_create_pygeoapi_supporting_views.py Updates existing pygeoapi supporting views (schema cleanup + avg TDS date fields).
alembic/versions/i2b3c4d5e6f7_add_latest_tds_pygeoapi_materialized_view.py Adds ogc_latest_tds_wells (view) and redefines ogc_avg_tds_wells (matview).
alembic/versions/k4d5e6f7a8b9_add_depth_to_water_trend_materialized_view.py Adds depth-to-water trend classification materialized view.
alembic/versions/l5e6f7a8b9c0_add_water_well_summary_materialized_view.py Adds water well summary materialized view.
core/pygeoapi-config.yml Registers new OGC collections/providers in pygeoapi config.
core/pygeoapi.py Uses pygeoapi to generate OpenAPI and improves DB env var fallback.
cli/cli.py Expands default list of materialized views to refresh.
tests/test_cli_commands.py Updates CLI refresh default expectations/count.
tests/test_ogc.py Adds OpenAPI presence test + TDS observation date fallback integration test.
Comments suppressed due to low confidence (1)

alembic/versions/i2b3c4d5e6f7_add_latest_tds_pygeoapi_materialized_view.py:6

  • The migration module docstring and filename say “materialized view”, but upgrade() creates ogc_latest_tds_wells as a regular CREATE VIEW (and explicitly drops any prior materialized view). This is misleading for future maintainers/operators who may expect it to be refreshable/handled like a matview. Update the docstring (and ideally the migration filename if feasible) to reflect that ogc_latest_tds_wells is intentionally a non-materialized view.
"""add latest tds pygeoapi materialized view

Revision ID: i2b3c4d5e6f7
Revises: d5e6f7a8b9c0
Create Date: 2026-03-02 11:00:00.000000
"""

Copy link

@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: b33700dd3d

ℹ️ 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".

Copilot AI review requested due to automatic review settings March 3, 2026 05:10
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

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

Comments suppressed due to low confidence (1)

alembic/versions/i2b3c4d5e6f7_add_latest_tds_pygeoapi_materialized_view.py:5

  • The migration docstring/file name says "materialized view", but this migration creates ogc_latest_tds_wells as a regular VIEW (only ogc_avg_tds_wells is materialized). Please rename/update the docstring (and ideally the filename) to match what’s actually created so future operators don’t refresh/maintain the wrong object type.
"""add latest tds pygeoapi materialized view

Revision ID: i2b3c4d5e6f7
Revises: d5e6f7a8b9c0
Create Date: 2026-03-02 11:00:00.000000

jirhiker and others added 2 commits March 2, 2026 22:18
Copilot AI review requested due to automatic review settings March 3, 2026 05:21
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

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

Comments suppressed due to low confidence (1)

core/pygeoapi.py:296

  • The PR description mentions a PYGEOAPI_POSTGRES_*POSTGRES_* fallback for DB env vars, but _pygeoapi_db_settings() still requires PYGEOAPI_POSTGRES_PASSWORD specifically and does not fall back to POSTGRES_PASSWORD. If a deployment only sets POSTGRES_PASSWORD, pygeoapi config generation will still fail.

Consider either (a) adding a password fallback to POSTGRES_PASSWORD and choosing the corresponding placeholder (${POSTGRES_PASSWORD} vs ${PYGEOAPI_POSTGRES_PASSWORD}), or (b) updating the PR description/docs to clarify that only host/port/db/user fall back.

    if os.environ.get("PYGEOAPI_POSTGRES_PASSWORD") is None:
        raise RuntimeError(
            "PYGEOAPI_POSTGRES_PASSWORD must be set to "
            "generate the pygeoapi configuration."
        )
    return host, port, dbname, user, "${PYGEOAPI_POSTGRES_PASSWORD}"

@jirhiker jirhiker merged commit 0d51464 into staging Mar 3, 2026
8 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