Skip to content

test(waterdata): assert documented columns match the collection schema - #424

Merged
thodson-usgs merged 1 commit into
DOI-USGS:mainfrom
thodson-usgs:test/documented-properties-monitor
Oct 2, 2026
Merged

thodson-usgs merged 1 commit into
DOI-USGS:mainfrom
thodson-usgs:test/documented-properties-monitor

Conversation

@thodson-usgs

@thodson-usgs thodson-usgs commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: Adds a live test that compares the columns five Water Data getters list in their properties docstring with each collection's /schema, because two of these hand-written lists went out of date without a test failing. The maintainer should confirm the four choices below.

Stacked on #422 and #423; merge order is in #426. Review only tests/waterdata_properties_test.py and its line in tests/contracts/README.md.

Changes

  • New live test, parametrized over daily, continuous, latest-continuous, latest-daily and time-series-metadata. It compares the getter's "Available options are:" list with the collection's /schema, and the failure message names the docstring to edit.

For the maintainer

  • The lists are checked, not generated: generating them would make the docs build depend on the live service and would not update help() or IDE tooltips.
  • id is excluded on both sides: some schemas list it and some do not.
  • get_latest_continuous and get_latest_daily are included although their lists were correct, which adds two requests to the nightly run.
  • get_channel and get_monitoring_locations are left out because their lists do not match v1 /schema. feat(waterdata): name every column the OGC collections return #425 corrects both and adds get_monitoring_locations (6 live cases); get_channel stays out because its list names channel_measurements_id where the schema has id.

Verification

  • Offline: 1193 passed, 22 deselected; branch coverage 98.95%. ruff, mypy, lint-imports, xenon and complexipy pass.
  • Live: 5 passed against v1 on 2026-09-28.
  • Against the docstrings on main (75e56ab6), the test fails on continuous (no method_category) and time-series-metadata (no data_gap_interval) and passes on the other three.

🤖 Generated with Claude Code

@thodson-usgs
thodson-usgs force-pushed the test/documented-properties-monitor branch from d72f7f4 to 55e13d4 Compare September 23, 2026 02:32
thodson-usgs added a commit to thodson-usgs/dataretrieval-python that referenced this pull request Sep 23, 2026
Comparing each collection's /schema with its getter's signature found 20
returned columns that were reachable only through **queryables, so the
getter documented neither the column nor the filter:

- get_field_measurements: control_condition, day,
  field_measurements_series_id, measurement_rated, month, reading_type,
  time_of_day, year
- get_peaks: qualifier, time_of_day, value
- get_monitoring_locations: revision_created, revision_modified,
  revision_note
- get_combined_metadata: data_gap_interval, reading_type
- get_time_series_metadata: data_gap_interval, parameter_description
- get_field_measurements_metadata: reading_type
- get_channel: channel_location_direction

Each is now a named parameter, described in the service's own words. day,
month and year take the integer annotation get_peaks already uses. The
monitoring-location attributes every collection accepts as filters but
does not return stay in **queryables. Existing calls send the same
request as before.

Stacked: this commit also carries DOI-USGS#422 (Water Data API v1), DOI-USGS#423
(continuous method_category and the API-version monitor) and DOI-USGS#424 (the
documented-columns monitor), which merge first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@thodson-usgs
thodson-usgs force-pushed the test/documented-properties-monitor branch from 55e13d4 to 4f81930 Compare September 23, 2026 02:36
thodson-usgs added a commit to thodson-usgs/dataretrieval-python that referenced this pull request Sep 24, 2026
Comparing each collection's /schema with its getter's signature found 20
returned columns that could be passed only through **queryables, so the
getter documented neither the column nor the filter:

- get_field_measurements: control_condition, day,
  field_measurements_series_id, measurement_rated, month, reading_type,
  time_of_day, year
- get_peaks: qualifier, time_of_day, value
- get_monitoring_locations: revision_created, revision_modified,
  revision_note
- get_combined_metadata: data_gap_interval, reading_type
- get_time_series_metadata: data_gap_interval, parameter_description
- get_field_measurements_metadata: reading_type
- get_channel: channel_location_direction

Each is now a named parameter, described in the service's own words. day,
month and year are typed as integers, as get_peaks already types them.
The monitoring-location attributes that every collection accepts as
filters but does not return stay in **queryables. Existing calls send
the same request as before.

Stacked on DOI-USGS#422, DOI-USGS#423 and DOI-USGS#424, which merge first; review this commit
alone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@thodson-usgs
thodson-usgs force-pushed the test/documented-properties-monitor branch from 4f81930 to 016025a Compare September 24, 2026 14:29
@thodson-usgs
thodson-usgs force-pushed the test/documented-properties-monitor branch from 016025a to e181c46 Compare September 29, 2026 13:01
@thodson-usgs
thodson-usgs force-pushed the test/documented-properties-monitor branch from e181c46 to 73451c4 Compare September 29, 2026 15:06
@thodson-usgs
thodson-usgs marked this pull request as ready for review September 29, 2026 15:12
@thodson-usgs
thodson-usgs force-pushed the test/documented-properties-monitor branch from 73451c4 to 0de0e92 Compare October 2, 2026 17:00
Seven getters list their returned columns in the properties docstring.
The lists are written by hand, and two went out of date without a test
failing: continuous lacked method_category (DOI-USGS#423) and
time-series-metadata lacked data_gap_interval (DOI-USGS#422).

Add a live test that compares the lists of get_daily, get_continuous,
get_latest_continuous, get_latest_daily and get_time_series_metadata
with each collection's /schema; its failure message names the docstring
to edit. id is excluded on both sides, because some schemas list it and
some do not. get_channel and get_monitoring_locations are left out
because their lists do not match /schema.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@thodson-usgs
thodson-usgs force-pushed the test/documented-properties-monitor branch from 0de0e92 to e370eb0 Compare October 2, 2026 18:33
@thodson-usgs
thodson-usgs merged commit 03ca87d into DOI-USGS:main Oct 2, 2026
11 checks passed
@thodson-usgs
thodson-usgs deleted the test/documented-properties-monitor branch October 2, 2026 18:51
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