Every live weather response produced by ClimApp includes anDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/adrianaarang/climapp/llms.txt
Use this file to discover all available pages before exploring further.
alertas field — a list of string labels that flag conditions outside safe operating thresholds. The labels are generated by AlertService immediately after normalization, so every consumer of the /api/clima endpoint automatically receives alert context alongside the raw readings.
How it works
AlertService.evaluar_alertas() is called inside normalizar_datos_aemet() after every AEMET API fetch. It receives the fully normalized weather dictionary, validates it, and returns a list of zero or more string labels. That list is then attached to the response under the alertas key before the data leaves the service layer.
The method follows two evaluation passes:
- Temperature — evaluated as a mutually exclusive hierarchy. Only the highest-severity temperature alert fires; lower-severity temperature alerts are skipped if a higher one matches.
- Wind, rain, and humidity — evaluated independently. Each condition is checked on its own, and any combination of these three alerts can be active simultaneously.
Alert thresholds
ROJA — critical heat (temperatura ≥ 40.0 °C)
ROJA — critical heat (temperatura ≥ 40.0 °C)
Triggered when air temperature reaches or exceeds 40 °C. This is the highest-severity temperature alert. When
ROJA is active, NARANJA is suppressed.NARANJA — heat warning (temperatura ≥ 35.0 °C)
NARANJA — heat warning (temperatura ≥ 35.0 °C)
Triggered when air temperature is between 35 °C and 39.9 °C. Suppressed if
ROJA is already active. Not triggered when temperature is also at or above 40 °C.HELADA — frost (temperatura ≤ 0.0 °C)
HELADA — frost (temperatura ≤ 0.0 °C)
Triggered when air temperature is at or below 0 °C. Mutually exclusive with heat alerts — only one temperature alert can be active at a time.
VIENTO_FUERTE — strong wind (viento > 70.0 km/h)
VIENTO_FUERTE — strong wind (viento > 70.0 km/h)
Triggered when wind speed exceeds 70 km/h. Independent of temperature alerts; can appear alongside
ROJA, NARANJA, HELADA, or no temperature alert.LLUVIA_INTENSA — intense rain (lluvia > 30.0 mm)
LLUVIA_INTENSA — intense rain (lluvia > 30.0 mm)
Triggered when precipitation exceeds 30 mm. Independent of all other alerts and can stack freely.
HUMEDAD_ALTA — high humidity (humedad ≥ 90%)
HUMEDAD_ALTA — high humidity (humedad ≥ 90%)
Triggered when relative humidity reaches or exceeds 90%. Independent of all other alerts and can stack freely.
Temperature alert hierarchy
Temperature alerts are exclusive — at most one temperature label appears in the response at any given time. The order of precedence from highest to lowest is:ROJA and HELADA cannot occur together because they represent opposite ends of the temperature scale. NARANJA is skipped when ROJA fires because the elif chain in evaluar_alertas() only advances to the next condition if the previous one was false.
Wind, rain, and humidity alerts have no such constraint. A reading can simultaneously carry NARANJA, VIENTO_FUERTE, and HUMEDAD_ALTA if all three thresholds are exceeded.
Integration
Alerts are embedded in the normalized data JSON response under thealertas key. Any code that consumes /api/clima — including the ClimApp dashboard and the comparison view — receives the alert list without any additional API calls.
temperatura of 38.5 °C triggers NARANJA (≥ 35 °C but < 40 °C), and viento of 80 km/h triggers VIENTO_FUERTE (> 70 km/h). No rain or humidity alerts fire because both values are below their respective thresholds.
Validation gate
Before any threshold check runs,evaluar_alertas() calls validate_weather_data(). If validation fails — for example because a required field is missing or a value cannot be converted to a number — the method returns an empty list [] immediately. This prevents invalid data from producing misleading alerts and ensures the response is always safe to consume.