
- Set up FastAPI application structure - Implement SQLite database with SQLAlchemy - Create WhatsApp webhook endpoints - Implement message storage and analysis - Integrate Gemini 2.5 Pro for message analysis - Add email delivery of insights - Configure APScheduler for weekend analysis - Add linting with Ruff
30 lines
785 B
Python
30 lines
785 B
Python
"""
|
|
SQLAlchemy models for message analyses.
|
|
"""
|
|
|
|
from sqlalchemy import Column, DateTime, Integer, Text
|
|
from sqlalchemy.sql import func
|
|
|
|
from app.db.base_class import Base
|
|
|
|
|
|
class Analysis(Base):
|
|
"""
|
|
Model for storing message analysis results.
|
|
"""
|
|
id = Column(Integer, primary_key=True, index=True)
|
|
|
|
# Analysis details
|
|
analysis_text = Column(Text, nullable=False)
|
|
|
|
# Metadata
|
|
created_at = Column(DateTime, default=func.now(), nullable=False, index=True)
|
|
start_date = Column(DateTime, nullable=False)
|
|
end_date = Column(DateTime, nullable=False)
|
|
|
|
def __repr__(self) -> str:
|
|
"""
|
|
String representation of the analysis.
|
|
"""
|
|
return f"<Analysis {self.id}: {self.start_date} to {self.end_date} at {self.created_at}>"
|