Add SiteTypeCode and StatisticCode enums for waterdata parameters - #234
thodson-usgs wants to merge 1 commit into
Conversation
Exposes discoverable constants for the `site_type_code` and `statistic_id` parameters so callers get IDE autocompletion without breaking any existing string-based usage (both enums extend `str`). Closes DOI-USGS#98 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
f224666 to
33bd889
Compare
|
Closing as superseded. Hardcoding The PR's own module docstring points readers at If discoverable constants are still wanted for IDE autocompletion, the better shape is generating or validating them against |
Summary
SiteTypeCodeandStatisticCodeasstr-based enums indataretrieval/waterdata/enums.pydataretrieval.waterdatapublic APIstr, so existing callers passing plain strings are unaffected — the enums are purely additiveSiteTypeCodecovers all 56 site types fromget_reference_table("site-types")StatisticCodecovers the 17 named statistic codes (excluding the 90+ numeric percentile entries)Usage example:
Closes #98
Test plan
python -m pytest tests/waterdata_test.py— all 26 tests passget_monitoring_locations(state_name="Connecticut", site_type_code=SiteTypeCode.WELL)returns onlyGWsitesrequestsserializes enum values correctly (uses native string value, not__repr__)