File size: 1,559 Bytes
e418416 | 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 34 35 | 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
|