class Annotation(orm.EmbeddedDocument): """ metabolite name with its 2 scores """ annotation = field.Char() score1 = field.Float() score2 = field.Float()
class Human(orm.Document): _db = "test" _collection = "humans" human_id = field.AutoIncrement(collection="human") name = field.Char(required=True, min=2, max=25) age = field.Integer(required=True, min=0, max=3000) height = field.Float(min=1, max=100000) weight = field.Float(min=1, max=30000) jobs = orm.List(type=Job) genitalia = field.Char() location = Location() car = field.ModelChoice(type=Car) color = field.Choice(choices=[{ 'value': 'red', 'display': 'Red' }, { 'value': 'blue', 'display': 'Blue' }, { 'value': 'green', 'display': 'Green' }]) state = field.CollectionChoice(db='test', collection='states', sort=[('fullname', 1)]) email = field.Email()
class Human(orm.Document): _db = "test" _collection = "humans" name = field.Char(required=True, min=2, max=25) age = field.Integer(min=0, max=3000) height = field.Float(min=1, max=100000) weight = field.Float(min=1, max=30000) jobs = orm.List(type=Job) genitalia = field.Char()
class Feature(orm.Document): """ Feature class """ _db = "os_mongo" _collection = "features" feature_id = field.AutoIncrement(collection="experiment") experiment_id = field.Integer(required=True) mass = field.Float(required=True) rt = field.Float(required=True) abundances = orm.List(type=Abundance) main_attribution = field.Char() annotations = orm.List(type=Annotation)
class Human(orm.Document): _db = "test" _collection = "humans" _indexes = [ orm.Index("name", key=[("name", orm.Index.DESCENDING)]), orm.Index("human_id", key=[("human_id", orm.Index.ASCENDING)]), orm.Index("geo_location", key=[("jobs.locations.geo", orm.Index.GEO2D)]) ] human_id = field.AutoIncrement(collection="human") name = field.Char(required=True, min=2, max=25) age = field.Integer(min=0, max=3000) height = field.Float(min=1, max=100000) weight = field.Float(min=1) jobs = orm.List(type=Job, length=3) genitalia = field.Char()
class Abundance(orm.EmbeddedDocument): """ Custom abundances class """ sample = field.Char() abundance = field.Float()