Spaces:
Runtime error
Runtime error
File size: 1,408 Bytes
d646f8a 24ea8aa d646f8a | 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 36 37 38 39 | """
Practice Template model - Stores practice templates created by therapists
"""
from sqlalchemy import Column, Integer, String, JSON, DateTime, ForeignKey, Text
from sqlalchemy.orm import relationship
from sqlalchemy.sql import func
from config.database import Base
class PracticeTemplate(Base):
__tablename__ = "practice_templates"
id = Column(Integer, primary_key=True, index=True)
# User association (therapist who created the template)
user_id = Column(Integer, ForeignKey("users.id"), nullable=False)
# Template details
name = Column(String, nullable=False)
practice_type = Column(String, nullable=False) # 'articulation-single-words', 'articulation-phrases', 'motor-chaining', 'reading', 'conversation'
# Settings stored as JSON
settings = Column(JSON, nullable=False)
# Optional notes/description
notes = Column(Text, nullable=True)
# Usage tracking
usage_count = Column(Integer, default=0)
last_used = Column(DateTime(timezone=True), nullable=True)
# Timestamps
created_at = Column(DateTime(timezone=True), server_default=func.now())
updated_at = Column(DateTime(timezone=True), onupdate=func.now())
# Relationships
user = relationship("User", backref="practice_templates")
def __repr__(self):
return f"<PracticeTemplate {self.name} (type: {self.practice_type})>" |