Skip to content
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

Notifications #10

Open
evamaxfield opened this issue Aug 25, 2021 · 4 comments
Open

Notifications #10

evamaxfield opened this issue Aug 25, 2021 · 4 comments
Labels
access Information access (including accessibility) features or bugs feature New feature or request idea A high level idea for a CDP feature

Comments

@evamaxfield
Copy link
Member

Idea / Feature

Send me a notification when an event has occurred, a topic was discussed, a bill was proposed, etc. Alert me when things happen!

Use Case / User Story

As a user I want to be notified when:

  • a bill has moved to full council so I can give public comment
  • a presentation is going to be given to council on "x" topic

Other Notes

@evamaxfield evamaxfield added the idea A high level idea for a CDP feature label Aug 25, 2021
@adrmac
Copy link

adrmac commented Oct 15, 2021

Provide the ability for a user to set up notifications based on any query that the CDP interface provides.

The user would be provided with a button to "Create a notification based on these options." Notification configurations would need to be saved to some form of user account or object to enable customization of preferences over time, and the ability to unsubscribe. Independent of this, there should be a way for notification subscribers to opt in to a Mailchimp contact list to receive updates on new app features.

Instantiation administrators should be able to connect a query configuration to one or more Twitter accounts, to enable a broadcast feed of new data that can be curated or split into different handles by subject area.

Full presentation from hackathon Oct 14-15 here.

@evamaxfield
Copy link
Member Author

Thanks again @adrmac! Will discuss this with the team and likely move this forward to a full proposal.

@evamaxfield evamaxfield added feature New feature or request access Information access (including accessibility) features or bugs labels Oct 21, 2021
@BrianL3
Copy link

BrianL3 commented Nov 17, 2021

How we could do this:

  1. make a users collection in accordance with the hackathon recommendations (users must have some method of contact and some way of tracking their notification preferences)
  2. instance owners need to be on blaze payment plan or better
  3. they need to click thru the wizard in the firebase web GUI i think?
  4. our deployment pipeline needs to be able to trigger the firebase deployment script
  5. we would need some way of sending notifications - send-grid is something i am familiar with for mass email. That would require additional cross-municipality infrastructure fiddling, We could also just do it completely inside the cdp-frontend web app, e.g. you go to your User profile's "Legislation I am interested in" Page and see the latest notifications.

Pseudo-ish code:

exports.legislationUpdated = functions.firestore.document('our-legislation-collection-name/{the-id-of-the-legislation-that-got-updated}').onUpdate((snap, context) => {
  const beforeLegislation = snap.before.data()
  const afterLegislation = snap.after.data()
  // we can check and see EXACTLY what changed and only notify people if it was something important, or in accordance with their notification preferences.
  // i would recommend that we also do some sort of notification collation (if you have 50 updates to legislation in a day, you don't want to send 50 emails :fearful:)
  // do a query on the yet-to-be-made Users collection for whoever is wanting notifications for this legislation and send them out
})

@evamaxfield
Copy link
Member Author

make a users collection in accordance with the hackathon recommendations (users must have some method of contact and some way of tracking their notification preferences)

So this means moving off of GH pages because we would need like a /settings and some login or something route for the user to manage their account correct?

instance owners need to be on blaze payment plan or better

not concerned about this. This happens as a part of the normal setup process

they need to click thru the wizard in the firebase web GUI i think?

not sure, if it's anything like the "public read" firebase issue i have been having they may need to do something in the ui but i think this might be easier to handle automatically for them. this is an implementation detail that can be handled by good setup processes / documentation so im not concerned

our deployment pipeline needs to be able to trigger the firebase deployment script

this is an interesting one, I looked into the tooling a bit. the firebase cli seems to manage this for people but the challenge will be how to "ship" these files to each cookiecutter... we could submodule them into the repo maybe? but I think what we may want to do is in the new "notifications repo" (or whatever we want to call it), we publish a github action that does all these steps for them, and we can release updates to the github action.... this isn't perfect imo though because the backend repo version could get a conflicting version from the "notifications" repo. so, and this is a bit weird but we could simply include a bin script in the backend repo that clones the notifications repo at a specific tag / release. and the infrastructure job on the cookiecutters would basically do the following:

pip install cdp-backend[infrastructure]
pulumi up  # this is the normal infra deploy
cdp_get_notifications_stack  # this would be a new bin script in the cdp-backend package
cd cdp-notifications  # this repo is created from the above command, its just a git clone
firebase deploy  # normal firebase operation

basically I am just trying to figure out "how do we keep the notifications stack in sync with the rest of the backend stack"

we would need some way of sending notifications - send-grid is something i am familiar with for mass email. That would require additional cross-municipality infrastructure fiddling, We could also just do it completely inside the cdp-frontend web app, e.g. you go to your User profile's "Legislation I am interested in" Page and see the latest notifications.

i depends on cost for sure... it may be a good first attempt to leave this out. just get basic user management and notifications in the web ui, then if we want to add emailing / figure out the cost of emailing, we can add later?


pseudo-code comment -- linking to the backend schema: https://councildataproject.org/cdp-backend/database_schema.html

and a link to the available methods: https://firebase.google.com/docs/functions/firestore-events

for legislation tracking I feel like it would be onCreate of the MatterStatus collection.

exports.newMatterStatus = functions.firestore
  .document("matter_status/{newMatterStatus}")
  .onCreate((snap, context) => {
     // construct some query to find all users interested in this document
     // push a notification to each user??? 
  }
})

What would the notifications collection look like?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
access Information access (including accessibility) features or bugs feature New feature or request idea A high level idea for a CDP feature
Projects
None yet
Development

No branches or pull requests

3 participants