Initial commit

This commit is contained in:
2026-02-21 09:44:18 -03:00
commit 5dfc2cbd85
65 changed files with 11989 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
"""Data model representing one persisted processing pipeline log entry."""
import uuid
from datetime import UTC, datetime
from sqlalchemy import BigInteger, DateTime, ForeignKey, String, Text
from sqlalchemy.dialects.postgresql import JSONB, UUID
from sqlalchemy.orm import Mapped, mapped_column
from app.db.base import Base
class ProcessingLogEntry(Base):
"""Stores a timestamped processing event with optional model prompt and response text."""
__tablename__ = "processing_logs"
id: Mapped[int] = mapped_column(BigInteger, primary_key=True, autoincrement=True)
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, default=lambda: datetime.now(UTC))
level: Mapped[str] = mapped_column(String(16), nullable=False, default="info")
stage: Mapped[str] = mapped_column(String(64), nullable=False)
event: Mapped[str] = mapped_column(String(256), nullable=False)
document_id: Mapped[uuid.UUID | None] = mapped_column(
UUID(as_uuid=True),
ForeignKey("documents.id", ondelete="SET NULL"),
nullable=True,
)
document_filename: Mapped[str | None] = mapped_column(String(512), nullable=True)
provider_id: Mapped[str | None] = mapped_column(String(128), nullable=True)
model_name: Mapped[str | None] = mapped_column(String(256), nullable=True)
prompt_text: Mapped[str | None] = mapped_column(Text, nullable=True)
response_text: Mapped[str | None] = mapped_column(Text, nullable=True)
payload_json: Mapped[dict] = mapped_column(JSONB, nullable=False, default=dict)