added infrastructure code
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
"""
|
||||
DTO package for visual-semiotic-ai-analysis.
|
||||
Exposes core data transfer objects and enums for use throughout the project.
|
||||
"""
|
||||
|
||||
from .angle_enum import AngleEnum
|
||||
from .annotation import Annotation
|
||||
from .contact_enum import ContactEnum
|
||||
from .distance_enum import DistanceEnum
|
||||
from .job import Job
|
||||
from .point_of_view_enum import PointOfViewEnum
|
||||
|
||||
__all__ = [
|
||||
"AngleEnum",
|
||||
"Annotation",
|
||||
"ContactEnum",
|
||||
"DistanceEnum",
|
||||
"Job",
|
||||
"PointOfViewEnum",
|
||||
]
|
||||
@@ -0,0 +1,11 @@
|
||||
"""Definition of AngleEnum DTO."""
|
||||
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
class AngleEnum(StrEnum):
|
||||
"""Enumeration for Angle values."""
|
||||
|
||||
HIGH = "high"
|
||||
EYE_LEVEL = "eye-level"
|
||||
LOW = "low"
|
||||
@@ -0,0 +1,16 @@
|
||||
"""Definition of Annotation DTO."""
|
||||
|
||||
from .type_checking_base_model import TypeCheckingBaseModel
|
||||
from .distance_enum import DistanceEnum
|
||||
from .angle_enum import AngleEnum
|
||||
from .point_of_view_enum import PointOfViewEnum
|
||||
from .contact_enum import ContactEnum
|
||||
|
||||
|
||||
class Annotation(TypeCheckingBaseModel):
|
||||
"""Data Transfer Object representing an Annotation."""
|
||||
|
||||
distance: DistanceEnum
|
||||
angle: AngleEnum
|
||||
point_of_view: PointOfViewEnum
|
||||
contact: ContactEnum
|
||||
@@ -0,0 +1,10 @@
|
||||
"""Definition of ContactEnum DTO."""
|
||||
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
class ContactEnum(StrEnum):
|
||||
"""Enumeration for Contact."""
|
||||
|
||||
OFFER = "offer"
|
||||
DEMAND = "demand"
|
||||
@@ -0,0 +1,11 @@
|
||||
"""Definition of DistanceEnum DTO."""
|
||||
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
class DistanceEnum(StrEnum):
|
||||
"""Enumeration for Distance values."""
|
||||
|
||||
CLOSE = "close"
|
||||
MEDIUM = "medium"
|
||||
LONG = "long"
|
||||
@@ -0,0 +1,21 @@
|
||||
"""Definition of Job DTO."""
|
||||
|
||||
from uuid import uuid4, UUID
|
||||
from pydantic import Field
|
||||
from PIL import Image
|
||||
|
||||
from .type_checking_base_model import TypeCheckingBaseModel
|
||||
from .annotation import Annotation
|
||||
|
||||
|
||||
class Job(TypeCheckingBaseModel):
|
||||
"""Data Transfer Object representing a Job."""
|
||||
|
||||
class Config:
|
||||
"""Pydantic configuration for Job DTO."""
|
||||
|
||||
arbitrary_types_allowed = True
|
||||
|
||||
job_id: UUID = Field(default_factory=uuid4)
|
||||
image: Image.Image
|
||||
annotation: Annotation
|
||||
@@ -0,0 +1,10 @@
|
||||
"""Definition of PointOfViewEnum DTO."""
|
||||
|
||||
from enum import StrEnum
|
||||
|
||||
|
||||
class PointOfViewEnum(StrEnum):
|
||||
"""Enumeration for Point of View."""
|
||||
|
||||
FRONTAL = "frontal"
|
||||
OBLIQUE = "oblique"
|
||||
@@ -0,0 +1,12 @@
|
||||
"""Definition of class_base class."""
|
||||
|
||||
from pydantic import BaseModel, ConfigDict
|
||||
|
||||
|
||||
class TypeCheckingBaseModel(BaseModel):
|
||||
"""BaseModel with added type checking on input types."""
|
||||
|
||||
model_config = ConfigDict(
|
||||
validate_assignment=True, # ensure that dynamic validations adhere to defined types
|
||||
frozen=True, # ensure data immutability
|
||||
)
|
||||
Reference in New Issue
Block a user