Skip to content

# Schemas

## `` `whombat.schemas`

Schemas for Whombat data models.

The Whombat Python API returns these schemas to the user, and they are the main way that the user interacts with the data.

Schemas are defined using Pydantic, and are used to validate data before it is inserted into the database, and also to validate data before it is returned to the user.

Most database models have multiple schemas, a main schema that is used to return data to the user, and a create and update schema that is used to validate data before it is inserted into the database.

### Attributes

#### `` `Scale = Literal['amplitude', 'power', 'dB']` `module-attribute`

#### `` `Window = Literal['boxcar', 'triang', 'bartlett', 'flattop', 'parzen', 'bohman', 'blackman', 'blackmanharris', 'nuttall', 'barthann', 'hamming', 'hann', 'kaiser']` `module-attribute`

### Classes

#### `` `AmplitudeParameters`

Bases: `BaseModel`

Parameters for amplitude clamping.

##### Attributes

###### `` `clamp: bool = False` `class-attribute` `instance-attribute`

Whether to clamp amplitude values.

###### `` `max_dB: float = 0` `class-attribute` `instance-attribute`

Maximum amplitude value.

###### `` `min_dB: float = -100.0` `class-attribute` `instance-attribute`

Minimum amplitude value.

###### `` `normalize: bool = True` `class-attribute` `instance-attribute`

Whether to normalize spectrogram before amplitude scaling.

If `True`, the spectrogram will be normalized to the range [0, 1] before amplitude scaling. In particular dB values are relative to the maximum amplitude value in the spectrogram, and not the maximum possible amplitude value of the recorder.

This can have the effect of making the spectrogram appear noisier than it actually is, since the maximum amplitude value in the spectrogram may be much lower than the maximum possible amplitude value of the recorder.

Also, when visualizing spectrograms in clips, the amplitude scale will be relative to the maximum amplitude value in the clip, and not the maximum of the recording as a whole. This can make it difficult to compare amplitude levels across clips, and will create artificial seams between clips when visualizing spectrograms in recordings.

###### `` `scale: Scale = 'dB'` `class-attribute` `instance-attribute`

Scale to use for spectrogram computation.

##### Functions

###### `` `check_db_are_negative(value)` `classmethod`

Check that min_dB and max_dB are non positive.

###### `` `check_min_dB_and_max_dB()`

Check that min_dB is less than max_dB.

#### `` `AnnotationProject`

Bases: `BaseSchema`

Schema for an annotation project.

##### Attributes

###### `` `annotation_instructions: str | None = None` `class-attribute` `instance-attribute`

Project instructions for annotating.

###### `` `description: str` `instance-attribute`

A description of the annotation project.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Database ID of the annotation project.

###### `` `name: str` `instance-attribute`

Name of the annotation project.

###### `` `tags: list[Tag] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Tags to be used throughout the annotation project.

###### `` `uuid: UUID` `instance-attribute`

UUID of the annotation project.

#### `` `AnnotationProjectCreate`

Bases: `BaseModel`

Schema for creating an annotation project.

##### Attributes

###### `` `annotation_instructions: str | None = None` `class-attribute` `instance-attribute`

Project instructions for annotating.

###### `` `description: str` `instance-attribute`

A description of the annotation project.

###### `` `name: str` `instance-attribute`

Name of the annotation project.

#### `` `AnnotationProjectUpdate`

Bases: `BaseModel`

Schema for updating an annotation project.

##### Attributes

###### `` `annotation_instructions: str | None = None` `class-attribute` `instance-attribute`

Project instructions for annotating.

###### `` `description: str | None = None` `class-attribute` `instance-attribute`

A description of the annotation project.

###### `` `name: str | None = None` `class-attribute` `instance-attribute`

Name of the annotation project.

#### `` `AnnotationStatusBadge`

Bases: `BaseSchema`

Schema for a task status badge.

##### Attributes

###### `` `state: AnnotationState` `instance-attribute`

State of the task.

###### `` `user: SimpleUser | None` `instance-attribute`

User to whom the status badge refers.

#### `` `AnnotationStatusBadgeUpdate`

Bases: `BaseModel`

Schema for updating a task status badge.

##### Attributes

###### `` `state: AnnotationState | None = None` `class-attribute` `instance-attribute`

State of the task.

#### `` `AnnotationTask`

Bases: `BaseSchema`

Schema for a task.

##### Attributes

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Database ID of the task.

###### `` `status_badges: list[AnnotationStatusBadge]` `instance-attribute`

Status badges for the task.

###### `` `uuid: UUID` `instance-attribute`

UUID of the task.

#### `` `AnnotationTaskCreate`

Bases: `BaseModel`

Schema for creating a new task.

#### `` `AnnotationTaskUpdate`

Bases: `BaseModel`

Schema for updating a task.

##### Attributes

###### `` `uuid: UUID | None = None` `class-attribute` `instance-attribute`

#### `` `AudioParameters`

Bases: `ResamplingParameters`, `FilteringParameters`

Parameters for audio loading.

#### `` `Clip`

Bases: `BaseSchema`

Schema for Clip objects returned to the user.

##### Attributes

###### `` `end_time: float` `instance-attribute`

The end time of the clip.

###### `` `features: list[Feature] = Field(default_factory=list)` `class-attribute` `instance-attribute`

The features associated with the clip.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

The database id of the clip.

###### `` `recording: Recording` `instance-attribute`

Recording information for the clip.

###### `` `start_time: float` `instance-attribute`

The start time of the clip.

###### `` `uuid: UUID` `instance-attribute`

The unique identifier of the clip.

#### `` `ClipAnnotation`

Bases: `BaseSchema`

Schema for an ClipAnnotation.

##### Attributes

###### `` `clip: Clip` `instance-attribute`

Clip this annotation is attached to.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Database ID of this annotation.

###### `` `notes: list[Note] = Field(default_factory=list, description='Notes attached to this annotation.')` `class-attribute` `instance-attribute`

###### `` `sound_events: list[SoundEventAnnotation] = Field(default_factory=list, description='Annotated sound events attached to this clip.')` `class-attribute` `instance-attribute`

###### `` `tags: list[Tag] = Field(default_factory=list, description='Tags attached to this annotation.', alias_priority=10000)` `class-attribute` `instance-attribute`

###### `` `uuid: UUID` `instance-attribute`

#### `` `ClipAnnotationCreate`

Bases: `BaseModel`

Schema for data required to create an ClipAnnotation.

##### Attributes

###### `` `tags: list[Tag] = Field(default_factory=list)` `class-attribute` `instance-attribute`

#### `` `ClipAnnotationTag`

Bases: `BaseSchema`

Schema for an ClipAnnotationTag.

##### Attributes

###### `` `created_by: SimpleUser | None` `instance-attribute`

User who created this annotation tag.

###### `` `tag: Tag` `instance-attribute`

Tag attached to this annotation.

#### `` `ClipAnnotationUpdate`

Bases: `BaseSchema`

Schema for data required to update an ClipAnnotation.

##### Attributes

###### `` `uuid: UUID | None = None` `class-attribute` `instance-attribute`

UUID of the annotation.

#### `` `ClipCreate`

Bases: `BaseModel`

Schema for creating a clip.

##### Attributes

###### `` `end_time: float` `instance-attribute`

The end time of the clip.

###### `` `start_time: float` `instance-attribute`

The start time of the clip.

##### Functions

###### `` `validate_times(values)`

Validate that start_time < end_time.

#### `` `ClipEvaluation`

Bases: `BaseSchema`

##### Attributes

###### `` `clip_annotation: ClipAnnotation` `instance-attribute`

Clip annotation used for the evaluation.

###### `` `clip_prediction: ClipPrediction` `instance-attribute`

Clip prediction being evaluated.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Database ID of the evaluation.

###### `` `metrics: list[Feature] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Evaluation metrics.

###### `` `score: float` `instance-attribute`

Overall score of the evaluation.

###### `` `sound_event_evaluations: list[SoundEventEvaluation] = Field(default_factory=list)` `class-attribute` `instance-attribute`

The evaluation of the sound events within the clip.

###### `` `uuid: UUID` `instance-attribute`

UUID of the Clip Evaluation.

#### `` `ClipEvaluationCreate`

Bases: `BaseModel`

Schema for creating a new Clip Evaluation.

##### Attributes

###### `` `score: float` `instance-attribute`

Overall score of the evaluation.

#### `` `ClipEvaluationUpdate`

Bases: `BaseModel`

Schema for updating an existing Clip Evaluation.

##### Attributes

###### `` `score: float | None = None` `class-attribute` `instance-attribute`

Overall score of the evaluation.

###### `` `uuid: UUID | None = None` `class-attribute` `instance-attribute`

UUID of the Clip Evaluation.

#### `` `ClipPrediction`

Bases: `BaseSchema`

Schema for a clip prediction.

##### Attributes

###### `` `clip: Clip` `instance-attribute`

Clip to which this prediction belongs.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Database ID of the prediction.

###### `` `sound_events: list[SoundEventPrediction] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Sound event predictions of the clip.

###### `` `tags: list[ClipPredictionTag] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Tags of the prediction.

###### `` `uuid: UUID` `instance-attribute`

UUID of the prediction.

#### `` `ClipPredictionCreate`

Bases: `BaseModel`

Schema for creating a new clip prediction.

##### Attributes

###### `` `tags: list[PredictedTag] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Tags of the prediction.

#### `` `ClipPredictionTag`

Bases: `BaseSchema`

Schema for a clip prediction tag.

##### Attributes

###### `` `score: float` `instance-attribute`

Confidence of the prediction.

###### `` `tag: Tag` `instance-attribute`

Tag of the prediction.

#### `` `ClipPredictionUpdate`

Bases: `BaseModel`

Schema for updating a clip prediction.

##### Attributes

###### `` `uuid: UUID | None = None` `class-attribute` `instance-attribute`

UUID of the prediction.

#### `` `ClipUpdate`

Bases: `BaseModel`

Schema for updating a clip.

##### Attributes

###### `` `uuid: UUID | None = None` `class-attribute` `instance-attribute`

The unique identifier of the clip.

#### `` `Dataset`

Bases: `BaseSchema`

Schema for Dataset objects returned to the user.

##### Attributes

###### `` `audio_dir: Path` `instance-attribute`

The path to the directory containing the audio files.

###### `` `description: str | None` `instance-attribute`

The description of the dataset.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

The database id of the dataset.

###### `` `name: str` `instance-attribute`

The name of the dataset.

###### `` `recording_count: int = 0` `class-attribute` `instance-attribute`

The number of recordings in the dataset.

###### `` `uuid: UUID` `instance-attribute`

The uuid of the dataset.

#### `` `DatasetCreate`

Bases: `BaseModel`

Schema for Dataset objects created by the user.

##### Attributes

###### `` `audio_dir: DirectoryPath` `instance-attribute`

The path to the directory containing the audio files.

###### `` `description: str | None = Field(None)` `class-attribute` `instance-attribute`

The description of the dataset.

###### `` `name: str = Field(..., min_length=1)` `class-attribute` `instance-attribute`

The name of the dataset.

#### `` `DatasetFile`

Bases: `BaseModel`

Schema for DatasetFile objects returned to the user.

##### Attributes

###### `` `path: Path` `instance-attribute`

The path to the file.

###### `` `state: FileState` `instance-attribute`

The state of the file.

#### `` `DatasetRecording`

Bases: `BaseSchema`

Schema for DatasetRecording objects returned to the user.

##### Attributes

###### `` `path: Path` `instance-attribute`

The path to the recording in the dataset directory.

###### `` `recording: Recording` `instance-attribute`

The uuid of the recording.

###### `` `state: FileState = Field(default=FileState.REGISTERED)` `class-attribute` `instance-attribute`

The state of the file.

#### `` `DatasetRecordingCreate`

Bases: `BaseModel`

Schema for DatasetRecording objects created by the user.

##### Attributes

###### `` `path: Path` `instance-attribute`

The path to the recording in the dataset directory.

#### `` `DatasetUpdate`

Bases: `BaseModel`

Schema for Dataset objects updated by the user.

##### Attributes

###### `` `audio_dir: DirectoryPath | None = None` `class-attribute` `instance-attribute`

The path to the directory containing the audio files.

###### `` `description: str | None = None` `class-attribute` `instance-attribute`

The description of the dataset.

###### `` `name: str | None = Field(default=None, min_length=1)` `class-attribute` `instance-attribute`

The name of the dataset.

#### `` `Evaluation`

Bases: `BaseSchema`

Evaluation schema.

##### Attributes

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Dataset identifier of the evaluation.

###### `` `metrics: list[Feature] = Field(default_factory=list)` `class-attribute` `instance-attribute`

List of metrics of the evaluation.

###### `` `score: float` `instance-attribute`

Overall score of the evaluation.

###### `` `task: str` `instance-attribute`

Task of the evaluation.

###### `` `uuid: UUID` `instance-attribute`

#### `` `EvaluationCreate`

Bases: `BaseModel`

Evaluation creation schema.

##### Attributes

###### `` `score: float = Field(default=0, ge=0, le=1)` `class-attribute` `instance-attribute`

Overall score of the evaluation.

###### `` `task: str` `instance-attribute`

Task of the evaluation.

#### `` `EvaluationSet`

Bases: `BaseSchema`

Schema for EvaluationSet objects returned to the user.

##### Attributes

###### `` `description: str | None` `instance-attribute`

The description of the evaluation set.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

The id of the evaluation set.

###### `` `name: str` `instance-attribute`

The name of the evaluation set.

###### `` `tags: list[Tag] = Field(default_factory=list)` `class-attribute` `instance-attribute`

The tags to use for the evaluation set.

###### `` `task: str` `instance-attribute`

The name of the task the evaluation set is used for.

###### `` `uuid: UUID` `instance-attribute`

The uuid of the evaluation set.

#### `` `EvaluationSetCreate`

Bases: `BaseModel`

Schema for creating EvaluationSet objects.

##### Attributes

###### `` `description: str | None = Field(default=None)` `class-attribute` `instance-attribute`

The description of the evaluation set.

###### `` `name: str = Field(..., min_length=1)` `class-attribute` `instance-attribute`

The name of the evaluation set.

###### `` `task: str = Field(..., min_length=1)` `class-attribute` `instance-attribute`

The name of the task the evaluation set is used for.

#### `` `EvaluationSetUpdate`

Bases: `BaseModel`

Schema for updating EvaluationSet objects.

##### Attributes

###### `` `description: str | None = None` `class-attribute` `instance-attribute`

The description of the evaluation set.

###### `` `name: str | None = Field(default=None, min_length=1)` `class-attribute` `instance-attribute`

The name of the evaluation set.

#### `` `EvaluationUpdate`

Bases: `BaseModel`

Evaluation update schema.

##### Attributes

###### `` `score: float | None = None` `class-attribute` `instance-attribute`

Overall score of the evaluation.

###### `` `task: str | None = None` `class-attribute` `instance-attribute`

Task of the evaluation.

###### `` `uuid: UUID | None = None` `class-attribute` `instance-attribute`

Unique identifier of the evaluation.

#### `` `Feature`

Bases: `BaseModel`

Schema for Feature objects returned to the user.

##### Attributes

###### `` `model_config = ConfigDict(from_attributes=True)` `class-attribute` `instance-attribute`

###### `` `name: str` `instance-attribute`

The name of the feature.

###### `` `value: float` `instance-attribute`

The value of the feature.

#### `` `FeatureName`

Bases: `BaseSchema`

Schema for FeatureName objects returned to the user.

##### Attributes

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

The database id of the feature name.

###### `` `name: str` `instance-attribute`

The name of the feature.

#### `` `FeatureNameCreate`

Bases: `BaseModel`

Schema for FeatureName objects created by the user.

##### Attributes

###### `` `name: str` `instance-attribute`

The name of the feature.

#### `` `FeatureNameUpdate`

Bases: `BaseModel`

Schema for FeatureName objects updated by the user.

##### Attributes

###### `` `name: str` `instance-attribute`

The name of the feature.

#### `` `FileState`

Bases: `Enum`

The state of a file in a dataset.

Datasets can contain files that are not registered in the database. This can happen if the file was added to the dataset directory after the dataset was registered. Additionally, files can be registered in the database but missing from the dataset directory. This can happen if the file was removed from the dataset directory after the dataset was registered.

The state of a file can be one of the following:

- `missing`: The file is not registered in the database and is missing.

- `registered`: The file is registered in the database and is present.

- `unregistered`: The file is not registered in the database but is present in the dataset directory.

##### Attributes

###### `` `MISSING = 'missing'` `class-attribute` `instance-attribute`

If the recording is registered but the file is missing.

###### `` `REGISTERED = 'registered'` `class-attribute` `instance-attribute`

If the recording is registered and the file is present.

###### `` `UNREGISTERED = 'unregistered'` `class-attribute` `instance-attribute`

If the recording is not registered but the file is present.

#### `` `ModelRun`

Bases: `ModelRunCreate`

Schema of a model run as returned to the user.

##### Attributes

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

The database identifier of the model run.

###### `` `uuid: UUID` `instance-attribute`

The unique identifier of the model run.

#### `` `ModelRunCreate`

Bases: `BaseSchema`

Model Run creation schema.

##### Attributes

###### `` `description: str | None = None` `class-attribute` `instance-attribute`

A description of the model used to generate the model run.

###### `` `name: str` `instance-attribute`

Name of the model used to generate the model run.

###### `` `version: str` `instance-attribute`

Version of the model used to generate the model run.

#### `` `ModelRunUpdate`

Bases: `BaseSchema`

Model Run update schema.

##### Attributes

###### `` `description: str | None = None` `class-attribute` `instance-attribute`

The description of the model used to generate the model run.

###### `` `name: str | None = None` `class-attribute` `instance-attribute`

The name of the model used to generate the model run.

###### `` `version: str | None = None` `class-attribute` `instance-attribute`

The version of the model used to generate the model run.

#### `` `Note`

Bases: `BaseSchema`

Schema for Note objects returned to the user.

##### Attributes

###### `` `created_by: SimpleUser | None` `instance-attribute`

The user who created the note.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

The database id of the note.

###### `` `is_issue: bool` `instance-attribute`

Whether the note is an issue.

###### `` `message: str` `instance-attribute`

The message of the note.

###### `` `uuid: UUID` `instance-attribute`

The uuid of the note.

#### `` `NoteCreate`

Bases: `BaseModel`

Schema for creating notes.

This schema is used when creating notes from the API as the user does not need to provide the id of the user who created the note.

##### Attributes

###### `` `is_issue: bool = False` `class-attribute` `instance-attribute`

###### `` `message: str = Field(min_length=1, max_length=1000)` `class-attribute` `instance-attribute`

#### `` `NoteUpdate`

Bases: `BaseModel`

Schema for updating notes.

##### Attributes

###### `` `is_issue: bool | None = None` `class-attribute` `instance-attribute`

Whether the note is an issue.

###### `` `message: str | None = Field(None, min_length=1, max_length=1000)` `class-attribute` `instance-attribute`

The message of the note.

#### `` `Page`

Bases: `BaseModel`, `Generic[M]`

A page of results.

##### Attributes

###### `` `items: Sequence[M]` `instance-attribute`

###### `` `limit: int` `instance-attribute`

###### `` `offset: int` `instance-attribute`

###### `` `total: int` `instance-attribute`

#### `` `PluginInfo`

Bases: `BaseModel`

Plugin information.

##### Attributes

###### `` `attribution: str | None = Field(default=None, description='Plugin attribution.')` `class-attribute` `instance-attribute`

###### `` `description: str | None = Field(default=None, description='Plugin description.')` `class-attribute` `instance-attribute`

###### `` `name: str = Field(..., description='Plugin name.')` `class-attribute` `instance-attribute`

###### `` `thumbnail: str | None = Field(default=None, description='Plugin thumbnail.')` `class-attribute` `instance-attribute`

###### `` `url: str = Field(..., description='Route to the plugin pages.')` `class-attribute` `instance-attribute`

###### `` `version: str | None = Field(default=None, description='Plugin version.')` `class-attribute` `instance-attribute`

#### `` `PredictedTag`

Bases: `BaseSchema`

Schema for PredictedTag objects returned to the user.

##### Attributes

###### `` `score: float` `instance-attribute`

The confidence score for the assignment of the tag.

###### `` `tag: Tag` `instance-attribute`

The tag that was predicted.

#### `` `Recording`

Bases: `BaseSchema`

Schema for Recording objects returned to the user.

##### Attributes

###### `` `channels: int` `instance-attribute`

The number of channels in the audio file.

###### `` `date: datetime.date | None` `instance-attribute`

The date of the recording.

###### `` `duration: float` `instance-attribute`

The duration of the audio file in seconds.

This is the duration of the original audio file, not the time expanded version. This can vary depending on the time expansion factor. If the stored file has a duration of 10 seconds and a time expansion factor is 2, this means that the original recording was 5 seconds long. So the duration of the original recording is 5 seconds, not 10.

###### `` `features: list[Feature] = Field(default_factory=list)` `class-attribute` `instance-attribute`

The features associated with the recording.

###### `` `hash: str` `instance-attribute`

The md5 hash of the audio file.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

The database id of the recording.

###### `` `latitude: float | None` `instance-attribute`

The latitude of the recording.

###### `` `longitude: float | None` `instance-attribute`

The longitude of the recording.

###### `` `notes: list[Note] = Field(default_factory=list)` `class-attribute` `instance-attribute`

The notes associated with the recording.

###### `` `owners: list[SimpleUser] = Field(default_factory=list)` `class-attribute` `instance-attribute`

The users that own the recording.

###### `` `path: Path` `instance-attribute`

The path to the audio file, relative to the audio directory.

###### `` `rights: str | None` `instance-attribute`

A text describing the usage rights of the recording.

###### `` `samplerate: int` `instance-attribute`

The sample rate of the audio file in Hz.

This is the sample rate of the original audio file, not the time expanded version. This can vary depending on the time expansion factor. If the stored file has a sample rate of 44100 Hz and a time expansion factor is 2, this means that the original recording had a sample rate of 88200 Hz. So the sample rate of the original recording is 88200 Hz, not 44100 Hz.

###### `` `tags: list[Tag] = Field(default_factory=list)` `class-attribute` `instance-attribute`

The tags associated with the recording.

###### `` `time: datetime.time | None` `instance-attribute`

The time of the recording.

###### `` `time_expansion: float` `instance-attribute`

The time expansion factor of the recording.

###### `` `uuid: UUID` `instance-attribute`

The UUID of the recording.

#### `` `RecordingCreate`

Bases: `BaseModel`

Data for Recording creation.

##### Attributes

###### `` `date: datetime.date | None = None` `class-attribute` `instance-attribute`

The date of the recording.

###### `` `latitude: float | None = Field(default=None, ge=-90, le=90)` `class-attribute` `instance-attribute`

The latitude of the recording.

###### `` `longitude: float | None = Field(default=None, ge=-180, le=180)` `class-attribute` `instance-attribute`

The longitude of the recording.

###### `` `path: FilePath` `instance-attribute`

The path to the audio file.

###### `` `rights: str | None = None` `class-attribute` `instance-attribute`

A text describing the usage rights of the recording.

###### `` `time: datetime.time | None = None` `class-attribute` `instance-attribute`

The time of the recording.

###### `` `time_expansion: float = Field(default=1.0, gt=0)` `class-attribute` `instance-attribute`

The time expansion factor of the recording.

##### Functions

###### `` `is_an_audio_file(v)`

Validate that the given path is an audio file.

#### `` `RecordingTag`

Bases: `BaseSchema`

Schema for RecordingTag objects.

##### Attributes

###### `` `recording_uuid: UUID` `instance-attribute`

The UUID of the recording.

###### `` `tag: Tag` `instance-attribute`

The tag associated with the recording.

#### `` `RecordingUpdate`

Bases: `BaseModel`

Schema for Recording objects updated by the user.

##### Attributes

###### `` `date: datetime.date | None = None` `class-attribute` `instance-attribute`

The date of the recording.

###### `` `latitude: float | None = Field(default=None, ge=-90, le=90)` `class-attribute` `instance-attribute`

The latitude of the recording.

###### `` `longitude: float | None = Field(default=None, ge=-180, le=180)` `class-attribute` `instance-attribute`

The longitude of the recording.

###### `` `path: FilePath | None = None` `class-attribute` `instance-attribute`

New path to the audio file.

###### `` `rights: str | None = None` `class-attribute` `instance-attribute`

A text describing the usage rights of the recording.

###### `` `time: datetime.time | None = None` `class-attribute` `instance-attribute`

The time of the recording.

###### `` `time_expansion: float | None = Field(default=None, gt=0)` `class-attribute` `instance-attribute`

New time expansion factor of the recording.

#### `` `STFTParameters`

Bases: `BaseModel`

Parameters for STFT computation.

##### Attributes

###### `` `hop_size: float = Field(default=0.5, gt=0.0, le=1.0)` `class-attribute` `instance-attribute`

Hop size as a fraction of window size.

###### `` `window: Window = 'hann'` `class-attribute` `instance-attribute`

Window function.

###### `` `window_size: float = 0.025` `class-attribute` `instance-attribute`

Size of FFT window in seconds.

##### Functions

###### `` `check_positive(value)` `classmethod`

Check that window size and hop size are positive.

#### `` `SimpleUser`

Bases: `BaseSchema`

Schema for User objects returned to the user.

##### Attributes

###### `` `email: EmailStr | None = None` `class-attribute` `instance-attribute`

###### `` `id: uuid.UUID` `instance-attribute`

###### `` `is_active: bool | None = False` `class-attribute` `instance-attribute`

###### `` `is_superuser: bool | None = False` `class-attribute` `instance-attribute`

###### `` `is_verified: bool | None = False` `class-attribute` `instance-attribute`

###### `` `name: str | None = None` `class-attribute` `instance-attribute`

###### `` `username: str` `instance-attribute`

#### `` `SoundEvent`

Bases: `BaseSchema`

Public schema for handling sound events.

##### Attributes

###### `` `features: list[Feature] = Field(default_factory=list)` `class-attribute` `instance-attribute`

The features associated with the sound event.

###### `` `geometry: Geometry = Field(..., discriminator='type')` `class-attribute` `instance-attribute`

###### `` `geometry_type: GeometryType` `instance-attribute`

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

The id of the sound event.

###### `` `uuid: UUID` `instance-attribute`

The uuid of the sound event.

#### `` `SoundEventAnnotation`

Bases: `BaseSchema`

Schema for an SoundEventAnnotation.

##### Attributes

###### `` `created_by: SimpleUser | None` `instance-attribute`

User who created this annotation.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Database ID of this annotation.

###### `` `notes: list[Note] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Notes attached to this annotation.

###### `` `sound_event: SoundEvent` `instance-attribute`

Sound event this annotation is attached to.

###### `` `tags: list[Tag] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Tags attached to this annotation.

###### `` `uuid: UUID` `instance-attribute`

UUID of this annotation.

#### `` `SoundEventAnnotationCreate`

Bases: `BaseModel`

Schema for data required to create an SoundEventAnnotation.

##### Attributes

###### `` `geometry: Geometry = Field(..., discriminator='type')` `class-attribute` `instance-attribute`

Geometry of this annotation.

###### `` `tags: list[TagCreate] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Tags attached to this annotation.

#### `` `SoundEventAnnotationTag`

Bases: `BaseModel`

Schema for a SoundEventAnnotationTag.

##### Attributes

###### `` `created_by: SimpleUser | None` `instance-attribute`

User who created this annotation.

###### `` `tag: Tag` `instance-attribute`

Tag attached to this annotation.

#### `` `SoundEventAnnotationUpdate`

Bases: `BaseSchema`

Schema for data required to update an SoundEventAnnotation.

##### Attributes

###### `` `geometry: Geometry = Field(..., discriminator='type')` `class-attribute` `instance-attribute`

Geometry of this annotation.

#### `` `SoundEventCreate`

Bases: `BaseModel`

Schema for SoundEvent objects created by the user.

##### Attributes

###### `` `geometry: Geometry = Field(..., discriminator='type')` `class-attribute` `instance-attribute`

The geometry of the sound event.

###### `` `geometry_type: GeometryType` `property`

Return the type of geometry used to mark the sound event.

#### `` `SoundEventEvaluation`

Bases: `BaseSchema`

Schema for a sound event evaluation.

##### Attributes

###### `` `affinity: float` `instance-attribute`

Affinity of the match between the source and target.

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Database ID of the evaluation.

###### `` `metrics: list[Feature] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Evaluation metrics.

###### `` `score: float` `instance-attribute`

Overall score of the evaluation.

###### `` `source: SoundEventPrediction | None` `instance-attribute`

Source sound event prediction.

###### `` `target: SoundEventAnnotation | None` `instance-attribute`

Target sound event annotation.

###### `` `uuid: UUID` `instance-attribute`

#### `` `SoundEventEvaluationCreate`

Bases: `BaseModel`

Schema for creating a new sound event evaluation.

##### Attributes

###### `` `affinity: float` `instance-attribute`

Affinity of the match between the source and target.

###### `` `score: float` `instance-attribute`

Overall score of the evaluation.

#### `` `SoundEventEvaluationUpdate`

Bases: `BaseSchema`

Schema for updating a sound event evaluation.

##### Attributes

###### `` `affinity: float | None = None` `class-attribute` `instance-attribute`

Affinity of the match between the source and target.

###### `` `score: float | None = None` `class-attribute` `instance-attribute`

Overall score of the evaluation.

###### `` `uuid: UUID | None = None` `class-attribute` `instance-attribute`

UUID of the Sound Event Evaluation.

#### `` `SoundEventPrediction`

Bases: `BaseSchema`

Schema for a sound event prediction.

##### Attributes

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Database ID of the prediction.

###### `` `score: float` `instance-attribute`

Overall score of the prediction.

###### `` `sound_event: SoundEvent` `instance-attribute`

Sound event to be predicted.

###### `` `tags: list[SoundEventPredictionTag] = Field(default_factory=list)` `class-attribute` `instance-attribute`

Tags of the prediction.

###### `` `uuid: UUID` `instance-attribute`

UUID of the prediction.

#### `` `SoundEventPredictionCreate`

Bases: `BaseModel`

Schema for creating a new sound event prediction.

##### Attributes

###### `` `geometry: Geometry = Field(..., discriminator='type')` `class-attribute` `instance-attribute`

Geometry of this sound event prediction.

###### `` `score: float` `instance-attribute`

Overall score of the prediction.

#### `` `SoundEventPredictionTag`

Bases: `BaseSchema`

Schema for a sound event prediction tag.

##### Attributes

###### `` `score: float` `instance-attribute`

Score of the tag.

###### `` `tag: Tag` `instance-attribute`

Tag.

#### `` `SoundEventPredictionUpdate`

Bases: `BaseModel`

Schema for updating a sound event prediction.

##### Attributes

###### `` `score: float | None` `instance-attribute`

Overall score of the prediction.

###### `` `uuid: UUID | None` `instance-attribute`

UUID of the prediction.

#### `` `SoundEventUpdate`

Bases: `BaseSchema`

Schema for SoundEvent objects updated by the user.

##### Attributes

###### `` `geometry: Geometry = Field(..., discriminator='type')` `class-attribute` `instance-attribute`

The geometry of the sound event.

#### `` `SpectrogramParameters`

Bases: `STFTParameters`, `AmplitudeParameters`

Parameters for spectrogram computation.

##### Attributes

###### `` `channel: int = 0` `class-attribute` `instance-attribute`

Channel to use for spectrogram computation.

###### `` `cmap: str = 'gray'` `class-attribute` `instance-attribute`

Colormap to use for spectrogram.

###### `` `pcen: bool = True` `class-attribute` `instance-attribute`

Whether to apply PCEN for de-noising.

#### `` `Tag`

Bases: `BaseSchema`

Schema for Tag objects returned to the user.

##### Attributes

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

Database ID of the tag.

###### `` `key: str` `instance-attribute`

Key of the tag.

###### `` `value: str` `instance-attribute`

Value of the tag.

#### `` `TagCreate`

Bases: `BaseModel`

Schema for creating Tag objects.

##### Attributes

###### `` `key: str = Field(min_length=1, max_length=255)` `class-attribute` `instance-attribute`

Key of the tag.

###### `` `value: str = Field(min_length=1, max_length=255)` `class-attribute` `instance-attribute`

Value of the tag.

#### `` `TagUpdate`

Bases: `BaseModel`

Schema for updating Tag objects.

##### Attributes

###### `` `key: str | None = Field(default=None, min_length=1, max_length=255)` `class-attribute` `instance-attribute`

Key of the tag.

###### `` `value: str | None = Field(default=None, min_length=1, max_length=255)` `class-attribute` `instance-attribute`

Value of the tag.

#### `` `User`

Bases: `BaseUser[UUID]`

Schema for User objects returned to the user.

##### Attributes

###### `` `created_on: datetime.datetime` `instance-attribute`

###### `` `name: Optional[str] = None` `class-attribute` `instance-attribute`

###### `` `username: str` `instance-attribute`

#### `` `UserCreate`

Bases: `BaseUserCreate`

Schema for User objects created by the user.

##### Attributes

###### `` `name: str | None = None` `class-attribute` `instance-attribute`

###### `` `username: str` `instance-attribute`

#### `` `UserRun`

Bases: `BaseSchema`

Schema of a user run as returned to the user.

##### Attributes

###### `` `id: int = Field(..., exclude=True)` `class-attribute` `instance-attribute`

The databset identifier of the model run.

###### `` `user: SimpleUser` `instance-attribute`

The user who created the user run.

###### `` `uuid: UUID` `instance-attribute`

Unique identifier of the user run.

#### `` `UserRunCreate`

Bases: `BaseModel`

Model Run creation schema.

#### `` `UserRunUpdate`

Bases: `BaseModel`

Schema for updating a user run.

##### Attributes

###### `` `uuid: UUID = Field(default_factory=uuid4)` `class-attribute` `instance-attribute`

Unique identifier of the user run.

#### `` `UserUpdate`

Bases: `BaseUserUpdate`

Schema for User objects updated by the user.

##### Attributes

###### `` `name: str | None = None` `class-attribute` `instance-attribute`

###### `` `username: str | None = None` `class-attribute` `instance-attribute`