added infrastructure code
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
"""
|
||||
Interfaces package for visual-semiotic-ai-analysis.
|
||||
Exposes repository interfaces for use throughout the project.
|
||||
"""
|
||||
|
||||
from .annotation_repository_interface import AnnotationRepositoryInterface
|
||||
from .job_repository_interface import JobRepositoryInterface
|
||||
from .image_repository_interface import ImageRepositoryInterface
|
||||
|
||||
__all__ = [
|
||||
"JobRepositoryInterface",
|
||||
"ImageRepositoryInterface",
|
||||
"AnnotationRepositoryInterface",
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Definition of AnnotationRepositoryInterface."""
|
||||
|
||||
from uuid import UUID
|
||||
from abc import ABC, abstractmethod
|
||||
from data_store.dto import Annotation
|
||||
|
||||
|
||||
class AnnotationRepositoryInterface(ABC):
|
||||
"""AnnotationRepository interface."""
|
||||
|
||||
@abstractmethod
|
||||
def get(self, job_id: UUID) -> Annotation | None:
|
||||
"""Retrieve an Annotation by its associated Job ID."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def put(self, annotation: Annotation, job_id: UUID) -> None:
|
||||
"""Update or create an Annotation."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def delete(self, job_id: UUID) -> None:
|
||||
"""Delete an Annotation by its associated Job ID."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def list_all(self) -> list[UUID]:
|
||||
"""List all Job IDs with associated Annotations in the repository."""
|
||||
raise NotImplementedError()
|
||||
@@ -0,0 +1,29 @@
|
||||
"""Definition of ImageRepositoryInterface"""
|
||||
|
||||
from uuid import UUID
|
||||
from abc import ABC, abstractmethod
|
||||
from PIL import Image
|
||||
|
||||
|
||||
class ImageRepositoryInterface(ABC):
|
||||
"""ImageRepository interface."""
|
||||
|
||||
@abstractmethod
|
||||
def get(self, image_id: UUID) -> Image.Image | None:
|
||||
"""Retrieve an Image by its ID."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def put(self, image: Image.Image, image_id: UUID) -> None:
|
||||
"""Update or create an Image."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def delete(self, image_id: UUID) -> None:
|
||||
"""Delete an Image by its ID."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def list_all(self) -> list[UUID]:
|
||||
"""List all image IDs in the repository."""
|
||||
raise NotImplementedError()
|
||||
@@ -0,0 +1,30 @@
|
||||
"""Definition of JobRepositoryInterface."""
|
||||
|
||||
from uuid import UUID
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
from data_store.dto import Job
|
||||
|
||||
|
||||
class JobRepositoryInterface(ABC):
|
||||
"""JobRepository interface."""
|
||||
|
||||
@abstractmethod
|
||||
def get(self, job_id: UUID) -> Job | None:
|
||||
"""Retrieve a Job by its ID."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def put(self, job: Job) -> None:
|
||||
"""Update or create a Job."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def delete(self, job_id: UUID) -> None:
|
||||
"""Delete a Job by its ID."""
|
||||
raise NotImplementedError()
|
||||
|
||||
@abstractmethod
|
||||
def list_all(self) -> list[UUID]:
|
||||
"""List all Job IDs in the repository."""
|
||||
raise NotImplementedError()
|
||||
Reference in New Issue
Block a user