AndesOps-AI / backend /app /models /tender.py
Álvaro Valenzuela Valdes
feat: integrate buyer risk intelligence and scraped tender details into agent analysis
26fba59
from sqlalchemy import Column, String, Float, DateTime, Text, JSON
from app.database import Base
from datetime import datetime
class TenderModel(Base):
__tablename__ = "tenders"
code = Column(String(50), primary_key=True, index=True)
name = Column(String(255), index=True)
buyer = Column(String(255), index=True)
status = Column(String(100))
status_code = Column(String(10), nullable=True)
type = Column(String(20), nullable=True)
currency = Column(String(10), nullable=True)
closing_date = Column(DateTime, nullable=True)
publication_date = Column(DateTime, nullable=True)
description = Column(Text)
estimated_amount = Column(Float, nullable=True)
source = Column(String(50), default="Mercado Publico")
region = Column(String(100), nullable=True)
buyer_region = Column(String(100), nullable=True)
sector = Column(String(100), nullable=True)
# Storage for nested structures as JSON for simplicity in this hackathon
items = Column(JSON, nullable=True)
attachments = Column(JSON, nullable=True)
evaluation_criteria = Column(JSON, nullable=True)
contract_duration = Column(String(255), nullable=True)
detail_tabs = Column(JSON, nullable=True) # NEW: Extracted detail tabs
detail_metadata = Column(JSON, nullable=True) # NEW: Aggregated metadata
# Metadata for the app logic
last_updated = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow)
is_followed = Column(DateTime, nullable=True) # Date when it was followed, null if not