class Live_sell(peewee.Model): id = peewee.BigIntegerField() time = peewee.DateTimeField() threshold = peewee.DoubleField() sell_price = peewee.DoubleField() class Meta: database = myDB
class Point(peewee.Model): point_id = peewee.IntegerField(primary_key=True) x_coordinate = peewee.DoubleField(db_column="x_coordinate") y_coordinate = peewee.DoubleField(db_column="y_coordinate") class Meta: database = db
class IHSInfo(ScanTable): ''' EHH scores for a given locus within a given population ''' population_set = pw.ForeignKeyField(PopulationSet) locus = pw.ForeignKeyField(LocusInfo) ones_freq = pw.DoubleField() IHH_1 = pw.DoubleField() IHH_0 = pw.DoubleField() IHS_unstandardized = pw.DoubleField() IHS_standardized = pw.DoubleField(null=True) class Meta(object): indexes = ((('locus', 'population_set'), True), ) def __str__(self): return ",".join([ str(self.population_set), str(self.locus), str(self.IHH_1), str(self.IHH_0), str(self.IHS_unstandardized), str(self.IHS_standardized) ])
class Visitor(BaseModel): shift = peewee.ForeignKeyField(Shift, related_name='visitors') name = peewee.CharField() time_in = peewee.DoubleField() time_out = peewee.DoubleField() time_delta = peewee.DoubleField() price = peewee.DoubleField() paid = peewee.DoubleField()
class Live_buy(peewee.Model): id = peewee.BigIntegerField() time = peewee.DateTimeField() threshold = peewee.DoubleField() expected_change = peewee.DoubleField() purchased_btc = peewee.DoubleField() class Meta: database = myDB
class FundHis(BaseModel): FdCode = peewee.CharField() Date = peewee.DateField(default=datetime.datetime.today) UnitNav = peewee.DoubleField() Yield = peewee.DoubleField() class Meta: primary_key = peewee.CompositeKey('FdCode', 'Date')
class Picture(Table): digest = peewee.BlobField(unique=True) camera_make = peewee.TextField(null=True) camera_model = peewee.TextField(null=True) latitude = peewee.DoubleField(null=True) longitude = peewee.DoubleField(null=True) date = peewee.FloatField() day = peewee.IntegerField() file_path = peewee.TextField()
class Image(BaseModel): from app.model.friend import Friend image_fb_id = pw.CharField() source_url = pw.CharField() x = pw.DoubleField() y = pw.DoubleField() persisted_face_id = pw.CharField() friend = pw.ForeignKeyField(Friend)
class Meteo(pw.Model): class Meta: database = _database date_time = pw.DateTimeField() wind_speed = pw.DoubleField() wind_direction = pw.DoubleField() ambient_temperature = pw.DoubleField() ambient_pressure = pw.DoubleField()
class Comments(MySQLModel): time = pw.DateTimeField() article_id = pw.IntegerField() cmmnt_type = pw.CharField() cmmnt_content = pw.TextField() p_value = pw.DoubleField() n_value = pw.DoubleField() class Meta: order_by = ('article_id', )
class Resultados(peewee.Model): fitness = peewee.DoubleField() codReproducao = peewee.IntegerField() codBuscaLocal = peewee.IntegerField() codMutacao = peewee.IntegerField() mediaPopulacao = peewee.DoubleField(null=True) execucao = peewee.ForeignKeyField(Execucao, to_field='execucao_id') class Meta: database = db
class FuncParam(BaseModel): dim_n = peewee.SmallIntegerField(null=False) interval_a = peewee.DoubleField(null=False) interval_b = peewee.DoubleField(null=False) accuracy_decimals = peewee.SmallIntegerField(null=False) def __str__(self): return ( f'FuncParam: n={self.dim_n} [{self.interval_a}; {self.interval_b}] ' f'q=10^-{self.accuracy_decimals}' )
class Product(MySQLModel): prod_id = pw.IntegerField() Prod_title = pw.CharField() Prod_desc = pw.TextField() time = pw.DateTimeField() prod_p_value = pw.DoubleField() prod_n_value = pw.DoubleField() # etc, etc class Meta: order_by = ('prod_id', )
class Order(BaseModel): id=p.AutoField(primary_key=True) products = JSONField(p.TextField(null=True)) credit_card=JSONField(default={}) shipping_information=JSONField(default={}) transaction= JSONField(default={}) shipping_price=p.DoubleField(default=0) being_paid=p.BooleanField(default=False) email=p.TextField(null=True) paid=p.BooleanField(default=False) total_price=p.DoubleField(default=0)
class Athletes(Base): id = pw.IntegerField(column_name='id', primary_key=True) name = pw.TextField(column_name='name') sex = pw.TextField(column_name='sex') age = pw.IntegerField(column_name='age') height = pw.DoubleField(column_name='height') weight = pw.DoubleField(column_name='weight') noc = pw.TextField(column_name='noc') sport = pw.TextField(column_name='sport') class Meta: tablename = 'athletes'
class Result(pw.Model): experiment = pw.ForeignKeyField(Experiment, backref='result', primary_key=True) auroc = pw.DoubleField(null=False) aupr = pw.DoubleField(null=False) fpr_at_tpr = pw.DoubleField(null=False) detection_error = pw.DoubleField(null=False) max_iou = pw.DoubleField(null=False) had_error = pw.BooleanField(null=False) class Meta: database = db
class ParamSet(BaseModel): """ De facto, Experiments which we are running """ encoding = JSONField( null=False, default=dict, ) init = peewee.CharField( null=False, choices=constants.INITS, ) sel_type = peewee.CharField( null=False, choices=constants.SEL_TYPES, ) L = peewee.IntegerField( null=False ) N = peewee.IntegerField( null=False ) stop_cond = JSONField( null=False, default=dict ) num_runsets = peewee.IntegerField( null=False ) num_runs = peewee.IntegerField( null=False ) crossover_pc = peewee.DoubleField( null=False ) result_pmax = peewee.DoubleField( null=True ) action_log = JSONField( null=False, default=list ) func_case = peewee.ForeignKeyField( FuncCase, null=False, on_delete='RESTRICT', lazy_load=True, backref='param_sets' )
class EventRecord(peewee.Model): class Meta: database = None db_table = "events" sensor = peewee.CharField(max_length = 16) event = peewee.CharField(max_length = 64) priority = peewee.IntegerField() timestamp = peewee.DoubleField() geotag = peewee.TextField(null = True) value_json = peewee.TextField() upload_time = peewee.DoubleField(null = True) condition = peewee.TextField(null = True)
class Transaction(BaseModel): id = peewee.IntegerField(primary_key=True) subscription_id = peewee.IntegerField(null=True) customer_id = peewee.IntegerField(null=True) address_id = peewee.IntegerField(null=True) phone_id = peewee.IntegerField(null=True) billing_id = peewee.IntegerField(null=True) card_id = peewee.CharField(max_length=30) status = peewee.CharField() status_reason = peewee.CharField() acquirer_response_code = peewee.CharField(null=True) acquirer_name = peewee.CharField(null=True) acquirer_id = peewee.CharField(null=True, max_length=24) authorization_code = peewee.CharField(null=True) soft_descriptor = peewee.CharField(null=True) tid = peewee.CharField(null=True) nsu = peewee.CharField(null=True) created_at = DateTimeTZField() updated_at = DateTimeTZField() amount = peewee.IntegerField() authorized_amount = peewee.IntegerField() paid_amount = peewee.IntegerField() refunded_amount = peewee.IntegerField() installments = peewee.IntegerField() cost = peewee.DoubleField() card_holder_name = peewee.CharField(null=True) card_last_digits = peewee.CharField(max_length=4) card_first_digits = peewee.CharField(max_length=6) card_brand = peewee.CharField(null=True) card_pin_mode = peewee.CharField(null=True) postback_url = peewee.CharField(null=True) payment_method = peewee.CharField() capture_method = peewee.CharField() antifraud_metadata = BinaryJSONField(null=True) antifraud_score = peewee.DoubleField(null=True) boleto_url = peewee.CharField(null=True) boleto_barcode = peewee.CharField(null=True) boleto_expiration_date = DateTimeTZField(null=True) referer = peewee.CharField(null=True) ip = peewee.CharField(null=True) reference_key = peewee.CharField(null=True) metadata = peewee.CharField(null=True) class Meta: db_table = "Transactions" indexes = ((("subscription_id", ), False), (("customer_id", ), False), (("address_id", ), False), (("phone_id", ), False), (("billing_id", ), False), (("card_id", ), False), (("capture_method", ), False), (("payment_method", ), False), (("status", ), False), (("tid", ), False))
class ItemsData(peewee.Model): date = peewee.ForeignKeyField(Date) varenummer = peewee.IntegerField() varenavn = peewee.CharField() volum = peewee.DoubleField() pris = peewee.DoubleField() literpris = peewee.DoubleField() land = peewee.CharField() alkohol = peewee.DoubleField() vareurl = peewee.CharField() varetype = peewee.CharField() class Meta: database = database
class Run(BaseModel): number = peewee.SmallIntegerField(null=False) is_succ = peewee.BooleanField(null=False) init_population = peewee.ForeignKeyField( InitPopulation, null=False, on_delete='RESTRICT', lazy_load=True, ) NFE = peewee.IntegerField(null=False) iter_num = peewee.IntegerField(null=False) avg_health = peewee.DoubleField(null=True) max_health = peewee.DoubleField(null=True) std_health = peewee.DoubleField(null=True) avg_health_deviation_to_opt_abs = peewee.DoubleField(null=True) avg_health_deviation_to_opt_rel = peewee.DoubleField(null=True) best_health_deviation_to_opt_abs = peewee.DoubleField(null=True) best_health_deviation_to_opt_rel = peewee.DoubleField(null=True) eucl_d_to_extremum = peewee.DoubleField(null=True) hamm_d_to_extremum = peewee.IntegerField(null=True) best_ind = peewee.DoubleField(null=True) best_ind_n = peewee.IntegerField(null=True) init_distr_health = ArrayField(peewee.IntegerField, null=True) final_distr_hamm = ArrayField(peewee.IntegerField, null=True) final_distr_health = ArrayField(peewee.IntegerField, null=True) final_distr_pairwise = ArrayField(peewee.IntegerField, null=True) max_avg_health_arr = ArrayField(peewee.DoubleField, null=True) avg_avg_health_arr = ArrayField(peewee.DoubleField, null=True) run_set = peewee.ForeignKeyField( RunSet, null=True, on_delete='RESTRICT', lazy_load=True, backref='runs' ) test_suite = peewee.ForeignKeyField( TestSuite, null=True, on_delete='RESTRICT', lazy_load=True, backref='test_runs' )
class Resultado_N_Execucoes(peewee.Model): id = peewee.IntegerField(primary_key=True) idExecucaoInicial = peewee.IntegerField(null=True) idExecucaoFinal = peewee.IntegerField(null=True) piorFinal = peewee.DoubleField(null=True) mediaMelhores = peewee.DoubleField(null=True) melhorIndividuo = peewee.DoubleField(null=True) desvioPadrao = peewee.DoubleField(null=True) instancia = peewee._StringField(null=True) comentarios = peewee._StringField(null=True) class Meta: database = db db_table = 'resultado_N_execucoes'
class Tomografias(pw.Model): paciente = pw.ForeignKeyField(Pacientes, backref='panoramicas', on_delete='CASCADE') aluno = pw.ForeignKeyField(Alunos, backref='tomografias', on_delete='CASCADE', null=True) valor = pw.DoubleField(null=True) data_entrega = pw.DateField(null=True) motivo = pw.CharField(null=True) parametrizacao = pw.ForeignKeyField(Parametrizacoes, backref='panoramica', on_delete='CASCADE') tipo = pw.CharField() # 'Maxila', 'Mandibula', 'ATM', 'Segmento', 'Elemento' especializacao = pw.CharField() # 'Ramos Mandibulares', 'Oclusao', 'Abertura' regiao = pw.CharField() elemento = pw.CharField() proporcao = pw.CharField() # '5x5', '6x8', '8x8', '8x15', '13x15' alvo = pw.CharField() # 'Alvo', 'Dente' resolucao = pw.CharField() # 'B', 'M', 'A' class Meta: database = db
class RawadcFileInfo(base_model): """Information about a raw ADC sample file. Attributes ---------- file : foreign key Reference to the file this information is about. start_time : float Start of acquisition in UNIX time. finish_time : float End of acquisition in UNIX time. """ file = pw.ForeignKeyField(ArchiveFile, backref="rawadcinfos") start_time = pw.DoubleField(null=True) finish_time = pw.DoubleField(null=True)
class FlagInputFileInfo(base_model): """Information about a flag input data file. Attributes ---------- file : foreign key Reference to the file this information is about. start_time : float Start of data in the file in UNIX time. finish_time : float End of data in the file in UNIX time. """ file = pw.ForeignKeyField(ArchiveFile, backref="flaginputinfos") start_time = pw.DoubleField(null=True) finish_time = pw.DoubleField(null=True)
class CalibrationGainFileInfo(base_model): """Information about a gain data file from the calibration broker. Attributes ---------- file : foreign key Reference to the file this information is about. start_time : float Start of data in the file in UNIX time. finish_time : float End of data in the file in UNIX time. """ file = pw.ForeignKeyField(ArchiveFile, backref="calibrationgaininfos") start_time = pw.DoubleField(null=True) finish_time = pw.DoubleField(null=True)
class LocusInfo(ScanTable): ''' Allele information for a given locus ''' chrom = pw.CharField(max_length=32) variant_id = pw.CharField(max_length=64) pos_bp = pw.IntegerField() map_pos_cm = pw.DoubleField() ref_allele = pw.CharField() alt_allele = pw.CharField() ancestral_call = pw.CharField(null=True) class Meta(object): indexes = ((('chrom', 'pos_bp', 'alt_allele'), True), ) def __str__(self): return ",".join([ str(self.chrom), str(self.variant_id), str(self.pos_bp), str(self.map_pos_cm), str(self.ref_allele), str(self.alt_allele), str(self.ancestral_call) ])
class DistanceMeasure(BaseModel): '''Stores the "distance" between any two sets of features in the database. A distance, in this sense, is just measure of dissimilarity between two entities, where a distance may only be zero if the two entities are identical. This is not necessarily the formal definition of a distance, which describes a metric on some space. For example, a divergence between two probability distributions is a measure of dissimilarity but is not necessarily symmetric. Attributes ---------- source : :class:`Feature` the first element target : :class:`Feature` the second element distance : double the distance from the source to the target measure : str type of measure (e.g. Euclidean distance between image feature vectors) symmetric : bool the distance measure is symmetric, meaning that the distance from A to B is the same as the distance from B to A similarity : bool stored values are a measure of *similarity* rather than dissimilarity ''' source = peewee.ForeignKeyField(Feature) target = peewee.ForeignKeyField(Feature) distance = peewee.DoubleField() measure = peewee.TextField() symmetric = peewee.BooleanField() similarity = peewee.BooleanField() class Meta: indexes = ((('source', 'target'), True), )
class building(BaseModel): id_field = peewee.PrimaryKeyField() code = peewee.CharField() name = peewee.CharField() phone = peewee.CharField() email = peewee.CharField() opening_hour_weekday = peewee.CharField() closing_hour_weekday = peewee.CharField() opening_hour_weekend = peewee.CharField(default="Closed") closing_hour_weekend = peewee.CharField(default="Closed") lat = peewee.DoubleField() lon = peewee.DoubleField() image_dir = peewee.CharField() def __str__(self): return str(self.id_field)
class Department(BaseModel): name = peewee.CharField() quarter = peewee.ForeignKeyField(Quarter) budget = peewee.DoubleField() parent = peewee.ForeignKeyField('self', related_name='children', null=True) neededNewAttribute = ['name', 'quarter', 'budget', 'parent'] def jsonEncode(self): parentObj = None if self.parent: parentObj = self.parent.id chairmen = [] for person in Chairmen.select().where(Chairmen.department == self.id): chairmen.append(person.user.id) payments = [] for pay in PaymentOrder.select().where( PaymentOrder.department == self.id): payments.append(pay.id) approved = [] for depart in Approvals.select().where( Approvals.department == self.id): approved.append(depart.id) return {"id": self.id, "name": self.name, "quarter": self.quarter.id, \ "budget": self.budget, "parent": parentObj, \ "chairmen": chairmen, "paymentOrders": payments, \ "approved": approved}