Repository navigation
feat(waterdata): name every column the OGC collections return - #425
Conversation
55b19f8 to
9a53c12
Compare
9a53c12 to
2aa8648
Compare
2aa8648 to
908e741
Compare
ehinman
left a comment
There was a problem hiding this comment.
I think putting the new input parameters before properties makes sense. Using positional argument orders to pull data is not very robust on the user's part, so I don't see an issue with changing the positions of the arguments, if only to encourage calling out the inputs specifically.
One question, why are all these PRs merging to main as opposed to the switch to v1? There's a lot of redundancy in these PRs. I'll admit I don't quite understand what's going on with the conflicts and what not. I'll re-read the issue #426.
Yes, these build off each other. Is that what you mean? Simplest to go in order described in issue #426, and work through them one by one. Merging before moving to the next. I'll work through the first couple, then check back in. |
db190a9 to
53a6970
Compare
e6061ff to
002d77d
Compare
Twenty columns that the Water Data OGC collections return could be passed only through **queryables, so their getters documented neither the column nor the filter. Each is now a named parameter of the getter that returns it, documented from the collection's /schema; NEWS.md lists them. day, month and year are typed as integers, as in get_peaks. Monitoring-location attributes that every collection accepts as filters but does not return stay in **queryables. The new parameters are keyword-only, after a bare * at the end of each signature, so every parameter released in v1.4.0 keeps its position and an existing call, positional or keyword, sends the same request. sublocation_identifier (unreleased, DOI-USGS#436) moves after the * too, and so do statistics_begin (DOI-USGS#422) and method_category (DOI-USGS#423). Those two shipped mid-signature in v1.4.0 eleven days ago; moving them shifts the later positional parameters of get_time_series_metadata and get_continuous by one, which NEWS marks as a behavior change. tests/contracts/public_api_test.py now records how many parameters each Water Data getter accepts by position and fails if that changes, and its module docstring no longer calls a reorder harmless. The properties lists of get_monitoring_locations and get_channel now include their missing columns. get_peaks' qualifier and value, and the parameter_description of get_combined_metadata and get_field_measurements_metadata, use the same wording as the other getters and the service's /schema. tests/waterdata_properties_test.py now holds one table of the eleven OGC getters by collection, and checks: - offline, that every named parameter of each getter reaches the OGC engine (derived from the signatures, so a new parameter is covered when it is added); - live, that every column a collection's /schema publishes, other than its id and geometry, is a named parameter of its getter. Run against main, this fails on exactly the 20 columns named here; - live, that the documented column lists match the schema, now for get_monitoring_locations and get_channel too. The schema's id and the name the getter returns it under are left out of both sides, and a list ends at the sentence that follows it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01HBt3Ee7eneKtdKQWq2T3YK
002d77d to
64a5d29
Compare
TL;DR: Adds named, documented parameters for 20 columns that the Water Data OGC collections return and that could previously be passed only through
**queryables; keyword calls send the same request as before. The new parameters are keyword-only, so no existing call changes meaning, including a call that passes arguments by position. The one exception is that two parameters released in 1.4.0 (statistics_beginandmethod_category) also become keyword-only; see below. The PR also adds a live check that would have found these columns, and a contract test that fails if a getter gains a parameter that can be passed by position.One commit on current
main. #422, #423, #424 and #427 have merged; the duplicate of #424's commit was dropped on rebase.Changes
get_field_measurementscontrol_condition,day,field_measurements_series_id,measurement_rated,month,reading_type,time_of_day,yearget_peaksqualifier,time_of_day,valueget_monitoring_locationsrevision_created,revision_modified,revision_noteget_combined_metadatadata_gap_interval,reading_typeget_time_series_metadatadata_gap_interval,parameter_descriptionget_field_measurements_metadatareading_typeget_channelchannel_location_direction/schema.day,monthandyearare typedint | list[int], as inget_peaks.propertieslists ofget_monitoring_locationsandget_channeladd their missing columns.get_peaks'qualifierandvaluedocstrings, andparameter_descriptioninget_combined_metadataandget_field_measurements_metadata, use the same wording as the other getters and the service's/schema. Thequalifiertext now includes the exact, in-order matching rule, which applies to peaks too.Tests (
tests/waterdata_properties_test.py)One table maps each of the eleven OGC collections to its getter. Three checks use it:
_NEWLY_NAMEDlist.qualifier's JSON encoding stays covered bytest_qualifier_is_sent_as_a_json_array, whosepeakscase is renamed frompeaks-queryables./schemapublishes, other than its id and geometry, is a named parameter of its getter. Run againstmain, this fails on exactly the 20 columns this PR names.get_monitoring_locationsandget_channel. The schema'sidand the name the getter returns it under (_OUTPUT_ID_BY_COLLECTION) are left out of both sides, and a list ends at the sentence that follows it.For the maintainer
*at the end of each signature, so every parameter released in v1.4.0 keeps its position. They were first inserted beforeproperties, which would have silently rebound a positionalproperties(the fourth argument ofget_field_measurementsandget_time_series_metadata) as a filter, the problem fix(waterdata): keep sublocation_identifier from shifting positional arguments #447 fixed forsublocation_identifier.sublocation_identifier, which is unreleased, is now keyword-only too.test_no_parameter_is_added_by_positionintests/contracts/public_api_test.pyrecords how many parameters each Water Data getter accepts by position, and fails if a getter gains one. It would have failed on this PR's earlier layout for all seven getters. The module docstring no longer calls a reorder harmless.statistics_begin(feat(waterdata): request v1 of the Water Data API, pinnable through api_version #422,get_time_series_metadata) andmethod_category(fix(waterdata): accept the continuous method_category queryable #423,get_continuous) shipped mid-signature in v1.4.0 on 10/02, and are now keyword-only too. That shifts the later positional parameters by one: fromthresholdsinget_time_series_metadataand fromvalueinget_continuous. A call that passed one of those by position must now pass it by name. The risk is low given the release date, and NEWS marks the change. The recorded counts exclude these two.county_name,site_type, ...) that every data collection accepts as filters but does not return. They stay in**queryables.get_peaks(value=...)is typed as a string, because the service transmits peak values as strings to preserve precision.NEWS.mdis dated 10/13/2026 and placed on top; set it to the merge date.Verification
tests/waterdata_properties_test.py, 18 passed (2026-10-13).measurement_rated,reading_type,control_conditionandparameter_description.🤖 Generated with Claude Code