class ApiKeys(db.Model):
    user_id = db.Column(db.Integer, primary_key=True)
    key = db.Column(db.String(256), unique=True)

    def __init__(self, key):
        """Return a disc object"""
        self.key = key

    def __str__(self):
        """Returns a string of the object"""
        return ""

    def __repr__(self):
        return '<Job {}>'.format(self.user_id)
Exemple #2
0
class Job(db.Model):
    __tablename__ = 'extract_job'

    id = db.Column('Job_ID', db.Integer, primary_key=True)
    date_created = db.Column('Creation_Date', db.DateTime, nullable=False)
    web_cls_num = db.Column('WEB_CLASS_NUM', db.Integer)
    attr_nm = db.Column('ATTR_NM', db.Text)
    status = db.Column('status', db.Integer)

    #results_filename  = db.Column('Results_Filename', db.String(128), nullable=False)
    #results_notes     = db.Column('Results_Notes', db.String(256), default=None)
    #status = db.Column('Status', db.String(32), nullable=False, default='Incomplete')
    #results = db.relationship('Result', backref='extract_job', lazy='dynamic')
    #models = db.relationship('TrainedModel', backref='extract_job', lazy='dynamic')

    def __repr__(self):
        return f'Job("{self.id}")'
Exemple #3
0
class Review(db.Model):
    __tablename__ = 'match_review'

    id = db.Column('id', db.Integer, primary_key=True, autoincrement=True)
    sku_num = db.Column('SKU_NUM', db.String(50))
    item_desc = db.Column('ITEM_DESC', db.Text)
    attr_nm = db.Column('ATTR_NM', db.Text)
    attr_val = db.Column('ATTR_VAL', db.Text)
    attr_val_rev = db.Column('ATTR_VAL_Reviewed', db.Text, default=None)
    date_created = db.Column('Creation_Date', db.DateTime, nullable=False)
    web_cls_num = db.Column('WEB_CLASS_NUM', db.Integer)

    def __repr__(self):
        return f'Review("{self.id}")'
Exemple #4
0
class PyramidPool(db.Model):
    __tablename__ = 'pyr'

    sku_num = db.Column('SKU_NUM', db.String(50), primary_key=True)
    attr_nm = db.Column('ATTR_NM', db.Text, primary_key=True)
    web_cls_num = db.Column('WEB_CLASS_NUM', db.Integer)
    web_cls_nm = db.Column('WEB_CLASS', db.String(255))
    item_desc = db.Column('ITEM_DESC', db.Text)
    attr_val = db.Column('ATTR_VAL', db.Text)
Exemple #5
0
class TrainedModel(db.Model):
    __tablename__ = "trained_model"

    id = db.Column('Model_ID',
                   db.Integer,
                   primary_key=True,
                   autoincrement=True)
    date_created = db.Column('Creation_Date', db.DateTime, nullable=False)
    model_path = db.Column('Model_Path', db.Text)
    web_cls_num = db.Column('WEB_CLASS_NUM', db.Integer)
    attr_nm = db.Column('ATTR_NM', db.Text)
    job_id = db.Column('Job_ID', db.Integer,
                       db.ForeignKey('extract_job.Job_ID'))
    models = db.relationship('Result', backref='trained_model', lazy='dynamic')

    def __repr__(self):
        return f'<TrainedModel: {self.id}><Name: {self.name}>'
Exemple #6
0
class Result(db.Model):
    __tablename__ = 'extract_result'
    id = db.Column('id', db.Integer, primary_key=True, autoincrement=True)
    sku_num = db.Column('SKU_NUM', db.Text, nullable=False)
    item_desc = db.Column('ITEM_DESC', db.Text)
    attr_nm = db.Column('ATTR_NM', db.Text)
    attr_val = db.Column('ATTR_VAL', db.Text)
    pred_attr_val = db.Column('PRED_ATTR_VAL', db.Text)
    confidence = db.Column('Confidence', db.Float)
    date_created = db.Column('Creation_Date', db.DateTime, nullable=False)
    model_id = db.Column('Model_ID',
                         db.Integer,
                         db.ForeignKey('trained_model.Model_ID'),
                         nullable=False)
    job_id = db.Column('Job_ID',
                       db.Integer,
                       db.ForeignKey('extract_job.Job_ID'),
                       nullable=False)
    web_cls_num = db.Column('WEB_CLASS_NUM', db.Integer,
                            db.ForeignKey('PyramidPool.web_cls_num'))
    web_cls_nm = db.Column('WEB_CLASS_NM', db.Text)

    def __repr__(self):
        return f'Result("{self.id}")'
class Job(db.Model):
    job_id = db.Column(db.Integer, primary_key=True)
    crc_id = db.Column(db.String(63), unique=True, nullable=False)
    user_id = db.Column(db.String(63), nullable=False)
    date_added = db.Column(db.DateTime)

    no_of_titles = db.Column(db.Integer)
    title = db.Column(db.String(256), nullable=False)
    year = db.Column(db.String(4), nullable=False)
    video_type = db.Column(db.String(20))

    imdb_id = db.Column(db.String(15))
    tmdb_id = db.Column(db.String(15))
    omdb_id = db.Column(db.String(15))

    hasnicetitle = db.Column(db.Boolean)
    disctype = db.Column(db.String(20))  # dvd/bluray/data/music/unknown
    label = db.Column(db.String(256))
    validated = db.Column(db.Boolean)
    poster_img = db.Column(db.String(256))

    def __init__(self, crc, title, year):
        """Return a disc object"""
        self.crc_id = crc
        self.title = title
        self.year = year
        self.hasnicetitle = False
        self.video_type = "unknown"
        self.date_added = datetime.datetime.now()

    def __str__(self):
        """Returns a string of the object"""

        s = self.__class__.__name__ + ": "
        for attr, value in self.__dict__.items():
            s = s + "(" + str(attr) + "=" + str(value) + ") "
        return s

    def get_d(self):
        r = {}
        x = ("_sa_instance_state", "user_id", "job_id", "omdb_id")
        for key, value in self.__dict__.items():
            if key not in x:
                r[str(key)] = str(value)
        return r

    def __repr__(self):
        return '<Job {}>'.format(self.label)