Spaces:
Runtime error
Runtime error
| """ | |
| Assignment Template model - Reusable assignment configurations created by therapists | |
| """ | |
| from sqlalchemy import Column, Integer, String, ForeignKey, DateTime, JSON, Text, Boolean | |
| from sqlalchemy.orm import relationship | |
| from sqlalchemy.sql import func | |
| from config.database import Base | |
| class AssignmentTemplate(Base): | |
| __tablename__ = "assignment_templates" | |
| id = Column(Integer, primary_key=True) | |
| therapist_id = Column(Integer, ForeignKey("therapists.id"), nullable=False) | |
| # Template details | |
| name = Column(String, nullable=False) # Template name for easy identification | |
| title = Column(String, nullable=False) # Default assignment title | |
| description = Column(Text) | |
| practice_type = Column(String, nullable=False) # conversation, reading, articulation | |
| technique = Column(String, nullable=False) # normal, prolonged_speech, easy_onset | |
| # Default requirements | |
| target_sessions = Column(Integer, default=1) | |
| target_duration_minutes = Column(Integer, default=10) | |
| # Specific parameters | |
| parameters = Column(JSON) # {topic, difficulty, target_sounds, etc.} | |
| # Metadata | |
| created_at = Column(DateTime(timezone=True), server_default=func.now()) | |
| updated_at = Column(DateTime(timezone=True), onupdate=func.now()) | |
| is_active = Column(Boolean, default=True) | |
| # Relationships | |
| therapist = relationship("Therapist", back_populates="templates") | |
| def __repr__(self): | |
| return f"<AssignmentTemplate {self.id} - {self.name}>" |