Spaces:
Sleeping
Sleeping
File size: 996 Bytes
1df9f6e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
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(),
)
|