Open tslawecki opened 6 years ago
We haven't implemented for Virtual Buoys yet. And for buoys, make sure you have added the buoy to your map.
@tslawecki > I changed the title from 'manage alerts not appearing' to above and for now gave it a label of "future enhancement". Feel free to correct as needed if I assumed incorrrectly.
@kknee, @Bobfrat, @cheryldmorse - this is now something to bring ASARP - preferably before 6/26. My understanding is that @cgalvarino will be tasked with this.
@cheryldmorse, @kknee - some questions and comments:
1.a. Can someone confirm that there's a handful of alerts sitting there in the database for me (all Lake Erie models)
1.b. When should the alerts be checked? At regular time or file-update triggered?
1.c. The new hypoxia forecasts are updated daily - can we change to scan next 24 or 36 hours instead od 12?
1.d. Potential future enhancement - send an e-mail acknowledgment upon submittal (and maybe also check models at time of submittal?)
Unclear to me (probably on me) - if I want an alert for wave height > 0.1 m, do I set min_threshold or max_threshold?
How do currents get evaluated for models? Do we need to separate into direction/magnitude
There may be a use case for alerting on wind coming out of a particular quadrant (e.g. NNW - WNW). Could this be handled?
Some more questions to consider (thanks to @cgalvarino for thinking about these details)
5) How to administer the Virtual Buoy alerts once created? They don't persist through sessions and model layers can be added or removed at any time. Will almost certainly need a page dedicated to alerts admin now.
6) Can users create model alerts at obs stations?
7) Do we need to add the ability to name virtual buoys? Otherwise they'll get a nice alert, but it will be tagged w/ only a position, and who's going to be able to associate meaning w/ that, esp. if they have a batch of VB's being monitored.
@tslawecki - If you are logged in then you should be able to see your alerts via a get request to the api ( https://portal.glos.us/api/alert ). The alerts are checked every hour
I entered the alerts manually from the command line without my user ID.
Also, I was sending them to the oceansmap dev URL ... I'll start over ...
From: cheryldmorse notifications@github.com Sent: Monday, June 11, 2018 3:09 PM To: glos/myglos Cc: Tad Slawecki; Mention Subject: Re: [glos/myglos] Ability to set up alerts for virtual buoys (#213)
@tslaweckihttps://github.com/tslawecki - If you are logged in then you should be able to see your alerts via a get request to the api ( https://portal.glos.us/api/alert ). The alerts are checked every hour
- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/glos/myglos/issues/213#issuecomment-396353034, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AE-3PsS7RyQhOyuTVSnMIP0uSs4gW_PVks5t7sBygaJpZM4TlGTI.
@cheryldmorse - looking for clarification ... does portal.glos.us/api/alert support model alerts, or is that only on dev? I get 301 Moved Permanently
when trying the following:
curl -X POST -H "Content-Type: application/json" -d '{ "phone": "734-478-3011","parameter": "Wave Height","catalog_id":"LAKE_ERIE_WAVE_HEIGHT","lat":"41.5","lon":"-91.75","units": "meters","origin": "LAKE_ERIE_WAVE_HEIGHT","email": "tad@limno.com","user_id": "","min_threshold": "0.01","max_threshold": null,"contact_flag":true}' http://portal.glos.us/api/alert
BTW - is this (max_threshold null) checking for waves > 0.01 or waves < 0.01?
@Bobfrat & @cgalvarino - on Charlton's questions ...
I didn't realize virtual buoys did not persist in a saved session. Regardless, it seems that once the alert (a match of location and model parameter) is in the database, the persistence of the alert should be OK.
I think for simplicity the answer for now is "no", although I actually think it makes sense to allow both.
Naming the virtual buoy and/or the alert make sense to me.
@tslawecki - Yeah, the model alert code is only on dev. If you were logged in when the alert was created you can still view it via the api at the following endpoint: http://dev.oceansmap.com/myglos/api/alert .
You're hitting the wrong endpoint for a model alert in the curl request above. To set a model alert the endpoint is /api/model_alert.
In your example above it is checking if waves < 0.01
@cheryldmorse - I curl
'd again with the following requests - one to ./alert, one to ./model_alert - and responses ... but I can't verify whether or not they're in the system because when I go to dev.oceansmap.com/myglos/user/login to log in as tad.slawecki@gmail.com I get a (mostly) blank screen with only the option to create an account (perhaps an @bobfrat issue?):
Also, it's not clear if I need to be authenticated/logged in when issuing the alert request - I'm of course not logged in when curl
ing.
Here are the requests and responses - run on yet another AWS instance ... I
$ curl -X POST -H "Content-Type: application/json" -d '{ "phone": "734-478-3011","parameter": "Wave Height","catalog_id":"LAKE_ERIE_WAVE_HEIGHT","lat":"41.5","lon":"-91.75","units": "meters","origin": "LAKE_ERIE_WAVE_HEIGHT","email": "tad@limno.com","user_id": "tad.slawecki@gmail.com","min_threshold": null,"max_threshold": "0.01","contact_flag":true}' http://dev.oceansmap.com/myglos/api/alert
{
"catalog_id": "LAKE_ERIE_WAVE_HEIGHT",
"contact_flag": true,
"creation_date": "2018-06-13T10:08:39.849340+00:00",
"email": "tad@limno.com",
"id": 72,
"max_threshold": 0.01,
"min_threshold": null,
"origin": "LAKE_ERIE_WAVE_HEIGHT",
"parameter": "Wave Height",
"phone": "734-478-3011",
"units": "meters",
"unsubscribe": "http://dev.oceansmap.com/myglos/api/alert/unsubscribe/984a150dcdf85c8c0412827e4095a0267be7f542",
"url": "",
"user_id": "tad.slawecki@gmail.com"
}
... AND ...
$ curl -X POST -H "Content-Type: application/json" -d '{ "phone": "734-478-3011","parameter": "Wave Height","catalog_id":"LAKE_ERIE_WAVE_HEIGHT","lat":"41.5","lon":"-91.75","units": "meters","origin": "LAKE_ERIE_WAVE_HEIGHT","email": "tad@limno.com","user_id": "tad.slawecki@gmail.com","min_threshold": null,"max_threshold": "0.01","contact_flag":true}' http://dev.oceansmap.com/myglos/api/model_alert
{
"catalog_id": "LAKE_ERIE_WAVE_HEIGHT",
"contact_flag": true,
"creation_date": "2018-06-13T10:08:39.594763+00:00",
"email": "tad@limno.com",
"id": 71,
"max_threshold": 0.01,
"min_threshold": null,
"origin": "LAKE_ERIE_WAVE_HEIGHT",
"parameter": "Wave Height",
"phone": "734-478-3011",
"units": "meters",
"unsubscribe": "http://dev.oceansmap.com/myglos/api/alert/unsubscribe/e3ed668f5398326b824ab8c8261a9c6e74e83ade",
"url": "http://coastmap.com/ecop/wms.aspx?STYLES=+&LAYERS=LAKE_ERIE_WAVE_HEIGHT&WIDTH=1&SERVICE=WMS&FORMAT=image%2Fpng&REQUEST=GetFeatureInfo&HEIGHT=1&SRS=EPSG%3A4326&VERSION=1.1.1&BBOX=-91.75%2C41.5%2C-91.75%2C41.5",
"user_id": "tad.slawecki@gmail.com"
}
@tslawecki - You do need to be logged in when making the alert request if you want the alert to be associated with your user id. The only way to view the alerts is if you are logged in when they are created. The new alerts code is also on production now. I just tested it and I can view the model alerts that I have created
@cheryldmorse - Sounds great, but (1) I don't see alerts for virtual buoys on portal.glos.us (production?) and (2) still can't log in to dev.oceansmap.com/myglos. Any thoughts?
@cheryldmorse just to clarify that I've tested as well, so not just an @tslawecki issue > Dev is not allowing any login capability for me either - just a blank page (and it normally does so this is a new thing). Also, no virtual buoy alert ability on production although the logins are working there. Does something need to be kicked (server, not people-wise)?
That was a bug from the Switch to Map/Catalog Navbar updates. Fixed and deployed to dev now. May need a hard refresh.
@Bobfrat - thanks! I can log in and see my alerts now in both. @cheryldmorse - I still don't see an alert bell when I'm in a virtual buoy, and though the model result shows at a real buoy along with the alert bell, I can't set an alert for the model result.
@tslawecki @kkoch - to clarify, just the backend alert API that handles the model alerts is running on production. I don't believe the portal itself can handle an alert for a virtual buoy yet. But you should be able to manually send a POST request and see that the alert was set via the API calls
I'm getting an nginx message - 301 Moved Permanently
when trying the below --- do you see anything wrong?
curl -X POST -H "Content-Type: application/json" -d '{ "phone": "734-478-3011","parameter": "Wave Height","catalog_id":"LAKE_ERIE_WAVE_HEIGHT","lat":"41.5","lon":"-91.75","units": "meters","origin": "LAKE_ERIE_WAVE_HEIGHT","email": "tad@limno.com","user_id": "tad.slawecki@gmail.com","min_threshold": null,"max_threshold": "0.01","contact_flag":true}' http://portal.glos.us/api/model_alert
@tslawecki Should be https://portal.glos.us/api/model_alert Also, you can't specify the user_id - OM sets that automatically if you are logged in
The curl works now with https ... however, I'm confused about the user_id ... I'm running this on an AWS instance that has nothing to do with OM.
Maybe that's why I have the new problem of not getting "Administer alerts" in production version hamburger menu -- perhaps my non-OM submittals caused a problem?
Basically OM acts like a proxy handling the authentication. If you are not logged into OM then you can't set an alert that is associated with your account. OM will see that you are not logged in and change the user_id to null before forwarding the call to the alert API
I don't believe the portal itself can handle an alert for a virtual buoy yet.
@cheryldmorse is right. The UI can't viz VB alerts yet. If they show up on the admin page, I will be surprised.
@kknee, we have a NOAA-GLERL user trying to set up an alert at a virtual buoy, but he can't find "Manage alerts" anywhere. I have the same issue - I'm logged in as a MyGLOS user, but don't see "Manage alerts" at a regular buoy or virtual buoy ...