class AssignmentStatus
An enumeration class that defines the possible status values for assignments in a document review/approval workflow.
/tf/active/vicechatdev/CDocs single class/models/workflow_base.py
25 - 31
simple
Purpose
AssignmentStatus provides a type-safe enumeration of all possible states an assignment (reviewer or approver) can be in during a document workflow. It inherits from both str and Enum, making it compatible with string operations while providing enum benefits like type safety and IDE autocomplete. This enum is used to track the lifecycle of assignments from creation through completion or rejection.
Source Code
class AssignmentStatus(str, Enum):
"""Status enum for assignments (both reviewers and approvers)."""
PENDING = "PENDING"
IN_PROGRESS = "IN_PROGRESS"
COMPLETED = "COMPLETED"
REJECTED = "REJECTED"
SKIPPED = "SKIPPED"
Parameters
| Name | Type | Default | Kind |
|---|---|---|---|
bases |
str, Enum | - |
Parameter Details
str: First base class - makes enum values behave as strings, allowing direct string comparisons and serialization
Enum: Second base class - provides enumeration functionality with member access and iteration capabilities
Return Value
Instantiation returns an AssignmentStatus enum member. Each member is both a string and an enum value, so it can be used in string contexts (e.g., database storage, JSON serialization) while maintaining type safety. The enum members are: PENDING (initial state), IN_PROGRESS (actively being worked on), COMPLETED (successfully finished), REJECTED (declined or rejected), and SKIPPED (bypassed or skipped).
Class Interface
Attributes
| Name | Type | Description | Scope |
|---|---|---|---|
PENDING |
str | Initial status when an assignment is created but not yet started. Indicates the assignment is waiting to be picked up. | class |
IN_PROGRESS |
str | Status indicating the assignment is actively being worked on by the assigned reviewer or approver. | class |
COMPLETED |
str | Status indicating the assignment has been successfully completed. The reviewer/approver has finished their task. | class |
REJECTED |
str | Status indicating the assignment was rejected or declined. The reviewer/approver did not approve the document. | class |
SKIPPED |
str | Status indicating the assignment was bypassed or skipped in the workflow. Used for optional assignments or when an assignment is no longer needed. | class |
Dependencies
enum
Required Imports
from enum import Enum
Usage Example
from enum import Enum
class AssignmentStatus(str, Enum):
PENDING = "PENDING"
IN_PROGRESS = "IN_PROGRESS"
COMPLETED = "COMPLETED"
REJECTED = "REJECTED"
SKIPPED = "SKIPPED"
# Using the enum
status = AssignmentStatus.PENDING
print(status) # Output: PENDING
print(status.value) # Output: PENDING
print(status == "PENDING") # Output: True
# Checking status
if status == AssignmentStatus.PENDING:
print("Assignment is pending")
# Iterating over all statuses
for status in AssignmentStatus:
print(status.name, status.value)
# Converting from string
status_from_str = AssignmentStatus("IN_PROGRESS")
print(status_from_str == AssignmentStatus.IN_PROGRESS) # Output: True
# Using in database or API contexts
assignment_data = {"status": AssignmentStatus.COMPLETED.value}
print(assignment_data) # Output: {'status': 'COMPLETED'}
Best Practices
- Use AssignmentStatus members directly rather than string literals to ensure type safety and catch typos at development time
- When storing in databases or serializing to JSON, use the .value property to get the string representation
- When deserializing from strings, use AssignmentStatus(string_value) to convert back to enum
- The enum inherits from str, so it can be used directly in string comparisons and contexts without calling .value
- Use pattern matching or if-elif chains with enum members for status-based logic rather than string comparisons
- The typical lifecycle is: PENDING -> IN_PROGRESS -> (COMPLETED | REJECTED | SKIPPED)
- SKIPPED status is useful for optional reviewers or when an assignment is bypassed in the workflow
- Consider using this enum in type hints (e.g., status: AssignmentStatus) to improve code documentation and IDE support
Similar Components
AI-powered semantic similarity - components with related functionality:
-
class WorkflowStatus 81.4% similar
-
class AssignmentBase 71.4% similar
-
class ContentStatus 70.4% similar
-
class AnalysisStatus_v1 68.3% similar
-
class AnalysisStatus 65.7% similar