Exemple #1
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 #2
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 #3
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 #4
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 #5
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 #6
0
class RatingSource(NamedModel, db.Model):
    __tablename__ = "ratingsource"
    type = db.Column(db.String(32))
    __mapper_args__ = {
        'polymorphic_identity': 'ratingsource',
        'polymorphic_on': 'type',
    }
Exemple #7
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 #8
0
class Volume(NamedModel, db.Model):
    channels = db.relationship('SourceChannel', backref='volume')
    dataset_id = db.Column(db.Integer, db.ForeignKey('data_set.id'))
    dataset = db.relationship('DataSet')
    links = db.relationship('VolumeLink', backref='volume')
    synapse_collections = db.relationship('SynapseCollection',
                                          backref='synvolume')

    def get_neuroglancer_layers(self):
        ds = []
        for chan in self.channels:
            if chan.default_channel:
                d = {
                    'source': chan.source_url,
                    'blend': 'additive'
                }
                if chan.default_color:
                    d['color'] = chan.default_color
                ds.append(d)
        return ds
Exemple #9
0
class NamedModel(object):
    name = db.Column(db.String(100), nullable=False)

    def __repr__(self):
        return "{}({})".format(self.name, self.id)
Exemple #10
0
class MachineLearningSource(RatingSource):
    algorithm = db.Column(db.String(100))
    __tablename__ = None
    __mapper_args__ = {
        'polymorphic_identity': 'machinelearning',
    }
Exemple #11
0
class UserRatingSource(RatingSource):
    user_id = db.Column(db.Integer)
    __tablename__ = None
    __mapper_args__ = {
        'polymorphic_identity': 'user',
    }
Exemple #12
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 #13
0
class ClassificationType(NamedModel, db.Model):
    __tablename__ = "classificationtype"
    rating_type = db.Column(db.String(40))
Exemple #14
0
class VolumeLink(Link):
    __tablename__ = None
    volume_id = db.Column(db.Integer, db.ForeignKey('volume.id'))
    __mapper_args__ = {
        'polymorphic_identity': 'volumelink'
    }
Exemple #15
0
class TimestampMixin(object):
    created = db.Column(db.DateTime, nullable=False, default=datetime.now())
    updated = db.Column(db.DateTime, onupdate=datetime.now())
Exemple #16
0
class ImageChannel(SourceChannel):
    __tablename__ = None
    default_color = db.Column(db.String(1))
    __mapper_args__ = {
        'polymorphic_identity': 'image'
    }
Exemple #17
0
class ConsensusSource(RatingSource):
    rating_sources = db.Column(ARRAY(db.Integer))
    __tablename__ = None
    __mapper_args__ = {
        'polymorphic_identity': 'consensus',
    }
Exemple #18
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')