Add aggregated results table for relays grouped by country and/or AS
This feature request is inspired by #23509 (moved), which, IIUC, is about displaying aggregated data on a single page. However, I believe that the feature that I'm describing here is sufficiently different to deserve its own ticket. If that's not the case, feel free to merge tickets!
It would be cool to be able to group relays in the results table by country, by AS, or even by both. (Not by family, because grouping by family can be really tricky.)
The most common use case would be that somebody wants to learn which are the top 10 countries contributing to the network. Or the top 10 ASes. And then they might want to include only relays with the Exit flag. Or filter by a given country and group by AS.
Basically, this feature would make Compass obsolete, AFAICS. The only part in Compass that this would not implement is the "(almost) fast exit" distinction, and that's not a loss.
This feature might be combined with #23509 (moved) by including a link from an aggregated results table entry to an aggregated details page that would be implemented in #23509 (moved). But that's not a requirement. The aggregated results table in itself is an improvement.
Regarding links, there could be "Top 10 Countries" and "Top 10 ASes" links next to the existing "Top 10 Relays" link.
Regarding the implementation, I think that we could start with an implementation in Atlas and only consider adding another document type for this to Onionoo if the implementation in Atlas does not scale. Atlas would request a details document with only the fields to be aggregated and displayed in the table, but for all relays. That's a potentially quite large document (though it's much smaller when using the fields parameter). But it's probably quite easy to cache that on the server and in the browser (for different aggregations by country or AS). Atlas would then perform all aggregations and subsequent sorting in the browser.
What do you think? Did I miss anything that makes this feature a lot more difficult than it sounds in my description above?