Skip to content

Check Water Data docstrings against the service's queryables (#379) - #453

Open
acalebratliff wants to merge 25 commits into
DOI-USGS:mainfrom
acalebratliff:feat/379-queryable-docstring-check
Open

acalebratliff wants to merge 25 commits into
DOI-USGS:mainfrom
acalebratliff:feat/379-queryable-docstring-check

Conversation

@acalebratliff

Copy link
Copy Markdown

Closes #379.

The committed queryables snapshot now holds each queryable's type, title and description. An offline test checks that every typed argument of every Water Data getter contains the service's description, after both texts are reduced to plain text (Markdown on the service side, RST on ours; a link becomes its text plus URL, once when equal). The snapshot keeps the raw text, so a wording change at the service still shows as drift. python -m tests.waterdata_queryables_test refreshes the snapshot and reports what appeared, disappeared or changed; --check only reports. The weekly advisory workflow compares the snapshot with the live service and writes the result to the run summary.

The docstring edits are in their own commits, one per module, after the check. 168 descriptions across 12 getters now carry the service's words; hand-written notes stay as their own paragraph.

Two things to look at:

  • get_combined_metadata documented a few location arguments and pointed to get_monitoring_locations. The check needs every typed argument, so it now lists all of them. If you would rather keep the cross-reference, that getter can be exempted; say the word.
  • The service's descriptions carry some flaws, copied as they are because the check requires it: "that intersects the value of datetime are selected" names a datetime argument these getters do not have (23 queryables: time, last_modified, begin, end); "a end"; "In some case," (district_code); "or traps the water" (contributing_drainage_area); "does not necessarily indicate anything about the measurement has changed" (last_modified); "meaining" (approval_status); a stray "[" in county_name; "A list of codes is available at" repeated from the code fields in vertical_datum_name, horizontal_positional_accuracy, horizontal_position_method_name, original_horizontal_datum_name and site_type; and begin/end on combined-metadata and field-measurements-metadata refer to begin_utc/end_utc, which those collections do not have. They could be reported to the service team.

Gates: ruff, mypy, pytest (coverage 99.08 %), xenon, complexipy, lint-imports; a Sphinx build of the reference page shows no new warnings.

Written with AI tools, reviewed and tested by me.

…text, without Markdown or RST markup

The service writes its descriptions in Markdown and the docstrings are reStructuredText. One normalizer now reduces both to plain text before the containment check: literals, emphasis and roles keep their contents, a link becomes its text and its URL (the URL once when they are the same), and bullets become plain lines. The snapshot keeps the service's raw text, so a markup change still shows as drift.
…ervice's words

Each queryable argument of get_daily, get_continuous, get_latest_daily and get_latest_continuous now carries the service's description, written in reStructuredText. Package notes that the service text lacks (the two-value date list, exact qualifier matching, statistic 00011 for continuous data, the method category codes) follow it.
…ervice's words

get_channel, get_field_measurements and get_peaks now carry the service's description for each queryable argument. get_peaks' shared water_year, year, month and day entry becomes one entry each, since the service describes them separately.
…ice's words

get_monitoring_locations, get_time_series_metadata and get_field_measurements_metadata now carry the service's description for each queryable argument. The longer hand-written explanations of hydrologic unit codes and aquifer types stay after it; get_field_measurements_metadata's shared begin, end and last_modified entry becomes one entry each.
… service's words

Each queryable argument now carries the service's description, including the location-catalog arguments the docstring previously left to get_monitoring_locations. With every getter swept, the docstring check passes, so its expected-failure marker is removed and it blocks a merge.
… a role's ~

CONTRIBUTING now states the rule in two sentences and leaves the list
of markup rules to the test module. The normalizer drops the leading ~
of a role such as :mod:`~a.b`, and the test module uses American
spelling (normalize, emphasized, color) like the rest of the codebase.
…wording

get_monitoring_locations' aquifer_type_code note now keeps only what
the service text lacks: the artesian name, the well-level fact and the
link. get_combined_metadata's intro no longer points to
get_monitoring_locations, since every argument is described below.
get_channel's channel_flow keeps its "flow in the channel" wording.

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.

Check getter parameter docs against the service's queryables

1 participant