Repository navigation
feat(waterdata): serve the method and citation reference tables - #470
Open
thodson-usgs wants to merge 10 commits into
Open
thodson-usgs wants to merge 10 commits into
thodson-usgs wants to merge 10 commits into
Conversation
Seven of the 24 reference tables are now exceptions to the singularize rule, and a wrong rule-made name passed silently. An explicit table, kept in step with METADATA_COLLECTIONS by a key-sync test, mirrors _OUTPUT_ID_BY_COLLECTION for the data collections. The method-table tests read live-captured records that refer to each other, so the join test merges real frames instead of comparing hand-typed property lists. The NEWS entry is shortened. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ce-tables # Conflicts: # NEWS.md
…A_COLLECTIONS IDEs and type checkers now offer the table names and flag a misspelled one before the call. The runtime check against the same Literal is unchanged.
…ts notebook Correct the sentence on ID-column names, which the method and citation tables no longer follow, and add a section that joins methods to method-categories and method-citations to citations. Also port R's list-valued filter example (read_waterdata_metadata on time-zone-codes) to a query with a list.
thodson-usgs
marked this pull request as ready for review
November 30, 2026 18:18
The comment, docstring and NEWS entry said the method and citation tables "name" their ID column after the column that refers to them. They now say the ID column has that column's name. The demo notebook says the methods are used to produce USGS data, and its table shows "none" in place of a dash for the combined table. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`combined-method-citations` is the one new table that no other table refers to, so its ID column is not named after a referring column. The NEWS entry, the comment and the Returns section now say so, and give its `<method_id>.<citation_method_id>` form. The NEWS entry moves to the top, dated 12/01/2026, to be re-dated on the day it lands. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
waterdata.get_reference_tablenow acceptsmethods,method-categories,method-citations,citationsandcombined-method-citations. Before, it rejected all five although the server offers them.Usage
ID column naming
The old rule (
removesuffix("s").replace("-", "_")) gives wrong names for these collections (method,method_categorie,method_citation,citation,combined_method_citation). For the four new collections that another table refers to, the ID column has the name of the foreign-key column, so tables join on same-named columns. The rule is replaced by one explicit table,_OUTPUT_ID_BY_REFERENCE_COLLECTION, that names the ID column of every reference collection, including thecountiesandcountriesspecial cases. Every existing collection keeps its current ID column name. A test checks that the table and theMETADATA_COLLECTIONSLiteral list the same collections, so adding a table to only one of them fails.methodsmethod_idmethod-citations.method_id,combined-method-citations.method_id,time-series-methods.method_idmethod-categoriesmethod_categorymethods.method_categorymethod-citationscitation_method_idcombined-method-citations.citation_method_idcitationscitation_namemethod-citations.citation_namecombined-method-citationscombined_method_citation_id<method_id>.<citation_method_id>) and both parts are columns, so it needs a name of its ownThe docstring's option list and the description of the ID column are updated, and NEWS.md has an entry. The reference-lists demo notebook has a new section, Method and citation tables, that joins methods to their categories and citations.
Verification
methods.method_categoryis inmethod-categories, everymethod-citations.method_idis inmethods, every combinedcitation_method_idis inmethod-citations, and the combined ID equals<method_id>.<citation_method_id>on every row.queryfilter on the new ID name (e.g.query={"method_id": "00021"}onmethods) returns the one matching row for each collection.method-citations.citation_namevalues (e.g.EPA-600/R-93/100) have no row incitations; the server'scitationstable does not contain them. 623 rows have a nullcitation_name._OUTPUT_ID_BY_REFERENCE_COLLECTIONandMETADATA_COLLECTIONSlist the same collections. For the 19 existing collections, the table gives the same ID names as the old rule (checked by comparing the two).ruff check,ruff format --check,mypy,lint-imports,xenon,complexipyandcoverage run -m pytest tests/ && coverage report(1674 passed, 99.05%) pass.