jeafreezy / workshops

0 stars 0 forks source link

Which Air Quality API to use? #1

Closed jeafreezy closed 2 weeks ago

jeafreezy commented 1 month ago

Research on the free and easy to setup (i.e easy for the users to setup on the workshop day), air quality API .

jeafreezy commented 1 month ago

I also need to decide on the information the dashboard will communicate. It should easy.

jeafreezy commented 1 month ago

Decision: World Air Quality Index API Doc: https://aqicn.org/json-api/doc/

Why?

  1. It's free with a 1000 request/second limit.
  2. It has the endpoint to retrieve station data and support coordinate queries. Although it doesn't provide a distance query I can use the map bounds to retrieve stations.
  3. It provides forecast information.
  4. It is realtime. i.e it does not support date filters. This means that if I pool every minute, it returns fresh data.
  5. It provides the raw measurement values.

OpenWeatherMap would have been a great alternative, but I could not find the stations list endpoint anywhere, and it's necessary.

Sample response:

{
"status": "ok",
"data": {
"aqi": 24,
"idx": 14196,
"attributions": [
{
"url": "http://www20.gencat.cat/portal/site/mediambient/",
"name": "Medi Ambient. Generalitat de Catalunya",
"logo": "Spain-Catalunya.png"
},
{
"url": "http://www.eea.europa.eu/themes/air/",
"name": "European Environment Agency",
"logo": "Europe-EEA.png"
},
{
"url": "https://waqi.info/",
"name": "World Air Quality Index Project"
}
],
"city": {
"geo": [
41.058212,
0.43969983
],
"name": "Gandesa, Catalunya, Spain",
"url": "https://aqicn.org/city/spain/catalunya/gandesa",
"location": ""
},
"dominentpol": "o3",
"iaqi": {
"co": {
"v": 0.1
},
"h": {
"v": 61.6
},
"no2": {
"v": 0.5
},
"o3": {
"v": 24
},
"p": {
"v": 1008
},
"pm10": {
"v": 7
},
"pm25": {
"v": 17
},
"t": {
"v": 22.5
},
"w": {
"v": 3.3
},
"wg": {
"v": 5
}
},
"time": {
"s": "2024-10-02 09:00:00",
"tz": "+02:00",
"v": 1727859600,
"iso": "2024-10-02T09:00:00+02:00"
},
"forecast": {
"daily": {
"o3": [
{
"avg": 12,
"day": "2024-09-30",
"max": 20,
"min": 6
},
{
"avg": 11,
"day": "2024-10-01",
"max": 20,
"min": 7
},
{
"avg": 7,
"day": "2024-10-02",
"max": 11,
"min": 6
},
{
"avg": 14,
"day": "2024-10-03",
"max": 17,
"min": 5
},
{
"avg": 15,
"day": "2024-10-04",
"max": 20,
"min": 12
},
{
"avg": 11,
"day": "2024-10-05",
"max": 18,
"min": 7
},
{
"avg": 9,
"day": "2024-10-06",
"max": 14,
"min": 7
},
{
"avg": 12,
"day": "2024-10-07",
"max": 12,
"min": 10
}
],
"pm10": [
{
"avg": 17,
"day": "2024-09-30",
"max": 26,
"min": 9
},
{
"avg": 18,
"day": "2024-10-01",
"max": 23,
"min": 12
},
{
"avg": 7,
"day": "2024-10-02",
"max": 21,
"min": 2
},
{
"avg": 4,
"day": "2024-10-03",
"max": 6,
"min": 2
},
{
"avg": 8,
"day": "2024-10-04",
"max": 9,
"min": 6
},
{
"avg": 12,
"day": "2024-10-05",
"max": 17,
"min": 8
},
{
"avg": 27,
"day": "2024-10-06",
"max": 37,
"min": 17
},
{
"avg": 36,
"day": "2024-10-07",
"max": 38,
"min": 36
}
],
"pm25": [
{
"avg": 32,
"day": "2024-09-30",
"max": 47,
"min": 19
},
{
"avg": 34,
"day": "2024-10-01",
"max": 49,
"min": 18
},
{
"avg": 16,
"day": "2024-10-02",
"max": 46,
"min": 7
},
{
"avg": 9,
"day": "2024-10-03",
"max": 17,
"min": 3
},
{
"avg": 23,
"day": "2024-10-04",
"max": 28,
"min": 13
},
{
"avg": 33,
"day": "2024-10-05",
"max": 43,
"min": 26
},
{
"avg": 53,
"day": "2024-10-06",
"max": 62,
"min": 40
},
{
"avg": 62,
"day": "2024-10-07",
"max": 64,
"min": 62
}
],
"uvi": [
{
"avg": 0,
"day": "2024-09-30",
"max": 5,
"min": 0
},
{
"avg": 0,
"day": "2024-10-01",
"max": 5,
"min": 0
},
{
"avg": 0,
"day": "2024-10-02",
"max": 4,
"min": 0
},
{
"avg": 0,
"day": "2024-10-03",
"max": 4,
"min": 0
},
{
"avg": 0,
"day": "2024-10-04",
"max": 5,
"min": 0
},
{
"avg": 0,
"day": "2024-10-05",
"max": 5,
"min": 0
},
{
"avg": 1,
"day": "2024-10-06",
"max": 5,
"min": 0
}
]
}
},
"debug": {
"sync": "2024-10-02T16:20:17+09:00"
}
}
}
jeafreezy commented 2 weeks ago

Done.