AIEXTRACT1 / backend /app /models.py
Seth0330's picture
Create backend/app/models.py
1df9f6e verified
from sqlalchemy import Column, Integer, String, Float, DateTime, Text
from sqlalchemy.sql import func
from .db import Base
class ExtractionRecord(Base):
"""
Stores one extraction run so the History page can show past jobs.
We’ll fill it from the /api/extract endpoint later.
"""
__tablename__ = "extractions"
id = Column(Integer, primary_key=True, index=True)
file_name = Column(String, index=True)
file_type = Column(String)
file_size = Column(String)
status = Column(String) # "completed" | "failed"
confidence = Column(Float) # overall confidence (0–100)
fields_extracted = Column(Integer) # number of fields extracted
total_time_ms = Column(Integer) # total processing time in ms
raw_output = Column(Text) # JSON string from the model
error_message = Column(Text, nullable=True)
created_at = Column(
DateTime(timezone=True),
server_default=func.now(),
)