Taymon Beal was pinging us about some help with using the LessWrong API to construct a sidebar for SSC with upcoming meetups. I figured I would write up my response publicly so that other people might be able to learn from it.
As I understand the thing correctly (though Taymon can correct me in the comments) he wanted a way to query the API to get a list of all upcoming SSC meetups. This is the the GraphQL query that I would construct to make that happen (note to myself to fix the code embedding editor component):
{PostsList(terms: {view: "nearbyEvents", filter: "SSC", lat: 0, lng: 0}) {
_id
createdAt
title
mongoLocation
location
}}
You can also play around with this interactively on our GraphiQL page.
The "nearbyEvents" view right now requires you to specify a location, and returns all upcoming meetups (to any point in the future) ordered by their distance from that point. You can find the full definition of that view here.
Thanks. I'd originally written up a wishlist of server-side functionality here, but at this point I'm thinking maybe I'll just do the sorting and filtering on the client, since this endpoint seems able to provide a superset of what I'm looking for. It's less efficient and definitely an evil hack, but it means not needing server-side code changes.
I'll note that
filter: "SSC"
doesn't work in the GraphiQL page; events that don't match the filter still get returned.More generally, the way the API works now basically means that you can only ask for things that correspond to features of the lesswrong.com web client. In effect, the server-side implementations of those features are what you're exposing as the API. There's an additional problem with this besides it just being limiting: you're likely to want to change those features later, and you risk breaking third-party clients if you do. If you want to support those clients, maybe they should instead use a more general API for querying the database (although I'm not sure exactly how to implement that while maintaining security).
Yeah, it would be great to somehow know how active a group is. Though it's definitely non-trivial to make that happen. Right now all groups were created in the last few months, so you know at least that if they are dead, they haven't been dead for long.
My model is that showing a group that is actually in the same city but might or might not be active is more important than showing far away events that are guaranteed to be real. In both cases the user will be disappointed, but I think your hit rate is going to be higher for the groups, since ther... (read more)