Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/elenacarino-max/mas-climapp/llms.txt

Use this file to discover all available pages before exploring further.

ClimApp lets you record your own meteorological readings through a dedicated form at /registro. This is designed for users with home weather stations or anyone who wants to log field observations and later compare them against official AEMET data.

How to log a measurement

Navigate to /registro in your browser. The form accepts the following fields:

Fecha

Date of the measurement. The system accepts DD/MM/YYYY, DD-MM-YYYY, and YYYY-MM-DD formats.

Municipio

The municipality name where the measurement was taken (e.g., Madrid).

Estación AEMET

The AEMET station ID associated with your location. This links your record to the nearest official station for future comparisons.

Temperatura

Air temperature in °C. Must be between -50 and 60.

Humedad

Relative humidity as a percentage. Must be between 0 and 100.

Viento

Wind speed in km/h. Must be 0 or greater.

Lluvia

Precipitation in mm. Must be 0 or greater.

Validation rules

Before any record is saved, every field passes through the validation layer in utils/validators.py. Submitting a record that fails any of these checks causes the entire record to be rejected — nothing is persisted.
FieldRule
fechaMust be a parseable date in a recognised format
temperaturaMust be a number between -50 and 60 (°C)
humedadMust be a number between 0 and 100 (%)
vientoMust be a number ≥ 0 (km/h)
lluviaMust be a number ≥ 0 (mm)

Where your record is saved

Valid records are written to two separate storage layers:
1

JSON file

The record is appended to data/registros_climaticos.json. This file is used by the history and comparison features to filter and retrieve records quickly.
2

SQLite database

A second copy is saved to clima.db through the repository layer, providing a relational backup for longer-term storage and potential future queries.

Example record

A valid manual entry looks like this once it is stored:
{
  "estacion_id": "3129",
  "fecha": "07/05/2026",
  "temperatura": 21.5,
  "humedad": 55.0,
  "viento": 12.0,
  "lluvia": 0.0,
  "municipio": "Madrid",
  "fuente": "manual"
}
The fuente field is always set to "manual" for user-submitted records. This tag distinguishes them from automatically saved AEMET readings (tagged "aemet") when filtering the history or running a comparison.

Alert evaluation

After validation, the record is passed through AlertService before it is saved. If any thresholds are exceeded, the API response includes a list of alert codes:
{
  "status": "success",
  "message": "Registro guardado con éxito",
  "alertas": ["NARANJA_CALOR"],
  "municipio": "Madrid"
}
If no thresholds are exceeded, alertas contains ["VERDE"].
Records that fail validation are rejected entirely and not saved to either the JSON file or the database. Double-check your values before submitting, especially temperature (must be between -50 °C and 60 °C) and humidity (must be between 0 % and 100 %).

Build docs developers (and LLMs) love