def aggregate(self, data, sensordescription): result = [] try: dftobjs = self.dftobjects[sensordescription.uuid] for f in dftobjs: g = dftobjs[f].control(data[f]) if g: r = JSONObject() r.graph = g r.sensorID = sensordescription.sensorID r.propertyType = sensordescription.field[f].propertyName r.category = sensordescription.sensorType result.append(r) return result except KeyError: Log.e("Dft aggregation failed") return None
def aggregate(self, data, sensordescription): if not data.fields: # Log.e("There was no data available so it could not be aggregated") return None result = [] try: saxobjs = self.aggregation_objs[sensordescription.uuid] for f in saxobjs: g = saxobjs[f].control(data[f]) if g: r = JSONObject() r.graph = g r.sensorID = sensordescription.sensorID r.propertyType = sensordescription.field[f].propertyName r.category = sensordescription.sensorType result.append(r) del data if result is not None and len(result) is not 0: Log.d2('SaxAggregator: Aggregation successful %s' % str(result)) return result except Exception as e: Log.e("aggregation failed due to Exception", e) return None