Allow grouping stats endpoint data by any attribute

Also allow arbitrary restriction through query parameters.
Aggregate population in stats endpoint