Implement air quality forecasts alerts from Weather Canada
Weather Canada provides an API for general air quality, on a scale from 1 to 10.
Rendered on their website, it looks like:
https://meteo.gc.ca/airquality/pages/nextHourlies/qcaq-001_f.html
The API call for the Montreal forecast on 2023-08-10 18:00 EST, made on 2023-08-10 06:00 EST would be:
It seems they make forecasts twice per day, at 1000 UTC and 2100 UTC.
The date string at the end has time in UTC.
The JSON dump looks like this:
{
"type": "Feature",
"id": "AQ_FCST-EHHUN-202308102200-202308101000",
"geometry": {
"type": "Point",
"coordinates": [
-73.65,
45.5166666666667
]
},
"properties": {
"id": "AQ_FCST-EHHUN-202308102200-202308101000",
"aqhi_type": "AQHI-Forecast",
"forecast_type": "original",
"location_name_en": "Montréal",
"location_name_fr": "Montréal",
"location_id": "EHHUN",
"publication_datetime": "2023-08-10T10:00:00Z",
"forecast_datetime_text_en": "6:00 PM EDT Thursday 10 August 2023",
"forecast_datetime_text_fr": "6h00 PM HAE jeudi 10 août 2023",
"forecast_datetime": "2023-08-10T22:00:00Z",
"aqhi": 2
},
"links": [
{
"rel": "self",
"type": "application/geo+json",
"title": "This document as GeoJSON",
"href": "https://api.weather.gc.ca/collections/aqhi-forecasts-realtime/items/AQ_FCST-EHHUN-202308102200-202308101000?f=json"
},
{
"rel": "alternate",
"type": "application/ld+json",
"title": "This document as RDF (JSON-LD)",
"href": "https://api.weather.gc.ca/collections/aqhi-forecasts-realtime/items/AQ_FCST-EHHUN-202308102200-202308101000?f=jsonld"
},
{
"rel": "alternate",
"type": "text/html",
"title": "This document as HTML",
"href": "https://api.weather.gc.ca/collections/aqhi-forecasts-realtime/items/AQ_FCST-EHHUN-202308102200-202308101000?f=html"
},
{
"rel": "collection",
"type": "application/json",
"title": "Air Quality Health Index – Forecasts",
"href": "https://api.weather.gc.ca/collections/aqhi-forecasts-realtime"
}
]
}