Initial commit
This commit is contained in:
31
backend/app/models/brief.py
Normal file
31
backend/app/models/brief.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from sqlalchemy import Column, Integer, String, Text, ForeignKey, DateTime, Index
|
||||
from sqlalchemy.dialects.postgresql import JSONB
|
||||
from sqlalchemy.orm import relationship
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class BillBrief(Base):
|
||||
__tablename__ = "bill_briefs"
|
||||
|
||||
id = Column(Integer, primary_key=True, autoincrement=True)
|
||||
bill_id = Column(String, ForeignKey("bills.bill_id", ondelete="CASCADE"), nullable=False)
|
||||
document_id = Column(Integer, ForeignKey("bill_documents.id", ondelete="SET NULL"), nullable=True)
|
||||
brief_type = Column(String(20), nullable=False, server_default="full") # full | amendment
|
||||
summary = Column(Text)
|
||||
key_points = Column(JSONB) # list[str]
|
||||
risks = Column(JSONB) # list[str]
|
||||
deadlines = Column(JSONB) # list[{date: str, description: str}]
|
||||
topic_tags = Column(JSONB) # list[str]
|
||||
llm_provider = Column(String(50))
|
||||
llm_model = Column(String(100))
|
||||
created_at = Column(DateTime(timezone=True), server_default=func.now())
|
||||
|
||||
bill = relationship("Bill", back_populates="briefs")
|
||||
document = relationship("BillDocument", back_populates="briefs")
|
||||
|
||||
__table_args__ = (
|
||||
Index("ix_bill_briefs_bill_id", "bill_id"),
|
||||
Index("ix_bill_briefs_topic_tags", "topic_tags", postgresql_using="gin"),
|
||||
)
|
||||
Reference in New Issue
Block a user