Dataset Records
The dataset_records table stores individual data records within datasets, designed for columnar storage.
Table Schema
| Column Name | Data Type | Description |
|---|---|---|
id |
UUID |
Primary Key. Unique identifier for the dataset record. |
timestamp |
TIMESTAMP |
Timestamp of the record. |
collection_date |
DATE |
The date when the data was collected. |
dataset_id |
UUID |
Foreign key referencing the dataset. |
dataset_name |
String(255) |
The name of the dataset. |
dataset_data |
JSONB |
Additional JSONB data for the dataset. |
experiment_id |
UUID |
Foreign key referencing the experiment. |
experiment_name |
String(255) |
The name of the experiment. |
season_id |
UUID |
Foreign key referencing the season. |
season_name |
String(255) |
The name of the season. |
site_id |
UUID |
Foreign key referencing the site. |
site_name |
String(255) |
The name of the site. |
record_file |
String(255) |
The file where the record is stored. |
record_info |
JSONB |
Additional JSONB data for the record. |
Constraints and Indexes
- Unique Constraint: A
UniqueConstraintontimestamp,collection_date,dataset_id,dataset_name,experiment_id,experiment_name,season_id,season_name,site_id, andsite_nameensures uniqueness for each record. - GIN Index: A GIN index named
idx_dataset_records_record_infois applied to therecord_infocolumn to optimize queries on the JSONB data.
Methods
filter_records: A class method that allows filtering dataset records based on various parameters such asstart_timestamp,end_timestamp,dataset_names,experiment_names,season_names, andsite_names. This method leverages a PostgreSQL functiongemini.filter_dataset_recordsfor efficient filtering.