class Annotation(db.Model): id = db.Column(db.Integer, primary_key=True) start_time = db.Column(db.Float, nullable=True) end_time = db.Column(db.Float, nullable=True) annotationtag_id = db.Column(db.Integer, db.ForeignKey(AnnotationTag.id), nullable=False) project_id = db.Column(db.Integer, db.ForeignKey('project.id'), nullable=False) audio_id = db.Column(db.Integer, db.ForeignKey('audio.id'), nullable=False) user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=False) def __repr__(self): return '<id {}>'.format(self.id)
class AnnotationTag(db.Model): id = db.Column(db.Integer, primary_key=True) tagtype_id = db.Column(db.Integer, db.ForeignKey(TagType.id), nullable=False) name = db.Column(db.String, nullable=False) annotations = db.relationship('Annotation', backref='annotationtag', lazy='dynamic', cascade='all') __table_args__ = (UniqueConstraint('name', 'tagtype_id'),) def __repr__(self): return '<name {}>'.format(self.name)
id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, unique=True, nullable=False) annotationtags = db.relationship('AnnotationTag', backref='tagtype', lazy='dynamic') def __repr__(self): return '<name {}>'.format(self.name) audio_project_rel = db.Table( 'audio_project_rel', db.Column('project_id', db.Integer, db.ForeignKey('project.id'), primary_key=True), db.Column('audio_id', db.Integer, db.ForeignKey('audio.id'), primary_key=True)) annotationtag_project_rel = db.Table( 'annotationtag_project_rel', db.Column('project_id', db.Integer, db.ForeignKey('project.id'), primary_key=True), db.Column('annotationtag_id', db.Integer, db.ForeignKey('annotation_tag.id'),
class TagType(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, unique=True, nullable=False) annotationtags = db.relationship('AnnotationTag', backref='tagtype', lazy='dynamic') def __repr__(self): return '<name {}>'.format(self.name) audio_project_rel = db.Table('audio_project_rel', db.Column('project_id', db.Integer, db.ForeignKey('project.id'), primary_key=True), db.Column('audio_id', db.Integer, db.ForeignKey('audio.id'), primary_key=True) ) annotationtag_project_rel = db.Table('annotationtag_project_rel', db.Column('project_id', db.Integer, db.ForeignKey('project.id'), primary_key=True), db.Column('annotationtag_id', db.Integer, db.ForeignKey('annotation_tag.id'), primary_key=True) ) class Project(db.Model): id = db.Column(db.Integer, primary_key=True) name = db.Column(db.String, unique=True, nullable=False) audio_root_url = db.Column(db.String, nullable=False)