Indicator
Represents ESIOS indicator metadata.
Unique identifier for the indicator
Full name of the indicator
Short name or abbreviation for the indicator
Detailed description of what the indicator measures
raw
dict[str, Any]
default:"{}"
Raw API response data (excluded from serialization)
Methods
from_api
@classmethod
def from_api(cls, data: dict[str, Any]) -> Indicator
Builds an Indicator instance from raw API JSON response.
Parameters:
data (dict): The raw indicator object from the ESIOS API response
Returns:
Indicator: Parsed indicator instance
Example:
from esios.models.indicator import Indicator
api_data = {
"id": 1001,
"name": "PVPC 2.0 TD",
"short_name": "PVPC",
"description": "Precio voluntario para el pequeño consumidor 2.0 TD"
}
indicator = Indicator.from_api(api_data)
print(indicator.id) # 1001
print(indicator.name) # "PVPC 2.0 TD"
IndicatorValue
Represents a single data point from an indicator time series.
The numeric value of the data point
Timestamp of the data point in local time
datetime_utc
datetime | None
default:"None"
Timestamp of the data point in UTC
Timezone identifier for the data point
Geographic identifier for the data point
Geographic name/region for the data point
Example:
from datetime import datetime
from esios.models.indicator import IndicatorValue
value = IndicatorValue(
value=0.12345,
datetime=datetime(2024, 1, 15, 10, 0),
datetime_utc=datetime(2024, 1, 15, 9, 0),
tz_time="Europe/Madrid",
geo_id=3,
geo_name="Peninsula"
)
print(f"Price: {value.value} at {value.datetime}")