Skip to content

Processing Progress DTO

processing_progress_dto

Processing Progress Data Transfer Object.

Defines the ProcessingProgressDTO, an immutable data transfer object that encapsulates processing progress information. Provides real-time feedback on multi-stage processing operations.

Classes:

Name Description
ProcessingProgressDTO

Immutable DTO containing processing progress information

Classes

ProcessingProgressDTO dataclass

ProcessingProgressDTO(current_stage: str, stage_number: int, total_stages: int, progress_percentage: float, message: str = '', estimated_time_remaining: Optional[float] = None, error: Optional[str] = None)

Deprecated Immutable DTO for processing progress information.

Functions
__post_init__
__post_init__() -> None

Validate DTO consistency.

Raises:

Type Description
ValueError

If stage numbers invalid or percentage out of range

Source code in src/application/dto/processing_progress_dto.py
def __post_init__(self) -> None:
    """
    Validate DTO consistency.

    Raises
    ------
    ValueError
        If stage numbers invalid or percentage out of range
    """
    if self.total_stages < 1:
        raise ValueError("total_stages must be at least 1")

    if self.stage_number < 1 or self.stage_number > self.total_stages:
        raise ValueError(f"stage_number must be between 1 and {self.total_stages}")

    if not 0.0 <= self.progress_percentage <= 100.0:
        raise ValueError("progress_percentage must be between 0.0 and 100.0")

    if (
        self.estimated_time_remaining is not None
        and self.estimated_time_remaining < 0
    ):
        raise ValueError("estimated_time_remaining cannot be negative")
is_complete
is_complete() -> bool

Check if processing is complete.

Returns:

Type Description
bool

True if progress is 100%

Source code in src/application/dto/processing_progress_dto.py
def is_complete(self) -> bool:
    """
    Check if processing is complete.

    Returns
    -------
    bool
        True if progress is 100%
    """
    return self.progress_percentage >= 100.0
has_error
has_error() -> bool

Check if processing has error.

Returns:

Type Description
bool

True if error exists

Source code in src/application/dto/processing_progress_dto.py
def has_error(self) -> bool:
    """
    Check if processing has error.

    Returns
    -------
    bool
        True if error exists
    """
    return self.error is not None
is_final_stage
is_final_stage() -> bool

Check if currently on final stage.

Returns:

Type Description
bool

True if on last stage

Source code in src/application/dto/processing_progress_dto.py
def is_final_stage(self) -> bool:
    """
    Check if currently on final stage.

    Returns
    -------
    bool
        True if on last stage
    """
    return self.stage_number == self.total_stages