Listing your historical forecasts¶
This section provides an example of how to preview the historical forecasts you initially submitted into the platform.
Important
- The data is provided at a 15-minute resolution, resulting in a large volume of samples. Therefore, pagination (Limit/Offset Strategy) is required to retrieve all data properly.
API Endpoints:¶
To interact with the Predicto API and retrieve information about your historical forecasts available in the platform, you can use the following endpoints:
- GET
/api/v1/data/individual-forecasts/historical
- Retrieve your forecasted time-series for a specific submission or challenge.
Access Token Required
An access token must be included in the Authorization
header of your request. If you haven't obtained an access token yet, please refer to the Authentication section.
Check this out
Check our Useful Links section for additional resources (Jupyter Notebook, API Specifications) to help you get started with the Predico platform.
Specify a resource to download data for¶
If you do not know a resource identifier (UUID), you can retrieve it from current or previous challenges (see Listing Challenges section.)
# Specify a resource ID (UUID) to download historical forecasts data
resource_id = "ba7203df-0618-4001-a2e9-b0a11cc477f9"
Retrieving Historical Forecasts for this resource¶
Retrieve the raw data for the selected resource:
# Download historical forecasts data for this resource:
start_date = "2024-06-01T00:00:00Z"
end_date = "2025-06-01T00:00:00Z"
params = {
"resource": resource_id,
"start_date": start_date,
"end_date": end_date
}
# Download data:
next_url = "https://predico-elia.inesctec.pt/api/v1/data/individual-forecasts/historical"
dataset = []
# -- Note: This will stop once all the samples are retrieved.
# -- next_url indicates the URL of the next page (pagination) to be requested)
while next_url is not None:
print(f"Requesting data...\n{next_url}") # This may take a while
response = requests.get(url=next_url, params=params, headers=headers)
dataset += response.json()["data"]["results"]
next_url = response.json()["data"]["next"]
# -- Note: This will stop once all the samples are retrieved.
print("-"*79)
print(f"Retrieved {len(dataset)} records")
print(f"Historical forecasts (first 10 records preview):")
print(dataset[:10])
JSON Example Response¶
After running the example script, you will have access your historical forecasted time-series.
If no data is received, please confirm if you are requesting data for the right challenge and/or resource identifier.
Warning
- You will not have access to your submissions via this endpoint, just the initial historical forecasts upload.
- To access your submitted forecasts (to challenges), please refer to the Listing Submissions section.
Click to view Example Response
{
"code": 200,
"data": {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"datetime": "2024-06-20T00:00:00Z",
"launch_time": "2024-06-24T09:00:00Z",
"variable": "q90",
"value": 0.101,
"registered_at": "2024-06-24T09:00:43.430995Z"
},
{
"datetime": "2024-06-20T00:00:00Z",
"launch_time": "2024-06-24T12:15:00Z",
"variable": "q10",
"value": 0.776,
"registered_at": "2024-06-24T12:17:54.804330Z"
}
]
}
}