diff --git a/trendings_helper.py b/trendings_helper.py index 7ccae08..dbeb684 100644 --- a/trendings_helper.py +++ b/trendings_helper.py @@ -28,8 +28,17 @@ class Trendings_helper: for tag in tags: self.addGenericTrending('TRENDINGS_TAGS', tag, timestamp) - def addSightings(self, event, categName, timestamp): - pass + def addSightings(self, timestamp): + timestampDate = datetime.datetime.fromtimestamp(float(timestamp)) + timestampDate_str = util.getDateStrFormat(timestampDate) + keyname = "{}:{}".format("TRENDINGS_SIGHT_sightings", timestampDate_str) + self.serv_redis_db.incrby(keyname, 1) + + def addFalsePositive(self, timestamp): + timestampDate = datetime.datetime.fromtimestamp(float(timestamp)) + timestampDate_str = util.getDateStrFormat(timestampDate) + keyname = "{}:{}".format("TRENDINGS_SIGHT_false_positive", timestampDate_str) + self.serv_redis_db.incrby(keyname, 1) ''' GETTER ''' diff --git a/zmq_subscriber.py b/zmq_subscriber.py index dd2c527..2f97965 100755 --- a/zmq_subscriber.py +++ b/zmq_subscriber.py @@ -232,6 +232,9 @@ def handler_sighting(zmq_name, jsondata): action = None handleContribution(zmq_name, org, 'Sighting', categ, action, pntMultiplier=2) handler_attribute(zmq_name, jsonsight, hasAlreadyBeenContributed=True) + + trendings_helper.addSightings() + trendings_helper.addFalsePositive() def handler_event(zmq_name, jsonobj): #fields: threat_level_id, id, info