from src.extensions import db import datetime class ImpactAnalysis(db.Model): __tablename__ = 'impact_analyses' id = db.Column(db.Integer, primary_key=True) # Using polymorphic association for document_id might be better, but for simplicity: document_id = db.Column(db.Integer, nullable=False) # Can be legislation_id, draft_id, or amendment_id document_type = db.Column(db.String, nullable=False) # 'Legislation', 'Draft', 'Amendment' analysis_type = db.Column(db.String, nullable=False) # e.g., 'Societal', 'Economic', 'Environmental' predicted_impact = db.Column(db.Text) confidence_score = db.Column(db.Float) rationale = db.Column(db.Text) generated_by_user_id = db.Column(db.Integer, db.ForeignKey('users.id')) generated_at = db.Column(db.DateTime, default=datetime.datetime.utcnow) # Add __table_args__ for potential index or constraints if needed later # Example: db.Index('idx_doc_type_id', 'document_type', 'document_id') def __repr__(self): return f''