Session(config_file) from SimpleSeer.models.OLAP import OLAP from SimpleSeer.models.Chart import Chart from bson import ObjectId OLAP.objects.delete() Chart.objects.delete() o = OLAP() o.name = 'Test OLAP' o.maxLen = 1000 o.queryType = 'measurement' o.queryId = ObjectId('4fdbac481d41c834fb000001') o.fields = ['capturetime','string'] o.groupTime = 'minute' o.valueMap = {} o.since = None o.before = None o.customFilter = {} o.statsInfo = [{'sum': 1}, {'min': 'string'}, {'max': 'string'}] o.save() c = Chart() c.name = 'Colors Evaluated' c.olap = o.name c.style = 'column' c.minval = 0
c1.labelmap = {} c1.accumulate = False c1.renderorder = 1 c1.halfsize = False c1.realtime = True c1.dataMap = ['capturetime','numeric'] c1.metaMap = ['measurement_id', 'inspection_id', 'frame_id'] c1.save() o2 = OLAP() o2.name = 'Motion, mean by minute' o2.maxLen = 1000 o2.queryType = 'measurement_id' o2.queryId = meas.id #o2.groupTime = 'minute' o2.groupTime = None o2.fields = ['capturetime','numeric', 'measurement_id', 'inspection_id', 'frame_id'] o2.since = None o2.before = None o2.customFilter = {} #o2.statsInfo = [{'avg':'numeric'}, {'first': 'measurement_id'}, {'first': 'inspection_id'}, {'first': 'frame_id'}] o2.statsInfo = [] o2.save() c2 = Chart() c2.name = 'Motion, mean by minute' c2.olap = o2.name c2.style = 'spline' c2.minval = 0 c2.maxval = 100 c2.xtype = 'datetime'