コード例 #1
0
class Unidades_Privadas(Document):
    PROPIEDAD_ID = fields.LazyReferenceField('Propiedades_Horizontales',
                                             passthrough=False,
                                             dbref=False)
    IDENTIFICADOR = fields.StringField(required=True)
    GRUPO = fields.StringField(required=True)
    MATRICULA_INMOBILIARIA = fields.StringField(required=True)
    AREA_PRIVADA = fields.FloatField()
    AREA_COMUN = fields.FloatField()
    AREA_CONSTRUIDA = fields.FloatField()
    ESTADO_UNIDAD = fields.StringField(required=True)
    HABITACIONES = fields.IntField()
    BAÑOS = fields.IntField()
    CANTIDAD_PARQUEADEROS = fields.IntField()
    MAXIMO_AUTOS = fields.IntField()
    MAXIMO_MOTOS = fields.IntField()
    COEFICIENTE_COPROPIEDAD = fields.FloatField()
    ESTADO_CARTERA = fields.StringField()
    RESIDENTES = fields.ListField(fields.EmbeddedDocumentField(ResidenteField))
    PARQUEADEROS = fields.ListField(fields.StringField())
    VEHICULOS_PERMANENTES = fields.ListField(
        fields.EmbeddedDocumentField(VehiculoPermanenteField))
    VEHICULOS_TEMPORALES = fields.ListField(
        fields.EmbeddedDocumentField(VehiculoTemporalField))
    PROPIETARIO = fields.EmbeddedDocumentField(PropietarioField)
    ESTADO_CUENTA = fields.EmbeddedDocumentField(EstadoCuentaField)
    HABILITADO = fields.BooleanField()
コード例 #2
0
ファイル: models.py プロジェクト: igor-93/isl2017
class WeTrackPost(EmbeddedDocument):
    postcode = fields.StringField(max_length=50)
    postscore = fields.DecimalField(min_value=0, precision=10)
    timestamp = fields.DateTimeField()
    nr_likes = fields.FloatField(min_value=0, precision=10)
    nr_comments = fields.FloatField(min_value=0, precision=10)
    tags = fields.ListField(fields.StringField(max_length=100))
コード例 #3
0
ファイル: models.py プロジェクト: yohoos/DjangoProjs
class Collision(Document):
    date = fields.DateTimeField()
    time = fields.StringField()
    borough = fields.StringField(max_length=50)
    zip_code = fields.IntField()
    latitude = fields.FloatField()
    longitude = fields.FloatField()
    location = fields.StringField(max_length=50)
    on_street_name = fields.StringField(max_length=32)
    cross_street_name = fields.StringField(max_length=32)
    off_street_name = fields.StringField(max_length=40)
    number_of_persons_injured = fields.IntField()
    number_of_persons_killed = fields.IntField()
    number_of_pedestrians_injured = fields.IntField()
    number_of_pedestrians_killed = fields.IntField()
    number_of_cyclist_injured = fields.IntField()
    number_of_cyclist_killed = fields.IntField()
    number_of_motorist_injured = fields.IntField()
    number_of_motorist_killed = fields.IntField()
    contributing_factor_vehicle_1 = fields.StringField(max_length=100)
    contributing_factor_vehicle_2 = fields.StringField(max_length=100)
    contributing_factor_vehicle_3 = fields.StringField(max_length=100)
    contributing_factor_vehicle_4 = fields.StringField(max_length=100)
    contributing_factor_vehicle_5 = fields.StringField(max_length=100)
    unique_key = fields.IntField()
    vehicle_type_code_1 = fields.StringField(max_length=30)
    vehicle_type_code_2 = fields.StringField(max_length=30)
    vehicle_type_code_3 = fields.StringField(max_length=30)
    vehicle_type_code_4 = fields.StringField(max_length=30)
    vehicle_type_code_5 = fields.StringField(max_length=30)
コード例 #4
0
class Measurements(fields.Document):
    owner = fields.IntField()  # User.pk
    units = fields.StringField()
    height = fields.FloatField()
    body_mass = fields.FloatField()
    last_date = fields.DateTimeField()
    everyday_list = fields.EmbeddedDocumentListField(EveryDayMeasurements)
コード例 #5
0
class Tweet(Document):
    """
    Tweet database model, holding some basic information which we really need
    for applying a data mining algorithm on a topic's positivity. It can be
    built from a raw tweet (from Twitter's API), using the make_tweet() helper,
    or the from_raw_tweet() classmethod.
    """
    topic = fields.ReferenceField(Topic, required=True)

    tweet_id = fields.IntField()
    status = fields.StringField()
    hashtags = fields.ListField(fields.StringField())
    user = fields.StringField()
    location = fields.ListField(fields.FloatField())

    polarity = fields.FloatField()

    def clean(self):
        if len(self.location) > 0 and len(self.location) != 2:
            msg = 'Location should be either empty or (x, y) position'
            raise ValidationError(msg)

    @classmethod
    def from_raw_tweet(self, data):
        return make_tweet(data)

    def __str__(self):
        return '<@%s> - "%s"' % (self.user, self.status)

    __repr__ = __str__
コード例 #6
0
class CharacterSheet(mongoengine.Document):
    name = fields.StringField()
    description = fields.StringField()
    hit_points = fields.IntField()
    level = fields.IntField()
    experience = fields.LongField()
    strength = fields.FloatField()
    dexterity = fields.FloatField()
    constitution = fields.FloatField()
    inteligence = fields.FloatField()
    wisdom = fields.FloatField()
    charisma = fields.FloatField()
    armor_class = fields.FloatField()
    fortitude = fields.FloatField()
    reflex = fields.FloatField()
    will = fields.FloatField()
    race = fields.StringField()
    klass = fields.StringField()
    skills = fields.ListField(fields.StringField())
    items = fields.ListField(fields.StringField())
    owner = fields.StringField()
    # race = fields.ReferenceField('Race')
    # klass = fields.ReferenceField('Klass')
    # skills = fields.ListField(fields.ReferenceField('Skill'))
    # items = fields.ListField(fields.ReferenceField('Item'))
    # owner = fields.ReferenceField('User')


    def restore(self, memento):
        """
        Restores the Originator's state from a memento object.
        """
        
        self.hit_points = memento.get_hit_points()
        self.update()
コード例 #7
0
class Search(Document):
    site_code = fields.IntField(required=True)
    search_word = fields.StringField(required=True)
    related_word = fields.ListField(fields=fields.ListField())
    total_sentence_count = fields.IntField(required=True)
    positive = fields.FloatField(required=True, default=0.0)
    negative = fields.FloatField(required=True, default=0.0)
コード例 #8
0
ファイル: models.py プロジェクト: naveen-varshney/idmbApp
class Movie(Document):
    name = fields.StringField(required=True)
    director = fields.StringField(required=True)
    categories = fields.ListField(fields.StringField())
    imdb_score = fields.FloatField()
    popularity_99 = fields.FloatField()
    added_by = fields.ObjectId()

    # applying search index on name and director field
    meta = {
        "auto_create_index":
        False,
        "indexes": [{
            "fields": ["$name", "$director"],
            "default_language": "english",
            "weights": {
                "name": 10,
                "director": 5
            },
        }],
    }

    def __str__(self):
        return f"Name - {self.name} : Director - {self.director}"

    def __repr__(self):
        return f"<{self.name} : {self.director}>"
コード例 #9
0
class Offer(EmbeddedDocument):
    shop_name = fields.StringField(max_length=100)
    shop_url = fields.StringField(max_length=1024)
    name = fields.StringField(max_length=100)
    price = fields.FloatField()
    price_with_shipping = fields.FloatField()
    shipping_costs = fields.FloatField()
    currency = fields.StringField(max_length=50)
    url = fields.StringField(max_length=1024)
コード例 #10
0
class Transactions(Document):
    value_date = fields.DateTimeField(required=True,
                                      null=True,
                                      default=datetime.now())
    iban = fields.StringField(required=True, null=True)
    value = fields.FloatField(required=True, null=True)
    type = fields.StringField(required=True, null=True)
    balance_ini = fields.FloatField(required=True, null=True)
    balance_fin = fields.FloatField(required=True, null=True)
コード例 #11
0
class F00065(Document):
    tenant = fields.StringField()
    PID = fields.StringField(required=True)
    CID = fields.StringField(required=True)
    matters = fields.FloatField(required=True)
    sent = fields.StringField(required=True)
    sent_val = fields.FloatField(default=0)
    desc = fields.StringField(required=True)
    max_sentiment = fields.StringField(required=True)
コード例 #12
0
ファイル: operations_log.py プロジェクト: shidorama/WalletTT
class OperationLogEntry(db.Document):
    meta = {
        'indexes':
        ['wallet_id', 'date', 'target_wallet_id', 'state', 'event_type']
    }

    entry_id = fields.UUIDField(required=True,
                                default=lambda: str(uuid.uuid4()),
                                primary_key=True)
    wallet_id = fields.UUIDField(required=True)
    target_wallet_id = fields.UUIDField()
    state = fields.StringField(required=True)
    date = fields.DateTimeField(required=True,
                                default=lambda: datetime.datetime.now())
    event_type = fields.StringField(required=True)
    amount = fields.FloatField()
    currency = fields.StringField()
    balance = fields.FloatField()

    additional_info = fields.StringField(
    )  # For any last minute additions / diag data

    @classmethod
    def log_topup(cls, wallet, amount, state):
        if not isinstance(wallet, Wallet) or not isinstance(
                state, OperationStatus):
            return False
        entry = OperationLogEntry()

        entry.wallet_id = wallet.wallet_id
        entry.state = state.name
        entry.event_type = 'TOPUP'
        entry.amount = amount
        entry.balance = wallet.balance
        entry.save()

        return entry

    @classmethod
    def log_transfer(cls, source_wallet, target_wallet, amount, state):
        if not isinstance(source_wallet, Wallet) \
                or not isinstance(target_wallet, Wallet) \
                or not isinstance(state, OperationStatus):
            return False
        entry = OperationLogEntry()

        entry.state = state.name
        entry.wallet_id = source_wallet.wallet_id
        entry.target_wallet_id = target_wallet.wallet_id
        entry.balance = source_wallet.balance
        entry.currency = source_wallet.currency
        entry.event_type = 'TRANSFER'
        entry.amount = amount
        entry.save()

        return entry
コード例 #13
0
class Rooms(Document):
    _id = fields.StringField(primary_key=True, disabled=False)
    name = fields.StringField(required=True, max_length=50)
    id_manager = fields.IntField(required=False)
    street = fields.StringField(required=True)
    capacity = fields.IntField(required=True)
    rows = fields.IntField(required=True)
    columns = fields.IntField(required=True)
    distance_between_seats = fields.FloatField(required=False, default=0.2)
    seats_size = fields.FloatField(required=False, default=0.7)
コード例 #14
0
class MemberNominate(mongoengine.EmbeddedDocument):
    """A member's Nominate statistics."""

    number_of_votes: int = fields.IntField()
    number_of_errors: int = fields.IntField()
    dim1: float = fields.FloatField()
    dim2: float = fields.FloatField()
    total_number_of_votes: int = fields.IntField()
    geo_mean_probability: float = fields.FloatField()
    conditional: int = fields.IntField()
    log_likelihood: float = fields.IntField()
コード例 #15
0
ファイル: models.py プロジェクト: puchchi/ProjectX
class Place(Document):
    name = fields.StringField(required=True)
    state = fields.StringField(required=True)
    country = fields.StringField(required=True)
    address = fields.StringField(required=False)
    latitude = fields.FloatField(required=True)
    longitude = fields.FloatField(required=True)
    photo_urls = fields.ListField(fields.EmbeddedDocumentField(URLInput))
    map_url = fields.StringField(required=True)
    description = fields.StringField(required=False)
    place_id = fields.StringField(required=True)
コード例 #16
0
ファイル: models.py プロジェクト: devcoder111/AgroLab
class Presentacion(EmbeddedDocument):
    nombre = fields.StringField(required=True, max_length=35)
    precio_compra = fields.FloatField(required=True)
    precio_venta = fields.FloatField(required=True)
    lotes = fields.ListField(fields.EmbeddedDocumentField(Lote), required=True)
    medidas = fields.EmbeddedDocumentField(Medidas)
    detalle_unitario = fields.ListField(
        fields.EmbeddedDocumentField(DetalleUnitario))

    def __str__(self):
        return self.nombre
コード例 #17
0
class RollcallNominate(mongoengine.EmbeddedDocument):
    """Nominate statistics of a rollcall."""

    conditional: int = fields.IntField()
    spread: t.List[float] = fields.ListField(fields.IntField())
    classified: float = fields.FloatField()
    log_likelihood: float = fields.FloatField()
    geo_mean_probability: float = fields.FloatField()
    pre: float = fields.FloatField()
    mid: t.List[float] = fields.ListField(fields.FloatField())

    meta = {"strict": False}
コード例 #18
0
class MetrikaSourceSummaryReport(Document):
    source_id = fields.LongField(required=True)
    date = fields.DateTimeField()
    rid = fields.StringField()
    name = fields.StringField()
    group_id = fields.StringField()
    group_name = fields.StringField()
    visits = fields.LongField()
    users_count = fields.LongField()
    bounce_rate = fields.FloatField()
    page_depth = fields.FloatField()
    avg_visit_duration = fields.FloatField()
コード例 #19
0
ファイル: models.py プロジェクト: isisnaomi/tripstrAPI
class Place(Document):
    id = fields.StringField(primary_key=True)
    name = fields.StringField()
    rating = fields.DynamicField()
    loc = fields.PointField()
    lat = fields.FloatField()
    lng = fields.FloatField()
    vicinity = fields.StringField()
    opening_hours = fields.DynamicField(null=True)

    types = fields.DynamicField(null=True)
    photo_reference = fields.StringField()
    user_rating = fields.StringField()
    twitter_rating = fields.StringField()
コード例 #20
0
ファイル: models.py プロジェクト: GhostFantik/BusProject
class Vehicle(Document):
    plate = fields.StringField(max_length=20)
    model = fields.StringField(max_length=100)
    vin = fields.StringField(max_length=100)
    vrc = fields.StringField(max_length=100)
    year = fields.StringField(max_length=4)
    owner = fields.StringField(max_length=100)
    carrier = fields.ReferenceField(Carrier)
    route = fields.StringField(max_length=100)
    internalId = fields.StringField(max_length=20)
    kilometres = fields.FloatField()
    repairs = fields.FloatField()

    meta = {'collection': 'vehicles'}
コード例 #21
0
class Genes(DynamicDocument, BiologicalBase):
    bnumber = fields.StringField(required=False, db_field="bnumber")
    centisome_position = fields.FloatField(required=False,
                                           db_field="centisomePosition")
    fragments = fields.EmbeddedDocumentListField(Fragments, required=False)
    gc_content = fields.FloatField(required=False, db_field="gcContent")
    interrupted = fields.BooleanField(required=False)
    terms = fields.EmbeddedDocumentListField(Terms, required=False)
    type = fields.StringField(required=False)

    def __init__(self, **kwargs):
        super().__init__(**kwargs)

    meta = {'collection': 'genes'}
コード例 #22
0
ファイル: models.py プロジェクト: pyarun/bkTest
class VgSales(Document):
    rank = fields.IntField()
    name = fields.StringField()
    platform = fields.StringField()
    year = fields.IntField()
    genre = fields.StringField()
    publisher = fields.StringField()
    na_sales = fields.FloatField()
    eu_sales = fields.FloatField()
    jp_sales = fields.FloatField()
    other_sales = fields.FloatField()
    global_sales = fields.FloatField()

    def __unicode__(self):
        return "%s" % self.name
コード例 #23
0
class Transaction(Document):
    txn_uid = fields.StringField(max_length=20, unique=True)
    w_uid = fields.ReferenceField(Wallet)
    txn_type = fields.StringField(max_length=50)# credit or debit
    amount = fields.FloatField(default=0)
    status = fields.StringField(default='success')
    creation_date = fields.DateTimeField(auto_now_add=True)
    modified_date = fields.DateTimeField(auto_now=True)
    closing_balance = fields.FloatField()

    def save(self, *args, **kwargs):
        if not self.creation_date:
            self.creation_date = datetime.datetime.now()
        self.modified_date = datetime.datetime.now()
        return super(Transaction, self).save(*args, **kwargs)
コード例 #24
0
ファイル: models.py プロジェクト: sogud007/API-REST
class Cuenta_Cobro(Document):
    UNIDAD_PRIVADA = fields.EmbeddedDocumentField(UnidadPrivadaField)
    PERIODO = fields.StringField(required=True)
    CONSECUTIVO = fields.StringField(required=True)    
    FECHA_CUENTA_COBRO = fields.DateTimeField(default=datetime.datetime.utcnow)
    PERIODO_COBRO = fields.EmbeddedDocumentField(PeriodoCobroField)
    ELEMENTOS = fields.ListField(fields.EmbeddedDocumentField(ElementoField))
    INTERESES_CAUSADOS = fields.FloatField()
    SALDO_INTERESES = fields.FloatField()
    SALDO_CAPITAL = fields.FloatField()
    VALOR_TOTAL = fields.FloatField()
    PROPIEDAD_HORIZONTAL = fields.EmbeddedDocumentField(PropiedadHorizontalField)
    COMPROBANTE = fields.EmbeddedDocumentField(ComprobanteField)
    DOCUMENTO = fields.FileField()
    HABILITADO = fields.BooleanField()
コード例 #25
0
ファイル: test.py プロジェクト: w-copper/Flask-rest-mongo
 class TestDocument(db.DynamicDocument):
     user = fields.ReferenceField(UserTest,
                                  reverse_delete_rule=mongoengine.CASCADE,
                                  required=True)
     data_list = fields.ListField(fields.ReferenceField(DataTest))
     count = fields.IntField()
     factor = fields.FloatField()
コード例 #26
0
ファイル: schema.py プロジェクト: signals-dev/sintel
class Event(SintelDocument):
    """Event object.

    An Event represents an anomalous period on a Signal.
    It is descrived by start and stop times and, optionally, a severity score.

    It is always associated to a Signal and, optionally, to a Signalrun.
    """
    SOURCE_ORION = 'ORION'
    SOURCE_SHAPE_MATCHING = 'SHAPE_MATCHING'
    SOURCE_MANUALLY_CREATED = 'MANUALLY_CREATED'
    SOURCE_CHOICES = (SOURCE_ORION, SOURCE_SHAPE_MATCHING,
                      SOURCE_MANUALLY_CREATED)

    signalrun = fields.ReferenceField(Signalrun, reverse_delete_rule=CASCADE)
    signal = fields.ReferenceField(Signal, reverse_delete_rule=CASCADE)
    start_time = fields.IntField(required=True)
    stop_time = fields.IntField(required=True)
    severity = fields.FloatField()
    source = fields.StringField(required=True, choices=SOURCE_CHOICES)
    num_annotations = fields.IntField(default=0)
    # HACK - do not have tag currently
    tag = fields.StringField()

    @property
    def annotations(self):
        return Annotation.find(event=self)

    @property
    def event_interactions(self):
        return EventInteraction.find(event=self)

    @property
    def latest_event_interaction(self):
        return self.event_interactions.last()
コード例 #27
0
class ChargeStation(Document):
    meta = {
        "indexes": [
            'network',
            'locationId',
        ]
    }
    id = fields.IntField(required=True, primary_key=True)
    network = fields.ReferenceField(Network)
    locationId = fields.IntField(required=True)
    name = fields.StringField(required=True, max_length=200)

    #0 = Unknown
    #1 = Free
    #2 = Fee
    cost = fields.IntField()
    cost_description = fields.StringField(max_length=1000)
    address = fields.StringField(max_length=300)
    available = fields.IntField(required=True)
    hours = fields.StringField(max_length=400)
    geoLocation = fields.PointField(auto_index=True)
    score = fields.FloatField(min_value=0, max_value=10.0, required=True)
    images = fields.ListField(fields.URLField())
    chargePoints = fields.ListField(fields.ReferenceField(ChargePoint))
    created_at = fields.DateTimeField()
    modified_at = fields.DateTimeField(default=datetime.datetime.utcnow())
コード例 #28
0
class RegularModel(Document):
    """
    A model class for testing regular flat fields.
    """
    str_field = fields.StringField()
    str_regex_field = fields.StringField(regex="^valid_regex")
    url_field = fields.URLField()
    email_field = fields.EmailField()
    int_field = fields.IntField()
    long_field = fields.LongField()
    float_field = fields.FloatField()
    boolean_field = fields.BooleanField()
    nullboolean_field = fields.BooleanField(null=True)
    date_field = fields.DateTimeField()
    complexdate_field = fields.ComplexDateTimeField()
    uuid_field = fields.UUIDField()
    id_field = fields.ObjectIdField()
    decimal_field = fields.DecimalField()

    custom_field = CustomField()

    # TODO
    # dynamic_field = fields.DynamicField()
    # bin_field = fields.BinaryField()
    # file_field = fields.FileField()
    # image_field = fields.ImageField()

    def method(self):
        return 'method'
コード例 #29
0
class SearchTerm(EmbeddedDocument):
    """A term linked to its weight - one of these is stored for each term in
    each document. The weight 
    """
    term = fields.StringField(db_field='t')
    weight = fields.FloatField(db_field='w')
    meta = {'allow_inheritance': False}
コード例 #30
0
class FundHistoryNetWorth(MongoModel):
    """基金历史净值"""

    meta = {'collection': 'fund_history_net_worth', 'indexes': ['code']}

    code = fields.StringField(max_length=6, verbose_name='基金代码')
    fund_name = fields.StringField(verbose_name='基金代码')
    net_worth = fields.IntField(verbose_name='净值, x1000')
    date = fields.DateField(verbose_name='日期')
    daily_growth_rate = fields.FloatField(verbose_name='日增长率')

    @classmethod
    def create(cls, code, fund_name, net_worth, date, daily_growth_rate,
               **kwargs):
        """注意使用同步需要保证有connection"""
        obj = cls(code=code,
                  fund_name=fund_name,
                  net_worth=net_worth,
                  date=date,
                  daily_growth_rate=daily_growth_rate,
                  **kwargs)
        return obj.save()

    async def normal_info(self):
        return {
            'code': self.code,
            'fund_name': self.fund_name,
            'net_worth': self.net_worth,
            'date': self.date,
            'daily_growth_rate': self.daily_growth_rate
        }