예제 #1
0
class ReceiverCoverageStatistic(db.Model):
    __tablename__ = "receiver_coverage_statistics"

    id = db.Column(db.Integer, primary_key=True)

    date = db.Column(db.Date)
    location_mgrs_short = db.Column(db.String(9))
    is_trustworthy = db.Column(db.Boolean)

    messages_count = db.Column(db.Integer)
    max_distance = db.Column(db.Float(precision=2))
    max_normalized_quality = db.Column(db.Float(precision=2))
    max_signal_quality = db.Column(db.Float(precision=2))
    min_altitude = db.Column(db.Float(precision=2))
    max_altitude = db.Column(db.Float(precision=2))
    senders_count = db.Column(db.Integer)

    # Relations
    receiver_id = db.Column(db.Integer,
                            db.ForeignKey("receivers.id", ondelete="CASCADE"),
                            index=True)
    receiver = db.relationship("Receiver",
                               foreign_keys=[receiver_id],
                               backref=db.backref("receiver_coverage_stats",
                                                  order_by=date))

    __table_args__ = (db.Index('idx_receiver_coverage_statistics_uc',
                               'date',
                               'receiver_id',
                               'location_mgrs_short',
                               'is_trustworthy',
                               unique=True), )
예제 #2
0
class ReleasesBase(object):
	id          = db.Column(db.Integer, primary_key=True)
	@declared_attr
	def series(cls):
		return db.Column(db.Integer, db.ForeignKey('series.id'), index=True)

	published   = db.Column(db.DateTime, index=True, nullable=False)

	volume      = db.Column(db.Float(), index=True)
	chapter     = db.Column(db.Float(), index=True)
	fragment    = db.Column(db.Float(), index=True)
	postfix     = db.Column(db.Text())

	# We need to be able to filter the chapters to include in the logic for
	# determining the translation progress, because some annoying people
	# release things massively out of order. As such, we don't want someone
	# translating chapter 200 first to prevent the release of 0 - 199 from
	# showing up as progress.
	# As such, if include is false, the release is just ignored when looking for
	# the furthest chapter.
	# This is not currently exposed at all through the web-ui
	include     = db.Column(db.Boolean, nullable=False, index=True, default=False)

	srcurl      = db.Column(db.Text(), index=True)

	@declared_attr
	def tlgroup(cls):
		return db.Column(db.Integer, db.ForeignKey('translators.id'))

	@declared_attr
	def lang(cls):
		return db.Column(db.Integer, db.ForeignKey('language.id'))
예제 #3
0
class Trade(db.Model):
    # icode:str
    # rcode:str
    # pcode:str
    # procode:str
    # year:int
    # frequency:str
    # unitcode:str
    # valueflagcode:str
    # valueflag:str
    # growthrate:float
    # percentage:float
    __tablename__ = 'trade'
    icode = db.Column(db.String(5), nullable=False, primary_key=True)
    rcode = db.Column(db.String(5), nullable=False, primary_key=True)
    pcode = db.Column(db.String(5), nullable=False, primary_key=True)
    procode = db.Column(db.String(10), nullable=False, primary_key=True)
    year = db.Column(db.SmallInteger, nullable=False, primary_key=True)
    frequency = db.Column(db.String(6), nullable=False)
    unitcode = db.Column(db.String(5), nullable=False)
    unit = db.Column(db.String(20), nullable=False)
    valueflagcode = db.Column(db.String(5), default=None)
    valueflag = db.Column(db.String(20), default=None)
    tradevalue = db.Column(db.Integer, nullable=False)
    growthrate = db.Column(db.Float(5, 4), default=None)
    percentage = db.Column(db.Float(5, 5), default=None)
예제 #4
0
class TestPoint(db.Model):
    __tablename__ = 'TEST_POINT'
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(255), nullable=False)
    address = db.Column(db.String(255), nullable=False)
    city = db.Column(db.String(255), nullable=False)
    zip_code = db.Column(db.String(255))
    latitude = db.Column(db.Float(asdecimal=True), nullable=False)
    longitude = db.Column(db.Float(asdecimal=True), nullable=False)

    def save(self, session, **kwargs):
        model = TestPoint(**kwargs)
        session.add(model)
        return model

    @property
    def serialize(self):
        """Return object data in easily serializable format"""
        return {
            'id': self.id,
            'name': self.name,
            'address': self.address,
            'city': self.city,
            'zip_code': self.zip_code,
            'latitude': float(self.latitude),
            'longitude': float(self.longitude)
        }
예제 #5
0
class History(db.Model):
    __tablename__ = "history"

    id = db.Column(db.Integer, primary_key=True)
    date = db.Column(db.DateTime, nullable=False)
    open = db.Column(db.Float(precision=2))
    high = db.Column(db.Float(precision=2))
    low = db.Column(db.Float(precision=2))
    close = db.Column(db.Float(precision=2))
    volume = db.Column(db.Integer)
    ticker_id = db.Column(db.Integer,
                          db.ForeignKey("tickers.id", ondelete="CASCADE"),
                          nullable=False)

    def to_dict(self):
        data = {
            "id": self.id,
            "date": self.date,
            "open": self.open,
            "high": self.high,
            "low": self.low,
            "close": self.close,
            "volume": self.volume,
            "ticker_id": self.ticker_id
        }
        return data

    def __repr__(self):
        return f"<History object: {self.date}-{self.open}-{self.high}-{self.low}-{self.close}-{self.volume}" \
               f"{self.ticker_id}>"
예제 #6
0
class Texture(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    src = db.Column(db.String(512), index=True, unique=False, nullable=False)
    width = db.Column(db.Float(), index=False, nullable=False, default=0)
    height = db.Column(db.Float(), index=False, nullable=False, default=0)
    walls = db.relationship('Wall', backref='texture', lazy='dynamic')
    rooms = db.relationship('Room', backref='texture', lazy='dynamic')

    def __init__(self, src, width, height):
        self.src = src
        self.width = width
        self.height = height

    def save(self):
        db.session.add(self)
        db.session.commit()

    def update_texture(self):
        db.session.commit()

    def delete_texture(self):
        self.delete()
        db.session.commit()

    def to_dict(self):
        serialized = dict((col, getattr(self, col))
                          for col in list(self.__table__.columns.keys()))
        # serialized["device"] = self.device.to_dict() if self.device else None
        serialized["walls"] = [wall.to_dict() for wall in self.walls]
        serialized["rooms"] = [room.to_dict() for room in self.rooms]
        return serialized

    def __repr__(self):
        return '<Texture {}>'.format(self.src)
예제 #7
0
class FgLight(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    painting_id = db.Column(db.Integer(),
                            db.ForeignKey('painting.id'),
                            nullable=False)  # ForeignKey Painting table
    color = db.Column(db.String(16), index=True, nullable=False, default=0)
    x_pos = db.Column(db.Float(), index=False, nullable=False, default=0)
    y_pos = db.Column(db.Float(), index=False, nullable=False, default=0)
    z_pos = db.Column(db.Float(), index=False, nullable=False, default=0)

    def __init__(self, painting_id, color, x_pos, y_pos, z_pos):
        self.painting_id = painting_id
        self.color = color
        self.x_pos = x_pos
        self.y_pos = y_pos
        self.z_pos = z_pos

    def save(self):
        db.session.add(self)
        db.session.commit()

    def update_fg_light(self):
        db.session.commit()

    def delete_fg_light(self):
        self.delete()
        db.session.commit()

    def to_dict(self):
        serialized = dict((col, getattr(self, col))
                          for col in list(self.__table__.columns.keys()))
        return serialized

    def __repr__(self):
        return '<FgLight {}>'.format(self.color)
예제 #8
0
class Vital(db.Model, Serializer):
    __public__ = [
        'id', 'timestamp', 'user_id', 'tempinternal', 'tempexternal',
        'heartrate', 'bloodoxy', 'baro'
    ]
    id = db.Column(db.Integer, primary_key=True)
    timestamp = db.Column(db.DateTime)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    tempinternal = db.Column(db.Float(precision=4), default=0)
    tempexternal = db.Column(db.Float(precision=4), default=0)
    heartrate = db.Column(db.Float(precision=4), default=0)
    bloodoxy = db.Column(db.Float(precision=4), default=0)
    baro = db.Column(db.Float(precision=4), default=0)

    def __repr__(self):
        return u'DEVICE ID: %d %f %f' % (self.user_id, self.tempinternal,
                                         self.tempexternal)

    def __init__(self, user_id, tempinternal, tempexternal, heartrate,
                 bloodoxy, baro):
        self.timestamp = datetime.datetime.now()
        self.user_id = user_id
        self.tempinternal = tempinternal
        self.tempexternal = tempexternal
        self.heartrate = heartrate
        self.bloodoxy = bloodoxy
        self.baro = baro
예제 #9
0
class Player(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    playerName = db.Column(db.String(100))
    nickName = db.Column(db.String(100))
    teamName = db.Column(db.String(100))
    role = db.Column(db.String(100))
    totalKills = db.Column(db.Integer)
    totalAssists = db.Column(db.Integer)
    totalDeaths = db.Column(db.Integer)
    totalMatchs = db.Column(db.Integer)
    totalVictories = db.Column(db.Integer)
    kda = db.Column(db.Float(asdecimal=True))
    winningRate = db.Column(db.Float(asdecimal=True))

    def __init__(self, playerName, nickName, teamName, role, totalKills,
                 totalAssists, totalDeaths, totalMatchs, totalVictories, kda,
                 winningRate):
        self.playerName = playerName
        self.nickName = nickName
        self.teamName = teamName
        self.role = role
        self.totalKills = totalKills
        self.totalAssists = totalAssists
        self.totalDeaths = totalDeaths
        self.totalMatchs = totalMatchs
        self.totalVictories = totalVictories
        self.kda = kda
        self.winningRate = winningRate

    def __repr__():
        return 'Player {0}'.format(self.id)
예제 #10
0
class Event(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    description = db.Column(db.String(255))
    longitude = db.Column(db.Float(precision=8))
    latitude = db.Column(db.Float(precision=8))
    start_datetime = db.Column(db.DateTime)
    end_datetime = db.Column(db.DateTime)
예제 #11
0
class Burial(db.Model):
    __tablename__ = 'burials'

    # Most columns are strings -- even dates -- because
    # city data is free-form in cases where dates are fuzzy,
    # e.g., '1960?'.
    id = db.Column(db.Integer, primary_key=True)
    sd_type = db.Column(db.String())
    sd = db.Column(db.String())
    lot = db.Column(db.String())
    space = db.Column(db.String())
    lot_owner = db.Column(db.String())
    year_purch = db.Column(db.String())
    last_name = db.Column(db.String())
    first_name = db.Column(db.String())
    sex = db.Column(db.String())
    birth_date = db.Column(db.String())
    birth_place = db.Column(db.String())
    death_date = db.Column(db.String())
    age = db.Column(db.String())
    death_place = db.Column(db.String())
    death_cause = db.Column(db.String())
    burial_date = db.Column(db.String())
    notes = db.Column(db.String())
    more_notes = db.Column(db.String())
    hidden_notes = db.Column(db.String())
    lat = db.Column(db.Float())
    lng = db.Column(db.Float())
    headstone = db.Column(db.String())

    def __repr__(self):
        return '<burial id=%d, last_name=%s, first_name=%s ...>' % \
            (self.id, self.last_name, self.first_name)
예제 #12
0
class Local(db.Model):
    __tablename__ = 'local'
    id_local = db.Column(db.Integer(), primary_key=True)
    nome = db.Column(db.String(80))
    path_foto = db.Column(db.String(80))
    descricao = db.Column(db.String(500))
    endereco = db.Column(db.String(120))
    lat = db.Column(db.Float(Precision=64))
    lng = db.Column(db.Float(Precision=64))

    instagram_1 = db.Column(db.String(150))
    instagram_2 = db.Column(db.String(150))
    instagram_3 = db.Column(db.String(150))

    agendas = db.relationship("Agenda",
                              secondary=agenda_local,
                              back_populates="locais")

    cidade_id = db.Column(db.Integer, db.ForeignKey('cidade.id_cidade'))
    cidade = db.relationship("Cidade", back_populates="locais")

    tags = db.relationship("Tag", secondary="local_tag", backref="locais")

    def __str__(self):
        return self.nome
예제 #13
0
class User(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(80))
    name = db.Column(db.String(80))
    email = db.Column(db.String(120), unique=True)
    account_type = db.Column(db.String(120), default='default')
    social_id = db.Column(db.Integer(120))
    social_network = db.Column(db.String(120))
    latitude = db.Column(db.Float(20))
    longitude = db.Column(db.Float(20))
    joined_date = db.Column(db.DateTime(), default=datetime.now)

    def __init__(self, name, username, email, password,
                 latitude, longitude, social_id, social_network):
        self.name = name
        self.username = username
        self.password = password
        self.email = email
        self.latitude = latitude
        self.longitude = longitude
        self.social_id = social_id
        self.social_network = social_network

    def __repr__(self):
        return "<User %r>" % self.username
예제 #14
0
class Pet(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(120))
    species = db.Column(db.String(32))
    color = db.Column(db.String(32))
    breed = db.Column(db.String(32))
    gender = db.Column(db.String(32))
    description = db.Column(db.Text())

    indoor_pet = db.Column(db.Boolean(), default=True)
    status = db.Column(db.String(32))
    additional_info = db.Column(db.Text())

    owner_notified_last = db.Column(db.DateTime)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), nullable=True)

    home_address = db.Column(db.String(255))
    home_lat_coord = db.Column(db.Float(precision=8))
    home_long_coord = db.Column(db.Float(precision=8))
    secondary_address = db.Column(db.String(255))

    sighting_coords = db.Column(db.Text)
    picture = db.Column(db.String(200), default="")

    def __repr__(self):
        return '<Pet %r_%s>' % (self.name, self.id)
예제 #15
0
class FloorTexture(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    floor_id = db.Column(db.Integer(),
                         db.ForeignKey('floor.id'),
                         nullable=False)  # ForeignKey User table
    src = db.Column(db.String(512), index=True, unique=False, nullable=False)
    width = db.Column(db.Float(), index=False, nullable=False, default=0)
    height = db.Column(db.Float(), index=False, nullable=False, default=0)

    def __init__(self, src, floor_id, width, height):
        self.src = src
        self.floor_id = floor_id
        self.width = width
        self.height = height

    def save(self):
        db.session.add(self)
        db.session.commit()

    def update_texture(self):
        db.session.commit()

    def delete_texture(self):
        self.delete()
        db.session.commit()

    def to_dict(self):
        serialized = dict((col, getattr(self, col))
                          for col in list(self.__table__.columns.keys()))
        # serialized["device"] = self.device.to_dict() if self.device else None
        return serialized

    def __repr__(self):
        return '<Texture {}>'.format(self.src)
예제 #16
0
class Applicant(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(64), index=True, nullable=False)
    student_id = db.Column(db.String(16), unique=True, nullable=False)
    college = db.Column(db.String(30))
    major = db.Column(db.String(30))
    gpa = db.Column(db.Float('2,1'))
    language_type = db.Column(db.Enum('TOEFL', 'IELTS'))
    language_reading = db.Column(db.Integer)
    language_listening = db.Column(db.Integer)
    language_speaking = db.Column(db.Integer)
    language_writing = db.Column(db.Integer)
    gre_verbal = db.Column(db.Integer)
    gre_quantitative = db.Column(db.Integer)
    gre_writing = db.Column(db.Float('2,1'))
    research_id = db.Column(db.Integer,
                            db.ForeignKey('research.id'),
                            nullable=False)
    project_id = db.Column(db.Integer,
                           db.ForeignKey('project.id'),
                           nullable=False)
    recommendation_id = db.Column(db.Integer,
                                  db.ForeignKey('recommendation.id'),
                                  nullable=False)
    applications = db.relationship('Application',
                                   backref='applicant',
                                   lazy='dynamic')
    email = db.Column(db.String(128), nullable=True)
    user_id = db.relationship('User', backref='applicant', uselist=False)

    def __repr__(self):
        return '<Applicant {}>'.format(self.username)
예제 #17
0
class Icon(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    user_id = db.Column(db.Integer(), db.ForeignKey('user.id'),
                        nullable=False)  # ForeignKey User table
    src = db.Column(db.String(512), index=True, unique=True, nullable=False)
    width = db.Column(db.Float(), index=False, nullable=False, default=0)
    height = db.Column(db.Float(), index=False, nullable=False, default=0)

    def __init__(self, user_id, src, width, height):
        self.user_id = user_id
        self.src = src
        self.width = width
        self.height = height

    def save(self):
        db.session.add(self)
        db.session.commit()

    def update_icon(self):
        db.session.commit()

    def delete_icon(self):
        self.delete()
        db.session.commit()

    def to_dict(self):
        serialized = dict((col, getattr(self, col))
                          for col in list(self.__table__.columns.keys()))
        return serialized

    def __repr__(self):
        return '<Icon {}>'.format(self.src)
예제 #18
0
class Student(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    name = db.Column(db.String(140))
    email = db.Column(db.String(140))
    phone = db.Column(db.String(15))
    perm_addr = db.Column(db.String(500))

    qualification = db.Column(db.String(140))
    passout = db.Column(db.String(10))
    stream = db.Column(db.String(50))
    college = db.Column(db.String(500))

    tenth_percent = db.Column(db.Float())  #U may add precession later
    plus2_percent = db.Column(db.Float())
    degree_percent = db.Column(db.Float())
    n_backlogs = db.Column(db.Integer)

    courses = db.Column(
        db.String(1024))  # Expect it to be comma seperated in input
    skills = db.Column(
        db.String(2048))  # Find text based search for this field

    hobbies = db.Column(db.String(1024))

    user_id = db.Column(db.Integer, db.ForeignKey('user.id'), unique=True)

    def __repr__(self):
        return '<Student {}>'.format(self.name)
예제 #19
0
class PicSize(db.Model):
    id = db.Column(db.Integer(), primary_key=True)
    painting_id = db.Column(db.Integer(),
                            db.ForeignKey('painting.id'),
                            nullable=False)  # ForeignKey Painting table
    width = db.Column(db.Float(), index=False, nullable=False, default=0)
    height = db.Column(db.Float(), index=False, nullable=False, default=0)

    def __init__(self, painting_id, width, height):
        self.painting_id = painting_id
        self.width = width
        self.height = height

    def save(self):
        db.session.add(self)
        db.session.commit()

    def update_pic_size(self):
        db.session.commit()

    def delete_pic_size(self):
        self.delete()
        db.session.commit()

    def to_dict(self):
        serialized = dict((col, getattr(self, col))
                          for col in list(self.__table__.columns.keys()))
        return serialized

    def __repr__(self):
        return '<PicSize {}>'.format(self.id)
예제 #20
0
class Drink(db.Model):
    __tablename__ = 'drink'
    name = db.Column(db.Text(), primary_key=True)
    description = db.Column(db.Text(), nullable=True)
    vbytes = db.Column(db.Text(), nullable=False)
    type = db.Column(db.Text(), nullable=False)
    price = db.Column(db.Float(), nullable=True)
    origin = db.Column(db.Text(), nullable=True)
    abv = db.Column(db.Float(), nullable=True)
    rating = db.Column(db.Text(), nullable=True)
    reviews = db.Column(db.Text(), nullable=True)
    url = db.Column(db.Text(), nullable=True)
    base = db.Column(db.Text(), nullable=True)

    def __repr__(self):
        return '<Drink {}>'.format(self.name)
    
    # from here https://stackoverflow.com/questions/7102754/jsonify-a-sqlalchemy-result-set-in-flask
    @property
    def serialize(self):
        """Return object data in easily serializable format"""
        return {
            'name': self.name,
            'description': self.description,
            'type': self.type,
            'price': self.price,
            'origin': self.origin,
            'abv': self.abv,
            'rating': self.rating,
            # 'reviews': self.reviews,
            'url': self.url,
            'base': self.base
        }
예제 #21
0
class Item(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    item_name = db.Column(db.String(64), index=True)
    item_description = db.Column(db.String(1500))
    seller_id = db.Column(db.Integer, db.ForeignKey('user.id'))
    price = db.Column(db.Float(precision=2, asdecimal=True))
    posted_on = db.Column(db.DateTime, default=datetime.utcnow)
    num_available = db.Column(db.Integer, default=0)
    initial_supply = db.Column(db.Integer, default=0)
    in_cart_of = db.relationship(
        'User',
        secondary=cart,
        primaryjoin=(cart.c.item_id == id),
        backref=db.backref('cart', lazy='dynamic'),
        lazy='dynamic')  # All of the carts that an item is in
    num_purchased = db.Column(db.Integer, default=0)
    supplied_in = db.relationship(
        'Sellerorder',
        secondary=itemSellerOrder,
        primaryjoin=(itemSellerOrder.c.item_id == id),
        backref=db.backref('itemSellerOrder', lazy='dynamic'),
        lazy='dynamic')  # All of the seller orders that an item exists in
    bought_in = db.relationship(
        'Buyerorder',
        secondary=itemBuyerOrder,
        primaryjoin=(itemBuyerOrder.c.item_id == id),
        backref=db.backref('itemBuyerOrder', lazy='dynamic'),
        lazy='dynamic')  # All of the buyer orders that an item exists in
    reviews = db.relationship('Review', backref='reviewed', lazy='dynamic')
    rating = db.Column(db.Float(precision=2, asdecimal=True), default=0.0)
예제 #22
0
파일: models.py 프로젝트: aneeshnema/binge
class Movie(db.Model):
    __searchable__ = ['title']
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(120), index=True, nullable=False)
    released = db.Column(db.DateTime, index=True, default=datetime.utcnow)
    runtime = db.Column(db.Integer)
    genre = db.Column(db.String(100))
    director = db.Column(db.String(64))
    actors = db.Column(db.String(160))
    plot = db.Column(db.String(600))
    poster = db.Column(db.String(300))
    imdb_rating = db.Column(db.Float(4))
    imdb_id = db.Column(db.String(9))
    production = db.Column(db.String(64))
    rating = db.Column(db.Float(4), default=0)
    count = db.Column(db.Integer, default=0)
    reviews = db.relationship('Review', backref='movie', lazy='dynamic')
    similar = db.relationship('Movie', secondary=similarto,
        primaryjoin=(similarto.c.movie_id == id),
        secondaryjoin=(similarto.c.similar_id == id),
        lazy='dynamic')
    last_recommended = db.Column(db.DateTime, default=datetime(1970,1,1,0,0,0))

    def __repr__(self):
        return '<Movie {} {:.2f}>'.format(self.title, self.rating)
예제 #23
0
class Variants(db.Model):
    __tablename__ = 'Variants'

    item_code = db.Column(db.Integer, db.ForeignKey("Items.item_code"), primary_key = True, autoincrement=True)
    cost_price = db.Column(db.Float())
    selling_price = db.Column(db.Float())
    quantity = db.Column(db.Integer)
예제 #24
0
class DID(db.Model, BaseModel):
    __tablename__ = 'DID'

    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    value = db.Column(db.String(), nullable=False)
    monthyPrice = db.Column(db.Float(), nullable=False)
    setupPrice = db.Column(db.Float(), nullable=False)
    currency = db.Column(db.String(), nullable=False)
    saleDate = db.Column(db.Date(), default=None)
    active = db.Column(db.Boolean(), default=True)

    def __init__(self, value, monthyPrice, setupPrice, currency):
        self.value = value
        self.monthyPrice = decimal.Decimal(monthyPrice).quantize(decimal.Decimal('.01'), rounding=decimal.ROUND_HALF_UP)
        self.setupPrice = decimal.Decimal(setupPrice).quantize(decimal.Decimal('.01'), rounding=decimal.ROUND_HALF_UP)
        self.currency = currency

    def __repr__(self):
        return '<id {}>'.format(self.id)
    
    def serialize(self):
        return {
            'id': self.id, 
            'value': self.value,
            'monthyPrice': self.monthyPrice,
            'setupPrice': self.setupPrice,
            'currency': self.currency
        }
예제 #25
0
class SeriesBase(object):
	id          = db.Column(db.Integer, primary_key=True)
	title       = db.Column(CIText())
	description = db.Column(db.Text())
	type        = db.Column(db.Text())
	origin_loc  = db.Column(db.Text())
	demographic = db.Column(db.Text())
	orig_lang   = db.Column(db.Text())

	website     = db.Column(db.Text())

	orig_status = db.Column(db.Text())

	region      = db.Column(region_enum, default='unknown')
	sort_mode   = db.Column(series_sort_enum, default='parsed_title_order')
	tl_type     = db.Column(tl_type_enum, nullable=False, index=True)
	# tl_complete = db.Column(db.Boolean, nullable=False, default=False)
	license_en  = db.Column(db.Boolean)

	pub_date    = db.Column(db.DateTime)

	latest_published   = db.Column(db.DateTime)

	latest_volume      = db.Column(db.Float())
	latest_chapter     = db.Column(db.Float())
	latest_fragment    = db.Column(db.Float())

	release_count      = db.Column(db.Integer())

	rating             = db.Column(db.Float())
	rating_count       = db.Column(db.Integer())

	__table_args__ = (
		CheckConstraint('''(rating >= 0 and rating <= 10) or rating IS NULL'''),
		)
예제 #26
0
파일: models.py 프로젝트: cbonoz/hackhlth
class Accel(db.Model):
    __tablename__ = 'accel'

    id = db.Column(db.Integer, primary_key=True)
    userId = db.Column(db.String())
    x = db.Column(db.Float())
    y = db.Column(db.Float())
    z = db.Column(db.Float())
    timestamp = db.Column(db.Float())

    @property
    def serialize(self):
        return {
            'x': self.x,
            'y': self.y,
            'z': self.z,
            'userId': self.userId,
            'timestamp': int(self.timestamp)
        }

    def __repr__(self):
        return "%s" % {
            'x': self.x,
            'y': self.y,
            'z': self.z,
            'userId': self.userId,
            'timestamp': int(self.timestamp)
        }
예제 #27
0
class Airport(db.Model):
    __tablename__ = "airports"

    id = db.Column(db.Integer, primary_key=True)

    location_wkt = db.Column("location", Geometry("POINT", srid=4326))
    altitude = db.Column(db.Float(precision=2))

    name = db.Column(db.String, index=True)
    code = db.Column(db.String(6))
    country_code = db.Column(db.String(2))
    style = db.Column(db.SmallInteger)
    description = db.Column(db.String)
    runway_direction = db.Column(db.SmallInteger)
    runway_length = db.Column(db.SmallInteger)
    frequency = db.Column(db.Float(precision=2))

    border = db.Column("border", Geometry("POLYGON", srid=4326))

    def __repr__(self):
        return "<Airport %s: %s,%s,%s,%s,%s,%s,%s,%s,%s,% s>" % (
            self.name,
            self.code,
            self.country_code,
            self.style,
            self.description,
            self.location_wkt.latitude,
            self.location_wkt.longitude,
            self.altitude,
            self.runway_direction,
            self.runway_length,
            self.frequency,
        )
예제 #28
0
class SignificantLocation(db.Model):
    id = db.Column(db.Integer, primary_key=True)
    location_name = db.Column(db.String(64), index=True)
    address = db.Column(db.String(128), index=True)
    latitude = db.Column(db.Float(53))
    longitude = db.Column(db.Float(53))
    last_check_in = db.Column(db.DateTime, index=True)
    user_id = db.Column(db.Integer, db.ForeignKey('user.id'))

    def __repr__(self):
        return '<SignificantLocation {}>'.format(self.location_address)

    def from_dictionary(self, data, user_id):
        for field in ['address', 'latitude', 'longitude']:
            if field in data:
                setattr(self, field, data[field])
        self.user_id = user_id

    def to_dictionary(self):
        data = {
            'id': self.id,
            'address': self.address,
            'latitude': self.latitude,
            'longitude': self.longitude,
            'last_check_in': self.last_check_in,
            'user_id': self.user_id,
            'associated_user': self.user.username
        }
        return data
예제 #29
0
class Metric(db.Model):
    __tablename__ = 'metric'

    id = db.Column(db.Integer, primary_key=True)
    hft_treatment_id = db.Column(db.Integer())
    threshold = db.Column(db.Integer())
    algorithm = db.Column(db.String())
    f1_score = db.Column(db.Float())
    accuracy = db.Column(db.Float())

    def __init__(self, hft_treatment_id, threshold, algorithm, f1_score,
                 accuracy):
        self.hft_treatment_id = hft_treatment_id
        self.threshold = threshold
        self.algorithm = algorithm
        self.f1_score = f1_score
        self.accuracy = accuracy

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

    def to_json(self):
        return {
            'hft_treatment_id': self.hft_treatment_id,
            'threshold': self.threshold,
            'algorithm': self.algorithm,
            'f1_score': self.f1_score,
            'accuracy': self.accuracy
        }
예제 #30
0
class Lancamentos(db.Model):

    #identificador único
    id = db.Column(db.Integer, primary_key=True)

    # > Tipo movimentação (debito/credito)
    tipo_movimentacao = db.Column(db.String(1), nullable=False)
    # > Descrição
    descricao = db.Column(db.String(150), nullable=False)
    # > Data lançamento
    data_lancamento = db.Column(db.Date, nullable=False)
    # > Data prevista: data prevista da operação a ser realizada
    data_prevista = db.Column(db.Date, nullable=False)
    # > Data efetivação: data real da entrada ou do pagamento
    data_efetivacao = db.Column(db.Date, nullable=True)
    # > Valor Previsto
    valor_previsto = db.Column(db.Float(15, 2), nullable=False)
    # > Valor Realizado
    valor_realizado = db.Column(db.Float(15, 2), nullable=True)
    # > Vínculo da conta que será referenciada
    contas_id = db.Column(db.Integer,
                          db.ForeignKey('contas.id'),
                          nullable=False)
    contas = db.relationship(Contas, backref='contas', lazy=True, uselist=True)

    def __repr__(self):
        return self.descricao