本文整理汇总了Python中lib_openmolar.common.db_orm.InsertableRecord.clearValues方法的典型用法代码示例。如果您正苦于以下问题:Python InsertableRecord.clearValues方法的具体用法?Python InsertableRecord.clearValues怎么用?Python InsertableRecord.clearValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib_openmolar.common.db_orm.InsertableRecord
的用法示例。
在下文中一共展示了InsertableRecord.clearValues方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database):
q_query = QtSql.QSqlQuery("select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0, 0
self.length = self.max_patient_id - self.min_patient_id
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf("dent_key"))
self.record.remove(self.record.indexOf("checked_date"))
def demo_queries(self):
"""
return a list of queries to populate a demo database
"""
for patient_id in xrange(self.min_patient_id, self.max_patient_id + 1):
self.record.clearValues()
# set values, or allow defaults
self.record.setValue("patient_id", patient_id)
self.record.setValue("checked_by", "demo_installer")
yield self.record.insert_query
示例2: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
self.length = 300
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('type'))
self.record.remove(self.record.indexOf('commit_time'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
today = QtCore.QDateTime.currentDateTime()
for i in xrange(0, self.length):
self.record.clearValues()
self.record.setValue('line',
u"This is a test Line of Reception Notes")
self.record.setValue('patient_id',
randint(self.min_patient_id, self.max_patient_id))
self.record.setValue('author', 1)
t_stamp = today.addSecs(- randint(0, 86400))
t_stamp = t_stamp.addDays(- randint(0, 4000))
self.record.setValue('open_time', t_stamp)
yield self.record.insert_query
示例3: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
self.length = 820
self.record = InsertableRecord(database, TABLENAME)
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
date_ = QtCore.QDate.currentDate().addMonths(-1)
finish_date = date_.addMonths(6)
while date_ < finish_date:
dayno = date_.dayOfWeek()
if dayno in (6,7):
date_ = date_.addDays(1)
continue
if dayno == 2:
start = QtCore.QDateTime(date_, QtCore.QTime(13,0))
end_ = QtCore.QDateTime(date_, QtCore.QTime(19,0))
else:
start = QtCore.QDateTime(date_, QtCore.QTime(9,0))
end_ = QtCore.QDateTime(date_, QtCore.QTime(17,0))
self.record.clearValues()
self.record.setValue('diary_id', 1)
self.record.setValue('start', start)
self.record.setValue('finish', end_)
self.record.setValue('comment', 'demo session')
yield self.record.insert_query
date_ = date_.addDays(1)
示例4: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
self.length = self.max_patient_id - self.min_patient_id
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('checked_date'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for pt in range(self.min_patient_id, self.max_patient_id):
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('patient_id', pt)
self.record.setValue('checked_by', 'demo_installer')
self.record.setValue('values', "1234*-")
yield self.record.insert_query
示例5: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
min_patient_id = q_query.value(0).toInt()[0]
max_patient_id = q_query.value(1).toInt()[0]
self.patient_id = randint(min_patient_id, max_patient_id)
else:
self.patient_id = 0
self.length = 1
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('checked_date'))
self.record.remove(self.record.indexOf('is_erupted'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('patient_id', self.patient_id)
self.record.setValue('mesial_neighbour', 9)
self.record.setValue('distal_neighbour', 10)
self.record.setValue('checked_by', 'demo_installer')
yield self.record.insert_query
示例6: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database):
self.length = 4
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf("date_issued"))
self.record.remove(self.record.indexOf("discount"))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
self.record.clearValues()
self.record.setValue('patient_id', 1)
self.record.setValue('status_id', 1)
self.record.setValue('total_fees', 20.50)
self.record.setValue('amount_payable', 20.50)
yield self.record.insert_query
self.record.clearValues()
self.record.setValue('patient_id', 1)
self.record.setValue('status_id', 2)
self.record.setValue('total_fees', 4.50)
self.record.setValue('amount_payable', 4.50)
yield self.record.insert_query
示例7: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
self.clinicians = []
q_query= QtSql.QSqlQuery(
"select user_id from view_practitioners", database)
while q_query.next():
self.clinicians.append(q_query.value(0).toInt()[0])
self.authors = []
q_query= QtSql.QSqlQuery(
"select ix from users", database)
while q_query.next():
self.authors.append(q_query.value(0).toInt()[0])
for clinician in self.clinicians:
self.authors.remove(clinician)
self.length = 500
self.record = InsertableRecord(database, TABLENAME)
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
today = QtCore.QDateTime.currentDateTime()
self.record.remove(self.record.indexOf('type'))
for i in xrange(0, self.length):
self.record.clearValues()
self.record.setValue('line',
u"a line of clinical notes. \nrandom %06d"% randint(1,10000))
self.record.setValue('patient_id',
randint(self.min_patient_id, self.max_patient_id))
self.record.setValue('author', choice(self.clinicians))
self.record.setValue('co_author', choice(self.authors + [None]))
t_stamp = today.addSecs(- randint(0, 86400))
t_stamp = t_stamp.addDays(- randint(0, 4000))
self.record.setValue('open_time', t_stamp)
self.record.setValue('commit_time', t_stamp)
self.record.setValue('comitted', True)
yield self.record.insert_query
示例8: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database):
self.length = 2
self.record = InsertableRecord(database, TABLENAME)
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for i in range(self.length):
self.record.clearValues()
self.record.setValue('status', 'open')
yield self.record.insert_query
示例9: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database):
self.length = 40
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('checked_date'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for i in range(self.length):
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('number',
u"0%04d %06d"% (randint(1000,9999), randint(100000,999999)))
self.record.setValue('checked_by', "demo_installer")
yield self.record.insert_query
示例10: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query = QtSql.QSqlQuery("select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0, 0
q_query = QtSql.QSqlQuery("select min(ix), max(ix) from addresses", database)
if q_query.first():
self.max_address_id = q_query.value(1).toInt()[0]
self.min_address_id = q_query.value(0).toInt()[0]
# reserve id number 1 for the practice address.
if self.min_address_id == 1 and self.max_address_id > 1:
self.min_address_id == 2
else:
self.min_address_id, self.max_address_id = 0, 0
self.length = self.max_patient_id - self.min_patient_id
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf("address_cat"))
self.record.remove(self.record.indexOf("to_date"))
self.record.remove(self.record.indexOf("from_date"))
self.record.remove(self.record.indexOf("mailing"))
def demo_queries(self):
"""
return a list of queries to populate a demo database
"""
for patient_id in xrange(self.min_patient_id, self.max_patient_id + 1):
self.record.clearValues()
address_id = randint(self.min_address_id, self.max_address_id)
# set values, or allow defaults
self.record.setValue("patient_id", patient_id)
self.record.setValue("address_id", address_id)
yield self.record.insert_query
示例11: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
self.length = 2
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf("active"))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
year = QtCore.QDate.currentDate().year()
for id in range(1, 3):
self.record.clearValues()
self.record.setValue('user_id', id)
self.record.setValue('book_start', QtCore.QDate(year, 1, 1))
self.record.setValue('book_end', QtCore.QDate(year+2, 1, 1))
self.record.setValue('comment', 'demo diary')
yield self.record.insert_query
示例12: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
q_query= QtSql.QSqlQuery('''select ix from practitioners
where type='dentist' ''', database)
self.dentist_ids = []
while q_query.next():
self.dentist_ids.append(q_query.value(0).toInt()[0])
self.length = self.max_patient_id - self.min_patient_id
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('address_cat'))
self.record.remove(self.record.indexOf('end_date'))
self.record.remove(self.record.indexOf('start_date'))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for patient_id in xrange(self.min_patient_id, self.max_patient_id+1):
self.record.clearValues()
dent_id = choice(self.dentist_ids)
#set values, or allow defaults
self.record.setValue('patient_id', patient_id)
self.record.setValue('practitioner_id', dent_id)
self.record.setValue('contract_type', "dentist")
self.record.setValue('comments', "random")
yield self.record.insert_query
示例13: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
self.length = (self.max_patient_id - self.min_patient_id) * 24
if self.length > 100:
self.length = 100
self.record = InsertableRecord(database, TABLENAME)
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
comments = ["big tooth", "little tooth", "rotated tooth"]
list_len = len(comments)-1
unique_teeth = set([])
while len(unique_teeth) < self.length:
pt = randint(self.min_patient_id, self.max_patient_id)
tooth = randint(1,32)
unique_teeth.add((pt, tooth))
for pt, tooth in unique_teeth:
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('patient_id', pt)
self.record.setValue('tooth', tooth)
self.record.setValue('checked_by', 'demo_installer')
self.record.setValue('comment', comments[randint(0, list_len)])
self.record.remove(self.record.indexOf('checked_date'))
yield self.record.insert_query
示例14: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database=None):
self.database = database
q_query= QtSql.QSqlQuery(
"select min(ix), max(ix) from patients", database)
if q_query.first():
self.min_patient_id = q_query.value(0).toInt()[0]
self.max_patient_id = q_query.value(1).toInt()[0]
else:
self.min_patient_id, self.max_patient_id = 0,0
self.length = (self.max_patient_id - self.min_patient_id) * 3
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf('date_charted'))
def crown_list(self):
CROWNS = SETTINGS.OM_TYPES["crowns"].allowed_values
TEETH = SETTINGS.upper_back + SETTINGS.lower_back
randno = len(TEETH) - 1
for i in range(3):
tooth = TEETH[randint(0, randno)]
type_ = CROWNS[randint(0, len(CROWNS)-1)]
crown = (tooth, type_)
yield crown
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for patient in xrange(self.min_patient_id, self.max_patient_id+1):
for tooth, type_ in self.crown_list():
self.record.clearValues()
#set values, or allow defaults
self.record.setValue('patient_id', patient)
self.record.setValue('type', type_)
self.record.setValue('tooth', tooth)
self.record.setValue('comment', "generated by demo_installer")
yield self.record.insert_query
示例15: DemoGenerator
# 需要导入模块: from lib_openmolar.common.db_orm import InsertableRecord [as 别名]
# 或者: from lib_openmolar.common.db_orm.InsertableRecord import clearValues [as 别名]
class DemoGenerator(object):
def __init__(self, database):
self.database = database
self.length = 40
self.record = InsertableRecord(database, TABLENAME)
self.record.remove(self.record.indexOf("time_stamp"))
def demo_queries(self):
'''
return a list of queries to populate a demo database
'''
for i in xrange(self.length):
self.record.clearValues()
addr1, addr2, city, pcde = random_addy()
self.record.setValue('addr1', addr1)
self.record.setValue('addr2', addr2)
self.record.setValue('city', city)
self.record.setValue('postal_cd', pcde)
self.record.setValue('modified_by', 'demo')
yield self.record.insert_query