Add row ordering by time and monitoring_location_id, if applicable, plus...#203
Add row ordering by time and monitoring_location_id, if applicable, plus...#203ehinman merged 1 commit intoDOI-USGS:mainfrom
time and monitoring_location_id, if applicable, plus...#203Conversation
| @@ -662,9 +662,24 @@ def _arrange_cols( | |||
| plural = output_id.replace("_id", "s_id") | |||
There was a problem hiding this comment.
this line confuses me, but the code appears to work as it should
There was a problem hiding this comment.
We can revisit, because this might not be necessary. I'll make an issue. Basically, every service returns a straight up "id" column with the data, which is actually different across services. So the package adds the service name to the beginning of the "id" column, e.g. "monitoring_location_id", "daily_id", etc. This part of the function accounts for whether someone enters just "id" into their properties argument, or enters "monitoring_locationS_id" (maybe they notice that pattern that it's service + id, and the sites service is called "monitoring-locationS"). If they enter "id", then the resulting dataframe will have the "monitoring_location_id" column name. But if they enter "monitoring_locations_id" (straight up service name, "monitoring locations", plus "id"), then it will return the column name "monitoring_locations_id". I kinda doubt this will be leveraged at all, and adds confusion.
...move probably-useless-to-user database ids for specific endpoints to the end of the dataframe, so they're less likely to impede review of the data returned.
Also added a couple tests for these changes. Note that the
timecomponent is sorted in ascending order, so earlier results show up first.Closes #202 and is a slightly softer solution to #201, since users can request columns in the
propertiesargument, anyway.