Closed hxu closed 10 years ago
FYI, I've updated test.js to use the CensusAPI in the frontend branch. There's still some stuff that needs to be done for manipulating the returned data. Let me know what you think.
The use case in my mind is, when you invoke groupby
or aggregate
, you don't want original data
. We can make the following protocol:
data
contains the results after applying all filters.options
contains the uniqued values for each column, after applying all filters.groups
contains groups. aggregate
effects only if there is groupby
.I don't prefer to interpret data
as flattened version of groups
, although it is technically so without aggregate
.
OK, so when using groupby
and aggregate
, I will use only the data in groups
If you run this query: http://137.189.97.90:5901/api/?return=groups&projector=row&area=a01&area=a02&table=0&table=1&groupby=area&groupby=row
, then only area is grouped and row is ignored.
I think it's OK if we only group by one level deep, but can you confirm that this is as designed?
Yes. It only groups by one column by design. Grouping by multiple column is also possible if we need that in application.
Closing this. Main conclusions are:
aggregate
and groupby
are provided, then shouldn't use data
resultgroups
only groups one level deep. Additional parameters are ignored.
@hupili this issue is for some behavior that I have questions about on the API as I am working on it. Not sure if any of these are major, so if you think any issue warrants its own issue, please feel free to break it out.
aggregate
andgroupby
parameter doesn't filterdata
responseIf you run this query:
api/?aggregate=median& column=n118_households& groupby=area& projector=area& projector=value& projector=row& return=data& return=groups& table=18
(from the test), thegroups
field on the response is properly filtered, butdata
will return all rows. Shoulddata
be basically a flattened version ofgroups
? It seems that if we are asking for an aggregate, then we wouldn't want the typical data behavior?