Skip to content

fix(waterdata): accept the continuous method_category queryable - #423

Draft
thodson-usgs wants to merge 1 commit into
DOI-USGS:mainfrom
thodson-usgs:fix/continuous-method-category
Draft

thodson-usgs wants to merge 1 commit into
DOI-USGS:mainfrom
thodson-usgs:fix/continuous-method-category

Conversation

@thodson-usgs

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

Copy link
Copy Markdown
Collaborator

Fixes the failing nightly Live API Tests run (35698389879):

continuous queryables changed upstream: added=['method_category'], removed=[].

What changed upstream

USGS added method_category to the continuous collection: the RLMS method category code for the method in effect over an observation's interval. From the live service:

  • continuous only (not latest-continuous), in both v0 and v1.
  • Returned on every record; UNKWN on some time series, null on others.
  • Filterable. The vocabulary is four codes, from the method-categories collection: STNRD, LMTUS, EXPER, UNKWN.

Nothing was removed or renamed.

Changes

  • Regenerate waterdata_queryables.json (one line) and the continuous fixture, which now carries the field.
  • Add method_category to get_continuous's signature, docstring and documented returned columns. It already worked through **queryables.
  • Tests: the column is parsed as a string, and the named parameter reaches the request.
  • New live monitor (tests/waterdata_endpoints_test.py) for the API version each Water Data family serves. endpoints.py pins versions, and nothing else notices when USGS publishes a new one because the old version keeps answering. Two tests:
    • The default changed: reads the version from the OGC and STAC roots' self link. Probing can't be used for OGC, because it answers 200 with an empty body for any version segment, including ones that don't exist. Statistics has no root document, so it is probed; a missing statistics version returns 404.
    • The pinned version stopped working: the version the package requests still returns data.

_DEFAULT_VERSIONS records ogcapi: v1 while main requests v0. That is intentional: it records what the service serves, and #422 does the migration.

Not in scope

get_reference_table("method-categories") is refused because that collection isn't in METADATA_COLLECTIONS. Eight live collections are missing from the package's coverage, and this PR doesn't add any of them. The docstring lists the four codes, so the parameter can be used without the reference table.

Verification

  • ruff, mypy --strict, lint-imports, xenon, complexipy pass.
  • Live: the previously failing [continuous] case and the new version checks pass.

🤖 Generated with Claude Code

@thodson-usgs
thodson-usgs force-pushed the fix/continuous-method-category branch from 0620c66 to 42b53d2 Compare September 23, 2026 02:32
@thodson-usgs thodson-usgs changed the title fix(waterdata): accept the new continuous method_category queryable fix(waterdata): accept the continuous method_category queryable Sep 23, 2026
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 added a commit to thodson-usgs/dataretrieval-python that referenced this pull request Sep 23, 2026
get_daily, get_continuous and get_time_series_metadata list their
returned columns in the properties docstring. The list is hand-written
and went stale twice without anything noticing: continuous was missing
method_category (DOI-USGS#423) and time-series-metadata data_gap_interval
(DOI-USGS#422).

Add a live test that compares each list with the collection's /schema
and names the docstring to edit when they differ. id is excluded on both
sides because only time-series-metadata lists it in its schema, though
all three accept it.

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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
USGS added method_category to the continuous collection in September
2026, which failed the nightly queryables snapshot test. It is the RLMS
method category code (STNRD, LMTUS, EXPER, UNKWN). It is returned on
every record and is null for time series that have not been categorized.
latest-continuous does not have it.

- Regenerate waterdata_queryables.json and the continuous fixture.
- Add method_category to get_continuous's signature, its docstring, and
  its list of returned columns.
- Add live tests for the API version each Water Data family serves. The
  OGC and STAC versions are read from the self link in each root
  document, because OGC answers 200 for any version segment. Statistics
  has no root document, so the next version is probed. A second test
  checks that the version the package requests still returns data.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@thodson-usgs
thodson-usgs force-pushed the fix/continuous-method-category branch from 42b53d2 to c3feaca Compare September 24, 2026 14:29
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>

This branch has not been deployed

No deployments
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.

1 participant