-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2: follow search notifications #26
Comments
…e_312_replace_http_status_code_when_source_not_found ⚙️ Adjust status code for data source not found response
This poses some interesting implementation questions: most prominently, how do we know when a search's results get updated? Off the top of my head, I can think of a few options:
Then we also have the question of how to manage this in the database:
We'll probably need one or two endpoints: One to follow a search, and one to unfollow (which might be able to be one endpoint). Then we'll need to implement saved searches as well, so #21 may be a blocker. |
@josh-chamberlain Given that you indicated that #21 is relatively low priority, how is this prioritized in relation? |
@maxachis this might be another semantic thing, so bear with me: we don't need "saved" searches for this to work. But, we'd be keeping track of people's "followed" searches instead. Basically, we realized "following" and "saving" a search were not functionally different enough to make them both. Who knows when or if we will ever make advanced searches? The anticipated most common use of this function is to "follow" a geography, occasionally with a record type modifier. Therefore, I think we can have a If you want, it would be acceptable for v2 to Then every once in a while (as often as the digest email) we would check all the follows for new sources and requests! |
@josh-chamberlain Here is my implementation proposal. Because this is complex, it's a lengthy one, with a lot of headers to demarcate everything: Implementation ProposalOverviewWe track specific location combinations in the database, add updates for each locational combination ( If someone is subscribed to the Suppose we have state S, county C, locality L.
Notifying EventsThese are the events which could trigger a notification
Database DesignThree tables:
Backend ImplementationWhen a notifying event occurs, we get the SCL of the Geo and check if:
For any of the three valid cases above, we get the Then, during some periodic interval, we collect all queued updates, send them to the users who are following the requisite
How often will notifications occur?
Edge cases
Endpoint designFor all of these, assume that you must be either the user being queried or an admin to have the requisite permissions to perform these actions.
Issues
|
@maxachis thank you for thinking through all these details. OverviewThis makes sense. Originally I'd thought of the record category as part of the search, but that's too granular, and this is a more pure idea. People can follow a Notifying eventsI think this is simpler to communicate and execute:
In the notification we'd list each followed search, its sources, and its new/completed requests. Database designThis is making sense to me. I'll emphasize: these geographic locations ("SCLs") are discrete objects with foreign keys, as you say. I like that the way you have it designed, it would be pretty easy to answer the question "how many people are following this search, anyway?"
For
Edge casesThanks for remembering about un-following. I added a note to #274 for when we get there. Endpoint designI defer to your wisdom. Issues
Example notification
|
@josh-chamberlain Here are my follow-ups! Assume anything I don't respond to is "Yes, I align with your thinking on this and have no concerns! Array of User IDs or Link Table?
Yes! But there are a few implementation concerns that point me away from that:
So I think the Link table makes more sense. Localities as a separate table?
I ran the numbers on how many distinct rows we have in agencies versus how many distinct county_fips/state_iso/municipality combinations, and came to:
So I think there is an argument for breaking it up into a separate table from the standpoint of normalization. I'd also argue that the queries I have to perform to get the full unique geo would be easier -- as is, I'd have to first get all the distinct municipality combinations, and then match on them. Always doing updates on the first of the month?
From a certain standpoint, it could be indeed be simpler. Btu there are caveats:
So I think it could be simpler, but I do think the downsides outweigh the upsides. |
@maxachis the first two categories seem aligned to me. And now we're just left with questions about timing and queues.
I think there's some basic/central premise or terminology gap that we should resolve synchronously! When you get this, let's coordinate something in Discord. It shouldn't take too long, I don't think. |
So I've managed to resolve the above wordy diatribes with @josh-chamberlain to my satisfaction, but I would like to get @joshuagraber 's input on three remaining components: Endpoint NomenclatureFor designing the endpoints, does it make more sense for their structure to be:
My thinking is that for getting information relevant to a particular user, we have Include a
|
|
@josh-chamberlain A few question on notifications on data requests Should data requests get a specific location as well?Currently, in the Should searches return data requests as well?Currently, searches only return data sources (and relevant agencies); they do not return data requests. If we want our followed search notifications to return data requests as well, should the search functionality be updated in turn? |
|
Just chiming in here to say that the basic work to follow and un-follow searches from the client web app is completed ✅ |
This is how people get notified about updates. The idea being that if new data becomes available, a FOIA request comes through, or a request is completed, they can come back for the data they were interested in.
Front end
Back end
link_users_followed_location
table, which can be used to associateusers
withlocations
they would like to follow. #462new requests open
or arecompleted
in the geo (requests have geo and record type too)The text was updated successfully, but these errors were encountered: