Ejemplo n.º 1
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',
    }
Ejemplo n.º 2
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'
    }
Ejemplo n.º 3
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))
Ejemplo n.º 4
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': ''
    }
Ejemplo n.º 5
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
Ejemplo n.º 6
0
class VolumeLink(Link):
    __tablename__ = None
    volume_id = db.Column(db.Integer, db.ForeignKey('volume.id'))
    __mapper_args__ = {
        'polymorphic_identity': 'volumelink'
    }