Skip to content

FE friendly API for the weather data page #68

Description

@mateo-budanovic-vlf

To get the full weather data for a parcel a minimum of 4 API calls are necessary. Two of these APIs are straightforward (api/data/forecast5/ and api/data/spray-forecast/), but the third weather data api (api/data/flight-forecast5/) depends on an API from the farm calendar (api/v1/AgriculturalMachines/) and is unwieldy as a result.
This will cause major performance issues via overloading the gatekeeper with requests, thus a more centralized approach would benefit the system.
My proposed solution is to create an API that handles all of the fetching and data parsing on the backend, and returns a response that is more robust for the frontend. A response such as this would work best:

{
    "2025-09-26": {
        "12:00:00": {
            "ambient_temperature": 36.19,
            "ambient_humidity": 19,
            "wind_speed": 7.79,
            "wind_direction": 289
        },
        "15:00:00": {
            "ambient_temperature": 33.46,
            "ambient_humidity": 23,
            "wind_speed": 5.27,
            "wind_direction": 307
        },
        "18:00:00": {
            "ambient_temperature": 27.76,
            "ambient_humidity": 44,
            "wind_speed": 1.54,
            "wind_direction": 345
        },
        "21:00:00": {
            "ambient_temperature": 27.95,
            "ambient_humidity": 35,
            "wind_speed": 2.07,
            "wind_direction": 13
        }
    },
    "2025-09-27": {
        "00:00:00": {
            "ambient_temperature": 26.4,
            "ambient_humidity": 34,
            "wind_speed": 0.94,
            "wind_direction": 319
        },
        "03:00:00": {
            "ambient_temperature": 25.06,
            "ambient_humidity": 40,
            "wind_speed": 0.59,
            "wind_direction": 297
        },
        "06:00:00": {
            "ambient_temperature": 31.91,
            "ambient_humidity": 21,
            "wind_speed": 0.64,
            "wind_direction": 316
        },
        "09:00:00": {
            "ambient_temperature": 37.45,
            "ambient_humidity": 13,
            "wind_speed": 4.67,
            "wind_direction": 298
        },
        "12:00:00": {
            "ambient_temperature": 38.21,
            "ambient_humidity": 14,
            "wind_speed": 8.17,
            "wind_direction": 294
        },
        "15:00:00": {
            "ambient_temperature": 33.38,
            "ambient_humidity": 20,
            "wind_speed": 5.51,
            "wind_direction": 307
        },
        "18:00:00": {
            "ambient_temperature": 28.88,
            "ambient_humidity": 32,
            "wind_speed": 0.76,
            "wind_direction": 335
        },
        "21:00:00": {
            "ambient_temperature": 28.44,
            "ambient_humidity": 31,
            "wind_speed": 1.35,
            "wind_direction": 19
        }
    },
    "2025-09-28": {
        "00:00:00": {
            "ambient_temperature": 27.86,
            "ambient_humidity": 29,
            "wind_speed": 1.47
        },
        "03:00:00": {
            "ambient_temperature": 27.8,
            "ambient_humidity": 27,
            "wind_speed": 1.68,
            "wind_direction": 21
        },
        "06:00:00": {
            "ambient_temperature": 35.29,
            "ambient_humidity": 15,
            "wind_speed": 0.61,
            "wind_direction": 52
        },
        "09:00:00": {
            "ambient_temperature": 41.12,
            "ambient_humidity": 11,
            "wind_speed": 4.75,
            "wind_direction": 286
        },
        "12:00:00": {
            "ambient_temperature": 41.48,
            "ambient_humidity": 12,
            "wind_speed": 10.97,
            "wind_direction": 293
        },
        "15:00:00": {
            "ambient_temperature": 34.61,
            "ambient_humidity": 20,
            "wind_speed": 4.76,
            "wind_direction": 311
        },
        "18:00:00": {
            "ambient_temperature": 30.3,
            "ambient_humidity": 30,
            "wind_speed": 0.35,
            "wind_direction": 202
        },
        "21:00:00": {
            "ambient_temperature": 28.84,
            "ambient_humidity": 35,
            "wind_speed": 0.23,
            "wind_direction": 260
        }
    },
    "2025-09-29": {
        "00:00:00": {
            "ambient_temperature": 30.18,
            "ambient_humidity": 26,
            "wind_speed": 2.09,
            "wind_direction": 41
        },
        "03:00:00": {
            "ambient_temperature": 29.91,
            "ambient_humidity": 21,
            "wind_speed": 0.82,
            "wind_direction": 46
        },
        "06:00:00": {
            "ambient_temperature": 37.68,
            "ambient_humidity": 12,
            "wind_speed": 0.78,
            "wind_direction": 5
        },
        "09:00:00": {
            "ambient_temperature": 41.95,
            "ambient_humidity": 10,
            "wind_speed": 5.63,
            "wind_direction": 239
        },
        "12:00:00": {
            "ambient_temperature": 38.53,
            "ambient_humidity": 25,
            "wind_speed": 7.9,
            "wind_direction": 260
        },
        "15:00:00": {
            "ambient_temperature": 34.23,
            "ambient_humidity": 30,
            "wind_speed": 2.93,
            "wind_direction": 277
        },
        "18:00:00": {
            "ambient_temperature": 31.32,
            "ambient_humidity": 36,
            "wind_speed": 0.7,
            "wind_direction": 35
        },
        "21:00:00": {
            "ambient_temperature": 29.07,
            "ambient_humidity": 43,
            "wind_speed": 0.67,
            "wind_direction": 199
        }
    },
    "2025-09-30": {
        "00:00:00": {
            "ambient_temperature": 28.09,
            "ambient_humidity": 46,
            "wind_speed": 0.97,
            "wind_direction": 215
        },
        "03:00:00": {
            "ambient_temperature": 27.59,
            "ambient_humidity": 43,
            "wind_speed": 0.74,
            "wind_direction": 111
        },
        "06:00:00": {
            "ambient_temperature": 35.61,
            "ambient_humidity": 20,
            "wind_speed": 1.02,
            "wind_direction": 255
        },
        "09:00:00": {
            "ambient_temperature": 40.57,
            "ambient_humidity": 15,
            "wind_speed": 5.91,
            "wind_direction": 273
        },
        "12:00:00": {
            "ambient_temperature": 39.14,
            "ambient_humidity": 24,
            "wind_speed": 8.48,
            "wind_direction": 273
        },
        "15:00:00": {
            "ambient_temperature": 34.5,
            "ambient_humidity": 29,
            "wind_speed": 4.18,
            "wind_direction": 280
        },
        "18:00:00": {
            "ambient_temperature": 29.92,
            "ambient_humidity": 45,
            "wind_speed": 0.58,
            "wind_direction": 219
        },
        "21:00:00": {
            "ambient_temperature": 28.22,
            "ambient_humidity": 55,
            "wind_speed": 1.52,
            "wind_direction": 200
        }
    },
    "2025-10-01": {
        "00:00:00": {
            "ambient_temperature": 26.7,
            "ambient_humidity": 62,
            "wind_speed": 1.08,
            "wind_direction": 221
        },
        "03:00:00": {
            "ambient_temperature": 26.31,
            "ambient_humidity": 57,
            "wind_speed": 0.51,
            "wind_direction": 140
        },
        "06:00:00": {
            "ambient_temperature": 34.07,
            "ambient_humidity": 28,
            "wind_speed": 1.56,
            "wind_direction": 269
        },
        "09:00:00": {
            "ambient_temperature": 39.47,
            "ambient_humidity": 17,
            "wind_speed": 4.86,
            "wind_direction": 285
        }
    }
}

This is an example of how the api/data/forecast5/ API is formatted for the frontend table. Additional fields for the spray forecast and the UAV models would need to be added into the time objects.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions