gazetteerhk / census_explorer

Explore Hong Kong's neighborhoods through visualizations of census data
http://gazetteer.hk
MIT License
42 stars 12 forks source link

API Behavior #30

Closed hxu closed 10 years ago

hxu commented 10 years ago

@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.

If 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), the groups field on the response is properly filtered, but data will return all rows. Should data be basically a flattened version of groups? It seems that if we are asking for an aggregate, then we wouldn't want the typical data behavior?

hxu commented 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.

hupili commented 10 years ago

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:

I don't prefer to interpret data as flattened version of groups, although it is technically so without aggregate.

hxu commented 10 years ago

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?

hupili commented 10 years ago

Yes. It only groups by one column by design. Grouping by multiple column is also possible if we need that in application.

hxu commented 10 years ago

Closing this. Main conclusions are: