class FeedbackVO(db.Model): __tablename__ = 'feedbackmaster' feedbackId = db.Column('feedbackId', db.INTEGER, primary_key=True, autoincrement=True) feedbackSubject = db.Column('feedbackSubject', db.VARCHAR(200), nullable=False) feedbackDescription = db.Column('feedbackDescription', db.VARCHAR(200), nullable=False) feedbackRating = db.Column('feedbackRating', db.INTEGER, nullable=False) feedbackDate = db.Column('feedbackDate', db.VARCHAR(100), nullable=False) feedbackTime = db.Column('feedbackTime', db.VARCHAR(100), nullable=False) feedbackTo_LoginId = db.Column('feedbackTo_LoginId', db.Integer, db.ForeignKey(LoginVO.loginId), nullable=True) feedbackFrom_LoginId = db.Column('feedbackFrom_LoginId', db.Integer, db.ForeignKey(LoginVO.loginId), nullable=False) def as_dict(self): return { 'feedbackId': self.feedbackId, 'feedbackSubject': self.feedbackSubject, 'feedbackDescription': self.feedbackDescription, 'feedbackRating': self.feedbackRating, 'feedbackDate': self.feedbackDate, 'feedbackTime': self.feedbackTime, 'feedbackTo_LoginId': self.feedbackTo_LoginId, 'feedbackFrom_LoginId': self.feedbackFrom_LoginId, }
class YoutubeComment(db.Model): __tablename__ = 'comment' video_id = db.Column(db.VARCHAR(12), db.ForeignKey('video.id')) # Thread_id is either the ID of the commmentThread object, or # the parentId of the commment snippet. # In the case that these two values are the same, # the item is a top-level comment. thread_id = db.Column(db.VARCHAR(100)) id = db.Column(db.VARCHAR(100), primary_key=True) # Snippet data # There is a field 'textOriginal', but one is only guaranteed # access to this if one is the original author (we never are) textDisplay = db.Column(db.VARCHAR(1000)) # Only valid for top-level comments. Always 0 for replies totalReplyCount = db.Column(db.Integer) authorDisplayName = db.Column(db.VARCHAR(100)) authorProfileImageUrl = db.Column(db.VARCHAR(100)) authorChannelUrl = db.Column(db.VARCHAR(100)) authorChannelId = db.Column(db.VARCHAR(100)) authorGooglePlusProfileUrl = db.Column(db.VARCHAR(100)) likeCount = db.Column(db.Integer) publishedAt = db.Column(db.DateTime(timezone=True)) updatedAt = db.Column(db.DateTime(timezone=True))
class VideoCategory(db.Model): __tablename__ = "categories" id = db.Column(db.Integer, primary_key=True) title = db.Column(db.VARCHAR(255)) channel_id = db.Column(db.VARCHAR(15)) def __init__(self, id, channel_id, title): self.id = id self.title = title self.channel_id = channel_id
class ImageVO(db.Model): __tablename__ = 'Imagemaster' imageId = db.Column('imageId', db.INTEGER, primary_key=True, autoincrement=True) imageFileName = db.Column('imageFileName', db.String(100)) imageFilePath = db.Column('imageFilePath', db.VARCHAR(200)) imageUploadDate = db.Column('imageUploadDate', db.String(100)) imageUploadTime = db.Column('imageUploadTime', db.String(100)) image_CropTypeId = db.Column('image_CropTypeId', db.Integer, db.ForeignKey(CropTypeVO.cropTypeId)) image_CropNameId = db.Column('image_CropNameId', db.Integer, db.ForeignKey(CropNameVO.cropNameId)) image_LoginId = db.Column('image_LoginId', db.INTEGER, db.ForeignKey(LoginVO.loginId), nullable=False) def as_dict(self): return { 'imageId': self.imageId, 'imageFileName': self.imageFileName, 'imageFilePath': self.imageFilePath, 'imageUploadDate': self.imageUploadDate, 'imageUploadTime': self.imageUploadTime, 'image_CropTypeId': self.image_CropTypeId, 'image_CropNameId': self.image_CropNameId, 'video_LoginId': self.video_LoginId }
class YoutubeVideo(db.Model): __tablename__ = "video" id = db.Column(db.VARCHAR(12), primary_key=True, unique=True) #random number needed for seed random selection random = db.Column(db.Integer) meta = db.relationship("YoutubeVideoMeta", backref="video", uselist=False) representations = db.relationship("VideoRepresentation", backref="video") comments = db.relationship("YoutubeComment", backref="video") def is_meta_available(self): if self.meta != None: return 1 else: return 0 def __init__(self, id, meta, representation): self.id = id self.meta = meta self.representation = representation def as_dict(self): return { 'id': self.id, #'representations':self.representations.as_dict(), 'meta': self.meta.as_dict() }
class QueryVideoMM(db.Model): __tablename__ = "query_video_mm" youtube_query_id = db.Column(db.Integer, db.ForeignKey('youtube_queries.id'), primary_key=True) video_id = db.Column(db.VARCHAR(12), db.ForeignKey('video.id'), primary_key=True) video = db.relationship("YoutubeVideo")
class DetectionVO(db.Model): __tablename__ = 'detectionmaster' detectionId = db.Column('detectionId', db.INTEGER, autoincrement=True, primary_key=True) detectionImageName = db.Column('detectionImageName', db.VARCHAR(100)) detectionImagePath = db.Column('detectionFilePath', db.VARCHAR(200)) detectionDate = db.Column('detectionUploadDate', db.VARCHAR(100), nullable=False) detectionTime = db.Column('detectionUploadTime', db.VARCHAR(100), nullable=False) detection_LoginId = db.Column('detection_LoginId', db.INTEGER, db.ForeignKey(LoginVO.loginId), nullable=False) detectionPrediction = db.Column('detectionPrediction', db.VARCHAR(200), nullable=False) def as_disct(self): return { 'detectionId': self.detectionId, 'detectionImageName': self.detectionImageName, 'detectionFilePath': self.detectionFilePath, 'detectionUploadDate': self.detectionUploadDate, 'detectionUploadTime': self.detectionUploadTime, 'detection_LoginId': self.detection_LoginId, 'detectionImage':self.detectionImage, 'detectionPrediction':self.detectionPrediction, 'detection_image': self.detection_image }
class VideoRepresentation(db.Model): __tablename__ = "videoRepresentation" video_id = db.Column(db.VARCHAR(12), db.ForeignKey('video.id'), primary_key=True) mimeType = db.Column(db.VARCHAR(15)) height = db.Column(db.Integer, primary_key=True) width = db.Column(db.Integer) bitrate = db.Column(db.Integer, primary_key=True) framerate = db.Column(db.Integer) codec = db.Column(db.VARCHAR(20)) def __init__(self, video_id, mimeType, bitrate, codec, framerate=0, height=0, width=0): self.video_id = video_id self.mimeType = mimeType self.bitrate = bitrate self.codec = codec self.framerate = framerate self.height = height self.width = width def as_dict(self): return { 'mimeType': self.mimeType, 'heigth': self.heigth, 'width': self.width, 'bitrate': self.bitrate, 'framerate': self.framerate, 'codec': self.codec }
class Task(db.Model): __tablename__ = "background_tasks" id = db.Column(db.VARCHAR(255), primary_key=True) action = db.Column(db.VARCHAR(255)) state = db.Column(db.VARCHAR(255)) result = db.Column(db.Text()) created_on = db.Column(db.DateTime(timezone=True)) query_id = db.Column(db.Integer, db.ForeignKey('youtube_queries.id')) def __init__(self, id, action): self.id = id self.action = action self.created_on = datetime.datetime.now() def as_dict(self): return { 'id': self.id, 'created_on': self.created_on, 'action': self.action, 'state': self.state, 'result': json.loads(self.result) if self.result is not None else None }
class DatasetVO(db.Model): __tablename__ = 'datasetmaster' datasetId = db.Column('datasetId', db.INTEGER, primary_key=True, autoincrement=True) datasetFileName = db.Column('datasetFileName', db.String(100)) datasetFilePath = db.Column('datasetFilePath', db.VARCHAR(200)) datasetUploadDate = db.Column('datasetUploadDate', db.String(100)) datasetUploadTime = db.Column('datasetUploadTime', db.String(100)) def dataset_dict(self): return { 'datasetId': self.datasetId, 'datasetFileName': self.datasetFileName, 'datasetFilePath': self.datasetFilePath, 'datasetUploadDate': self.datasetUploadDate, 'datasetUploadTime': self.datasetUploadTime }
class Investments(db.Model): __tablename__ = 'investments' id = db.Column(db.Integer, primary_key=True, autoincrement=True) email = db.Column(db.String(124), unique=True) name = db.Column(db.String(124), unique=True) address = db.Column(db.String(124)) cnpj = db.Column(db.VARCHAR()) found = relationship('Clients') #function to convert data in jsons def to_json(self): return { 'email': self.email, 'name': self.name, 'addess': self.address, 'cnpj': self.address, 'found': self.found }
class Clients(db.Model): __tablename__ = 'clients' id = db.Column(db.Integer, primary_key=True, autoincrement=True) id_investments = db.Column(db.Integer, db.ForeignKey('investments.id')) email = db.Column(db.String(124)) name = db.Column(db.String(124)) cpf = db.Column(db.VARCHAR()) quant_cotas = db.Column(db.Integer) id_found = db.Column(db.Integer, db.ForeignKey('found.id')) def to_json(self): return{ 'email': self.email, 'id_investments': self.id_investments, 'name': self.name, 'cpf': self.cpf, 'quant_cotas': self.quant_cotas, 'id_found': self.id_found }
class ComplainVO(db.Model): __tablename__ = 'complainmaster' complainId = db.Column('complainId', db.INTEGER, primary_key=True, autoincrement=True) complainSubject = db.Column('complainSubject', db.VARCHAR(200), nullable=False) complainDescription = db.Column('complainDescription', db.VARCHAR(200), nullable=False) complainDate = db.Column('complainDate', db.VARCHAR(100), nullable=False) complainTime = db.Column('complainTime', db.VARCHAR(100), nullable=False) complainStatus = db.Column('complainStatus', db.VARCHAR(100), nullable=False) complainFileName = db.Column('complainFileName', db.VARCHAR(100), nullable=True) complainFilePath = db.Column('complainFilePath', db.VARCHAR(200), nullable=True) complainTo_LoginId = db.Column('complainTo_LoginId', db.Integer, db.ForeignKey(LoginVO.loginId), nullable=True) complainFrom_LoginId = db.Column('complainFrom_LoginId', db.Integer, db.ForeignKey(LoginVO.loginId), nullable=False) replySubject = db.Column('replySubject', db.VARCHAR(200), nullable=True) replyMessage = db.Column('replyMessage', db.VARCHAR(100), nullable=True) replyFileName = db.Column('replyFileName', db.VARCHAR(200), nullable=True) replyFilePath = db.Column('replyFilePath', db.VARCHAR(200), nullable=True) replyDate = db.Column('replyDate', db.VARCHAR(100), nullable=True) replyTime = db.Column('replyTime', db.VARCHAR(100), nullable=True) def as_dict(self): return { 'complainId': self.complainId, 'complainSubject': self.complainSubject, 'complainDescription': self.complainDescription, 'complainDate': self.complainDate, 'complainTime': self.complainTime, 'complainStatus': self.complainStatus, 'complainFileName': self.complainFileName, 'complainFilePath': self.complainFilePath, 'complainTo_LoginId': self.complainTo_LoginId, 'complainFrom_LoginId': self.complainFrom_LoginId, 'replySubject': self.replySubject, 'replyMessage': self.replyMessage, 'replyFileName': self.replyFileName, 'replyFilePath': self.replyFilePath, 'replyDate': self.replyDate, 'replyTime': self.replyTime }
class YoutubeVideoMeta(db.Model): __tablename__ = "meta" id = db.Column(db.VARCHAR(12), db.ForeignKey("video.id"), primary_key=True, unique=True) snippet_publishedAt = db.Column(db.DateTime(timezone=True)) snippet_channel_id = db.Column(db.VARCHAR(50)) snippet_channel_title = db.Column(db.VARCHAR(100)) snippet_title = db.Column(db.Text()) snippet_description = db.Column(db.VARCHAR(5000)) snippet_category_id = db.Column(db.Integer, db.ForeignKey("categories.id")) snippet_tags = db.Column(db.Text()) snippet_liveBroadcastContent = db.Column(db.VARCHAR(10)) statistics_viewCount = db.Column(db.Integer) statistics_likeCount = db.Column(db.Integer) statistics_dislikeCount = db.Column(db.Integer) #deprecated since august 28, 2015. always set to zero statistics_favoriteCount = db.Column(db.Integer) statistics_commentCount = db.Column(db.Integer) status_uploadStatus = db.Column(db.VARCHAR(20)) status_privacyStatus = db.Column(db.VARCHAR(20)) status_license = db.Column(db.VARCHAR(20)) status_embeddable = db.Column(db.BOOLEAN) status_publicStatsViewable = db.Column(db.BOOLEAN) #the duration of the video is given as a ISO 8601 time interval contentDetails_duration = db.Column(db.VARCHAR(20)) #the ISO 8601 time interval calculated into seconds contentDetails_durationAsSeconds = db.Column(db.Integer) contentDetails_dimension = db.Column(db.VARCHAR(2)) contentDetails_definition = db.Column(db.VARCHAR(2)) #based on google documentation this field is a string, containing 'true' or 'false', if you want to use boolean instead, you have to manually convert the string into bool contentDetails_caption = db.Column(db.String(4)) contentDetails_licensedContent = db.Column(db.BOOLEAN) recordingDetails_location_latitude = db.Column(db.Float(precision='10,6')) recordingDetails_location_longitude = db.Column(db.Float(precision='10,6')) recordingDetails_location_altitude = db.Column(db.Float(precision='10,6')) recordingDetails_recordingDate = db.Column(db.DateTime(timezone=True)) def getCategoryId(self): return self.snippet_category_id def as_dict(self): return { 'snippet': { 'publishedAt': self.snippet_publishedAt, 'channelId': self.snippet_channel_id, 'channelTitle': self.snippet_channel_title, 'title': self.snippet_title, 'description': self.snippet_description, 'categoryId': self.snippet_category_id, 'tags': json.loads(self.snippet_tags) if self.snippet_tags != '' else None } }