|
@@ -1023,10 +1023,12 @@ def get_predect_data(vibration_id:str):
|
|
|
def get_frequency(vibration_id:str):
|
|
|
db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/Water_tower?charset=utf8mb4')
|
|
|
result = {'Hz':[],'value':[]}
|
|
|
+ print(vibration_id)
|
|
|
cmd = 'SELECT * FROM record_frequency where vibration_id = "'+vibration_id+'"'
|
|
|
for row in db.query(cmd) :
|
|
|
result['Hz'].append(row['MFHz'])
|
|
|
result['value'].append(row['MFValue'])
|
|
|
+ return result
|
|
|
|
|
|
|
|
|
def add_data():
|
|
@@ -1044,4 +1046,5 @@ def add_data():
|
|
|
cmd = "TRUNCATE TABLE record_frequency"
|
|
|
db.query(cmd)
|
|
|
for i in range(0,5000):
|
|
|
- db['record_frequency'].insert(dict(time_stamp=loc_dt_format, MFHz=j, MFValue=uniform(0,0.12),vibration_id = 1))
|
|
|
+ print(i)
|
|
|
+ db['record_frequency'].insert(dict(time_stamp=loc_dt_format, MFHz=i, MFValue=uniform(0,0.12),vibration_id = 1))
|