> ## Documentation Index
> Fetch the complete documentation index at: https://docs-beta.rebase.energy/llms.txt
> Use this file to discover all available pages before exploring further.

# Datasets

> Store and manage your energy data with timeseries and geospatial datasets

## Understanding datasets

Datasets are the foundation of your energy dashboards - they store all your data whether it's wind turbine locations, energy production over time, or weather measurements. The Rebase Dashboard API supports two main types of datasets, each optimized for different use cases and providing powerful data management capabilities.

## Dataset types

### Timeseries datasets

Perfect for data that changes over time - energy production, consumption, prices, and other time-based metrics.

```python theme={null}
# Create a timeseries dataset for energy production
timeseries_dataset = client.datasets.create_timeseries_static(
    name="Wind Farm Production",
    data=[
        {"timestamp": "2024-01-01T00:00:00Z", "value": 45.2},
        {"timestamp": "2024-01-01T01:00:00Z", "value": 52.1},
        {"timestamp": "2024-01-01T02:00:00Z", "value": 48.7}
    ],
    description="Hourly energy production from North Sea Wind Farm",
    metadata={
        "unit": "MW",
        "country": "Netherlands"
    }
)
```

**Key features:**

* Automatic timestamp parsing and indexing
* Single value per timestamp (multiple metrics not supported)
* Optimized for time-based queries and visualizations
* Perfect for ECharts timeseries components

### Geospatial datasets

For location-based data like wind turbines, solar panels, or power plants.

```python theme={null}
# Create a geospatial dataset for wind turbines
geospatial_dataset = client.datasets.create_geospatial_static(
    name="Wind Turbine Locations",
    data=[
        {
            "position": [3.5, 55.2],
            "properties": {
                "turbine_id": "T001",
                "capacity_mw": 8.0,
                "status": "operational",
                "installation_date": "2023-06-15"
            }
        },
        {
            "position": [3.6, 55.3],
            "properties": {
                "turbine_id": "T002",
                "capacity_mw": 8.0,
                "status": "maintenance",
                "installation_date": "2023-06-20"
            }
        }
    ],
    geometry_type="point",
    description="Offshore wind turbines in the North Sea"
)
```

**Key features:**

* Geographic indexing for fast spatial queries
* Support for point, line, and polygon geometries
* Perfect for map layers and spatial analysis
* Can include additional properties for each location

## Live datasets

Connect to external APIs for real-time data updates and automatic synchronization.

```python theme={null}
# Create a live dataset that fetches from an external API
live_dataset = client.datasets.create_timeseries_live(
    name="Live Energy Prices",
    url="https://api.energy-exchange.com/prices",
    params={
        "start": "{start}",  # These get replaced with actual timestamps
        "end": "{end}",
        "market": "DK1"
    },
    data_format="json",  # or "csv"
    aliases={
        "time": "timestamp",  # Map API column names to expected format
        "price_eur_mwh": "value"
    },
    headers={
        "Authorization": "Bearer your-api-key"
    },
    datetime_format="%Y-%m-%dT%H:%M",  # Optional: custom datetime format
    description="Real-time electricity prices from European markets",
    metadata={
        "unit": "EUR/MWh",
        "market": "DK1",
        "data_source": "energy_exchange"
    }
)
```

**Key Features:**

* **URL with params**: The url is your external API endpoint, and params can use `{start}` and `{end}` placeholders that get replaced with actual timestamps when fetching data
* **Column mapping**: Use aliases to map your API's column names to the expected timestamp and value format
* **Flexible formats**: Supports both JSON and CSV responses
* **Custom datetime formatting**: If your API needs a specific datetime format, you can specify it with `datetime_format`
* **Headers**: Add authentication or other headers as needed

**Limitations:**

* Column mapping is limited to `timestamp` and `value` fields only
* Start and end parameters are required when fetching data
* Only JSON and CSV formats are supported

## Working with datasets

### Retrieving datasets

```python theme={null}
# Get all your datasets
datasets = client.datasets.list_datasets()

# Get a specific dataset
dataset = client.datasets.get_dataset(dataset_id)
```

### Updating datasets

```python theme={null}
# Update dataset metadata (name, description, metadata only)
updated_dataset = client.datasets.update_dataset(
    dataset_id,
    name="Updated Wind Farm Production",
    description="Enhanced production data with maintenance info"
)
```

### Deleting datasets

```python theme={null}
# Delete a dataset (use with caution!)
client.datasets.delete_dataset(dataset_id)
```

## Important Limitations

* **Static datasets**: Time filtering is not supported for static timeseries datasets
* **Live datasets**: Both `start` and `end` parameters are required when fetching data
* **Data updates**: You can only update dataset metadata (name, description, metadata). The actual data cannot be modified after creation
* **Column mapping**: Live datasets only support mapping to `timestamp` and `value` columns
* **Single value per timestamp**: Only one value per timestamp is supported in timeseries datasets

## Best practices

### Data organization

* Use descriptive names and descriptions
* Include relevant metadata in your data
* Structure your data consistently
* Consider data volume and update frequency

### Performance optimization

* Use appropriate data types for your use case
* Index frequently queried fields
* Consider data compression for large datasets
* Use live datasets sparingly for real-time needs

### Data quality

* Validate data before uploading
* Include data source information
* Document data transformations
* Monitor data freshness and accuracy

## Next steps

Now that you understand datasets, learn how to visualize them:

<CardGroup cols={2}>
  <Card title="Map Layers" icon="map" href="/essentials/layers">
    Visualize geospatial data on interactive maps.
  </Card>

  <Card title="Timeseries Components" icon="chart-line" href="/essentials/components">
    Create charts and graphs from timeseries data.
  </Card>

  <Card title="Live Data Integration" icon="bolt" href="/essentials/live-data">
    Connect to external APIs for real-time updates.
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Explore all dataset endpoints and options.
  </Card>
</CardGroup>
