pixano.app.models.dataset_items
DatasetItemModel(**data)
Bases: BaseModel
DatasetItem model.
It represents a dataset item with its associated entities, annotations and views.
The mappings consist of the table name as key and the corresponding model or list of models as value.
Attributes:
Name | Type | Description |
---|---|---|
id |
str
|
The dataset item id. |
item |
ItemModel
|
The item model. |
entities |
dict[str, list[EntityModel] | EntityModel | None]
|
The entities models mapping. |
annotations |
dict[str, list[AnnotationModel] | AnnotationModel | None]
|
The annotations models mapping. |
views |
dict[str, list[ViewModel] | ViewModel | None]
|
The views models mapping. |
Source code in pydantic/main.py
from_dataset_item(dataset_item, dataset_schema)
classmethod
Create a model from a DatasetItem.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_item
|
DatasetItem
|
The dataset item to create the model from. |
required |
dataset_schema
|
DatasetSchema
|
The schema of the dataset containing the dataset item. |
required |
Returns:
Type | Description |
---|---|
Self
|
The created model. |
Source code in pixano/app/models/dataset_items.py
from_dataset_items(dataset_items, dataset_schema)
classmethod
Create a list of models from a list of DatasetItems.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_items
|
list[DatasetItem]
|
The dataset items to create the models from. |
required |
dataset_schema
|
DatasetSchema
|
The schema of the dataset containing the dataset item. |
required |
Returns:
Type | Description |
---|---|
list[Self]
|
The list of created models. |
Source code in pixano/app/models/dataset_items.py
model_dump(exclude_timestamps=False, **kwargs)
Dump the model to a dictionary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exclude_timestamps
|
bool
|
Exclude timestamps "created_at" and "updated_at" from the model dump. Useful for comparing models without timestamps. |
False
|
kwargs
|
Any
|
Arguments for pydantic |
{}
|
Returns:
Type | Description |
---|---|
dict[str, Any]
|
The model dump. |
Source code in pixano/app/models/dataset_items.py
to_dataset_item(dataset_schema)
Create a DatasetItem from a model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_schema
|
DatasetSchema
|
The schema of the dataset containing the dataset item. |
required |
Returns:
Type | Description |
---|---|
DatasetItem
|
The created dataset item. |
Source code in pixano/app/models/dataset_items.py
to_dataset_items(models, dataset_schema)
staticmethod
Create a list of DatasetItems from a list of models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
models
|
list[DatasetItemModel]
|
The models to create the dataset items from. |
required |
dataset_schema
|
DatasetSchema
|
The schema of the dataset containing the dataset items. |
required |
Returns:
Type | Description |
---|---|
list[DatasetItem]
|
The list of created dataset items. |