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

Add support for all weatheralerts event types #243

Closed
andrea-fantini opened this issue Feb 17, 2024 · 3 comments · Fixed by #250
Closed

Add support for all weatheralerts event types #243

andrea-fantini opened this issue Feb 17, 2024 · 3 comments · Fixed by #250
Labels

Comments

@andrea-fantini
Copy link
Contributor

Is your feature request related to a problem? Please describe.
The list of supported alert types for the integration weatheralerts is not comprehensive. This leads to a game of wack-a-mole with multple reports of unsupported alert types as they occur. (ex. #240 #233)

Describe the solution you'd like
Expand the current list of supported alert types to be more comprehensive. To facilitate the job I did my best to collect and organize the relevant events and levels.

Event Types

'911 Telephone Outage': MeteoalarmEventType.Unknown,
'Administrative': MeteoalarmEventType.Unknown,
'Air Quality': MeteoalarmEventType.AirQuality,
'Air Stagnation': MeteoalarmEventType.AirQuality,
'Arroyo And Small Stream Flood': MeteoalarmEventType.Flooding,
'Ashfall': MeteoalarmEventType.Volcanic,
'Avalanche': MeteoalarmEventType.Avalanches,
'Beach Hazard': MeteoalarmEventType.CoastalEvent,
'Blizzard': MeteoalarmEventType.SnowIce,
'Blowing Dust': MeteoalarmEventType.Dust,
'Brisk Wind': MeteoalarmEventType.Wind,
'Child Abduction': MeteoalarmEventType.Unknown,
'Civil Danger': MeteoalarmEventType.Unknown,
'Civil Emergency': MeteoalarmEventType.Unknown,
'Coastal Flood': MeteoalarmEventType.Flooding,
'Dense Fog': MeteoalarmEventType.Fog,
'Dense Smoke': MeteoalarmEventType.Fog,
'Dust': MeteoalarmEventType.Dust,
'Dust Storm': MeteoalarmEventType.Dust,
'Earthquake': MeteoalarmEventType.Earthquake,
'Excessive Heat': MeteoalarmEventType.HighTemperature,
'Extreme Cold': MeteoalarmEventType.LowTemperature,
'Extreme Fire': MeteoalarmEventType.ForestFire,
'Extreme Wind': MeteoalarmEventType.Wind,
'Fire': MeteoalarmEventType.ForestFire,
'Fire Weather': MeteoalarmEventType.ForestFire,
'Flash Flood': MeteoalarmEventType.Flooding,
'Flood': MeteoalarmEventType.Flooding,
'Freeze': MeteoalarmEventType.LowTemperature,
'Freezing Fog': MeteoalarmEventType.LowTemperature,
'Freezing Rain': MeteoalarmEventType.LowTemperature,
'Freezing Spray': MeteoalarmEventType.LowTemperature,
'Frost': MeteoalarmEventType.LowTemperature,
'Gale': MeteoalarmEventType.SeaEvent,
'Hard Freeze': MeteoalarmEventType.LowTemperature,
'Hazardous Materials': MeteoalarmEventType.Unknown,
'Hazardous Seas': MeteoalarmEventType.SeaEvent,
'Hazardous Weather': MeteoalarmEventType.Unknown,
'Heat': MeteoalarmEventType.HighTemperature,
'Heavy Freezing Spray': MeteoalarmEventType.SnowIce,
'High Surf': MeteoalarmEventType.CoastalEvent,
'High Wind': MeteoalarmEventType.Wind,
'Hurricane Force Wind': MeteoalarmEventType.Hurricane,
'Hurricane Local': MeteoalarmEventType.Hurricane,
'Hurricane': MeteoalarmEventType.Hurricane,
'Hydrologic': MeteoalarmEventType.Unknown,
'Ice Storm': MeteoalarmEventType.SnowIce,
'Lake Effect Snow': MeteoalarmEventType.SnowIce,
'Lake Wind': MeteoalarmEventType.Wind,
'Lakeshore Flood': MeteoalarmEventType.Flooding,
'Law Enforcement': MeteoalarmEventType.Unknown,
'Local Area': MeteoalarmEventType.Unknown,
'Low Water': MeteoalarmEventType.CoastalEvent,
'Marine Weather': MeteoalarmEventType.SeaEvent,
'Nuclear Power Plant': MeteoalarmEventType.Unknown,
'Radiological Hazard': MeteoalarmEventType.Unknown,
'Red Flag': MeteoalarmEventType.ForestFire,
'Rip Current': MeteoalarmEventType.CoastalEvent,
'River Flood': MeteoalarmEventType.Flooding,
'Severe Thunderstorm': MeteoalarmEventType.Thunderstorms,
'Severe Weather': MeteoalarmEventType.Unknown,
'Shelter In Place': MeteoalarmEventType.Unknown,
'Short Term': MeteoalarmEventType.Unknown,
'Small Craft': MeteoalarmEventType.Wind,
'Small Stream Flood': MeteoalarmEventType.Flooding,
'Snow Squall': MeteoalarmEventType.SnowIce,
'Special Marine': MeteoalarmEventType.SeaEvent,
'Special Weather': MeteoalarmEventType.Unknown,
'Storm Surge': MeteoalarmEventType.CoastalEvent,
'Storm': MeteoalarmEventType.Thunderstorms,
'Tornado': MeteoalarmEventType.Tornado,
'Tropical Depression Local': MeteoalarmEventType.Hurricane,
'Tropical Storm Local': MeteoalarmEventType.Hurricane,
'Tropical Storm': MeteoalarmEventType.Hurricane,
'Tsunami': MeteoalarmEventType.Tsunami,
'Typhoon Local': MeteoalarmEventType.Hurricane,
'Typhoon': MeteoalarmEventType.Hurricane,
'Urban And Small Stream Flood': MeteoalarmEventType.Flooding,
'Volcano': MeteoalarmEventType.Volcano,
'Wind': MeteoalarmEventType.Wind,
'Wind Chill': MeteoalarmEventType.LowTemperature,
'Winter Storm': MeteoalarmEventType.SnowIce,
'Winter Weather': MeteoalarmEventType.SnowIce,

Event Levels

'Warning': MeteoalarmEventType.Red,
'Watch': MeteoalarmEventType.None,
'Statement': MeteoalarmEventType.Yellow,
'Advisory': MeteoalarmEventType.Yellow,
'Warning': MeteoalarmEventType.Red,
'Watch': MeteoalarmEventType.Orange,
'Statement': MeteoalarmEventType.Orange,
'Immediate': MeteoalarmEventType.Red,
'Danger': MeteoalarmEventType.Red,
'Outlook': MeteoalarmEventType.Yellow,
'Forecast': MeteoalarmEventType.None,

Additional context
I started from the realization that the Hydrologic Outlook in my area was not handled properly and I ended up going down a massive rabbit hole. I feel like the feature is 90% there but I honestly don't know and understand the codebase enough to know if the remaining 10% is within my reach, therefore instead of a PR here is a feature request with hopefully most of the leg work done.

I grabbed and cleaned a list of possible event types from the weather.gov website and provided the spreadsheet that I used for most of the string manipulations.

Here are the steps I performed:

  • from https://alerts.weather.gov/search I extracted all the possible event drop-down options
    image

  • extracted the list of options from the page HTML, cleaned and imported all the event options in the attached spreadsheet.

  • I think the weatheralert.ts code assumes that the last word is the alert level and so I based my data manipulation on this assumption. this leaves out some edge cases that I did not handle. Maybe someone with more understanding of the code can provide a solution also for these few edge cases.

  • in the spreadsheet attached I did some data manipulation to extract the alert type and level
    weatheralerts event types and levels.xlsx

  • finally, I attempted to map it to the existing MeteoalarmEventType and MeteoalarmLevelType

Please let me know if there are any questions.

@inguy24
Copy link
Contributor

inguy24 commented Mar 22, 2024

Great job @andrea-fantini ! So I was working on the same thing but you beat me to it! FYI There is official documentation of the NOAA CAP standards for emergency alerts at:
NOAA CAP

Here are some minor suggestions to tweaks to your list and to the associated MeteoalarmEventType:

  • Add 'Blue' {This is a law enforcement alert) MeteoalarmEventType.Unknown
  • 'Beach Hazard' should be corrected to be 'Beach Hazards' which is why it throws the error.
  • 'Freezing Spray' and 'Heavy Freezing Spray' should be MeteoalarmEventType.SeaEvent (This is for marine vessels)
  • 'Lake Wind' should be MeteoalarmEventType.SeaEvent (it is also for vessels, although that could be argued either way)
  • 'Low Water' advisory should be MeteoalarmEventType.SeaEvent (as it is for vessels alerting them to navigation issues)
  • 'Small Craft" should be MeteoalarmEventType.SeaEvent (as this is a warning for vessels)
  • 'Storm' should be MeteoalarmEventType.SeaEvent (as this is a warning for vessels)
  • Add 'Tropical Cyclone' with MeteoalarmEventType.Hurricane

For Event Levels, there also needs to be additions for:

  • Emergency (suggest Red)
  • Alert (suggest Yellow)

You were able to capture some of the codes that actually aren't standards which is great. Apparently some NWS offices are not complying with the CAP standards... but go figure.

@MrBartusek
Copy link
Owner

Thank you @andrea-fantini and @inguy24 for great reaserch! I've closed all of the duplicate issues with weatheralerts and they are now pointing here. I will try to implement your finding in #250 and we will see how much coverage it will have.

@MrBartusek
Copy link
Owner

I think the weatheralert.ts code assumes that the last word is the alert level and so I based my data manipulation on this assumption. this leaves out some edge cases that I did not handle. Maybe someone with more understanding of the code can provide a solution also for these few edge cases.

Yes, that's indeed the case. It's how we determine the event level (yellow / orange / red). There are some edge cases I've tried to fix. I've come up with new event-level mapping:

return {
	Warning: MeteoalarmLevelType.Red,
	Statement: MeteoalarmLevelType.Orange,
	Watch: MeteoalarmLevelType.Orange,
	Advisory: MeteoalarmLevelType.Yellow,
	Alert: MeteoalarmLevelType.Yellow,

	Emergency: MeteoalarmLevelType.Red, // Local Area Emergency
	Danger: MeteoalarmLevelType.Red, // Extreme Fire Danger
	Message: MeteoalarmLevelType.Orange, //Civil Emergency Message
	Outage: MeteoalarmLevelType.Orange, // 911 Telephone Outage.
};

I think it should cover all of these pesky events that don't fit into a standard warning, watch, statement, or advisory schema. Did you find any other edge cases that've missed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants