Exemple #1
0
class SourceChannel(NamedModel, db.Model):
    __tablename__ = 'sourcechannel'
    volume_id = db.Column(db.Integer, db.ForeignKey('volume.id'))
    source_url = db.Column(db.String(250), nullable=False)
    default_channel = db.Column(db.Boolean, nullable=False, default=False)
    type = db.Column(db.String(32), default='image')
    __mapper_args__ = {
        'polymorphic_on': 'type',
        'polymorphic_identity': ''
    }
Exemple #2
0
class Link(NamedModel, db.Model):
    __tablename__ = 'link'
    type = db.Column(db.String(32))
    link = db.Column(db.String(10000))
    __mapper_args__ = {
        'polymorphic_on': 'type',
        'polymorphic_identity': 'link'
    }

    def get_link_html(self):
        return '<a href="{}">{}</a>'.format(self.link, self.name)
Exemple #3
0
class Rating(TimestampMixin, db.Model):
    __tablename__ = "rating"
    type = db.Column(db.String(32))
    object_id = db.Column(
        db.Integer,
        db.ForeignKey('bioobject.id'),
        nullable=False,
    )
    rating_source_id = db.Column(
        db.Integer,
        db.ForeignKey('ratingsource.id'),
        nullable=False,
    )
    classificationtype_id = db.Column(db.Integer,
                                      db.ForeignKey('classificationtype.id'),
                                      nullable=False)
    confidence = db.Column(db.Float)
    classificationtype = db.relationship('ClassificationType')
    rating_source = db.relationship('RatingSource')
    object = db.relationship('BioObject')
    bool_rating = db.Column(db.Boolean)
    tert_rating = db.Column(db.Integer)

    def get_rating(self):
        '''generic function, need to implement for class'''
        pass

    __mapper_args__ = {
        'polymorphic_identity': 'rating',
        'polymorphic_on': 'type',
    }
Exemple #4
0
class RatingSource(NamedModel, db.Model):
    __tablename__ = "ratingsource"
    type = db.Column(db.String(32))
    __mapper_args__ = {
        'polymorphic_identity': 'ratingsource',
        'polymorphic_on': 'type',
    }
Exemple #5
0
class Synapse(BioObject):
    __tablename__ = None  # Add table name to be None
    __mapper_args__ = {'polymorphic_identity': 'synapse'}
    oid = db.Column(db.String(50))
    areas = db.Column(
        Geometry(geometry_type="MULTIPOLYGONZ",
                 management=True,
                 use_typmod=False,
                 srid=SYNAPSE_SRID,
                 dimension=3))
Exemple #6
0
class BioObject(db.Model):
    __tablename__ = "bioobject"  # Add table name to be None
    __mapper_args__ = {
        'polymorphic_identity': 'bioobject',
        'polymorphic_on': 'type',
    }
    object_collection_id = db.Column(db.Integer,
                                     db.ForeignKey('bioobjectcollection.id'))
    collection = db.relationship(BioObjectCollection)
    type = db.Column(db.String(32))
Exemple #7
0
class BioObjectCollection(NamedModel, db.Model):
    __tablename__ = 'bioobjectcollection'
    volume_id = db.Column(db.Integer, db.ForeignKey('volume.id'))
    volume = db.relationship('Volume')
    link_id = db.Column(db.Integer, db.ForeignKey('link.id'))
    link = db.relationship('Link')
    objects = db.relationship('BioObject')
    type = db.Column(db.String(32))
    __mapper_args__ = {
        'polymorphic_on': 'type',
        'polymorphic_identity': 'employee'
    }
Exemple #8
0
class NamedModel(object):
    name = db.Column(db.String(100), nullable=False)

    def __repr__(self):
        return "{}({})".format(self.name, self.id)
Exemple #9
0
class SynapseCollection(BioObjectCollection):
    __tablename__ = None  # Add table name to be None
    __mapper_args__ = {'polymorphic_identity': 'synapsecollection'}
    synapse_collection_type = db.Column(db.String(100))
Exemple #10
0
class ImageChannel(SourceChannel):
    __tablename__ = None
    default_color = db.Column(db.String(1))
    __mapper_args__ = {
        'polymorphic_identity': 'image'
    }
Exemple #11
0
class DataSet(NamedModel, db.Model):
    render_project = db.Column(db.String(50))
    render_owner = db.Column(db.String(50))
    volumes = db.relationship('Volume', backref='data_set')
Exemple #12
0
class ClassificationType(NamedModel, db.Model):
    __tablename__ = "classificationtype"
    rating_type = db.Column(db.String(40))
Exemple #13
0
class MachineLearningSource(RatingSource):
    algorithm = db.Column(db.String(100))
    __tablename__ = None
    __mapper_args__ = {
        'polymorphic_identity': 'machinelearning',
    }