-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why are there different object names in the response of /groupBy/boundary and /ratio/groupByBoundary? #16
Comments
Behind each of these result objects is normally a Java class that has specific attributes, which are reflected by the nested objects here one level deeper in the JSON. So as you can see the response of the /ratio endpoint includes a "ratioResult" JSON array, whereas the other ones include a general "result" JSON array. I think the different naming of the outter object here is a legacy issue from back when we removed the /share endpoint and all its corresponding classes. Back then I combined the remaining /groupBy endpoints to use that one groupByResult, but apparently either forgot to adapt them for the /ratio endpoint or had a reason in the code to distinguish them somehow. It's true though that from a users perspective, this is ambiguous and should not be like that. Will investigate 🔍 |
From a user perspective I would suggest for the sake of simple response parsing to use the same JSON paths for all groupBy respones such that you always have:
|
I made an inspection on what response structure is used where and summarized it as follows: Current (V1) aggregation response structures1.
|
I think for a future v2 version we should consider to simplify this into only 2 structures as proposed here: Proposed reduction to only two response structures
1. Plain results without grouping- response
- result[]
- {timestamp, value} OR {fromTimestamp, toTimestamp, value} OR {timestamp, value, value2, ratio} 2. Grouped results with one, two and potential N groupings
- response
- groupByResult[]
- groupByObject: string[]
- result[]
- {timestamp, value} OR {fromTimestamp, toTimestamp, value} OR {timestamp, value, value2, ratio} |
I just took a look in the code and tweaked it a bit. The RatioResult can indeed be directly included in the standard Result object for plain /ratio requests. For /ratio/groupBy/boundary requests though, it's not so easily changeable because we use the timestamp in the response for the GeoJSON response format. See e.g. such a request |
🤔 IMHO, this should be only changed in a major release, even though this is indeed a very small change and wouldn't change the logic behind the resource: It does change the data interface however and for an end-user it would be very annoying if a working query "suddenly" produces a result which cannot be processed with the existing scripts any more. I experienced a similar issue recently in another project, where a single escape character got changed in the data from an external data provider causing hard to debug follow-up errors down the line (hotosm/osm-analytics-cruncher#20 (comment)). |
I don't see why this would be much different from the non- |
It seem to be inconsistent to me that all groupBy endpoints except the ratio/groupBy/boundary are structured like this:
only the ratio/groupBy/boundary uses 'groupByBoundaryResult' instead of 'groupByResult' like this:
The "normal" /groupBy/boundary does not use the groupByBoundaryResult but the common groupByResult as all the others.
To me there seems no need for different naming of the groupByResult.
The text was updated successfully, but these errors were encountered: