Repository navigation
fix(waterdata): keep the parent statistic in statistics results - #465
Open
bhaskargurram-ai wants to merge 1 commit into
Open
bhaskargurram-ai wants to merge 1 commit into
bhaskargurram-ai wants to merge 1 commit into
Conversation
_handle_nesting copied only parameter_code, unit_of_measure and parent_time_series_id from each data entry of a statistics feature, and dropped parent_statistic_id and parent_statistic_name. A parameter can have several daily series at one location (daily max, min and mean discharge at USGS-08049300, for example), each with its own normals and intervals, so get_stats_por and get_stats_date_range returned three medians for 07-01 with nothing but an opaque time series id to tell which daily statistic each one summarizes. Carry both fields through json_normalize's meta, as the R package does.
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.
Fixes #464
get_stats_por()andget_stats_date_range()dropped theparent_statistic_idandparent_statistic_namefields that the Statistics API sends with each series. When a parameter has several daily series at one location (e.g. daily max, min and mean discharge at USGS-08049300), the result had three rows per day with nothing butparent_time_series_idto tell them apart._handle_nestingnow carries both fields throughjson_normalize'smeta, next toparent_time_series_id, as the R package does. No other column changes.Tests:
test_get_stats_porchecks the two columns against the recorded fixture, and a newtest_handle_nesting_keeps_parent_statisticchecks that three series of one parameter (max, min, mean) come back labelled. Both fail on main and pass with the change. NEWS.md has an entry.