You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kibble.apache.org by hu...@apache.org on 2017/12/06 23:03:08 UTC

[kibble] 02/02: add azure moods to the mix

This is an automated email from the ASF dual-hosted git repository.

humbedooh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kibble.git

commit c8eb541b02446abd029e625d3159a3dace6d95b2
Author: Daniel Gruno <hu...@apache.org>
AuthorDate: Thu Dec 7 00:02:56 2017 +0100

    add azure moods to the mix
    
    will likely need to adjust this later
---
 api/pages/mail/mood-timeseries.py | 17 ++++++++++++++++-
 api/pages/mail/mood.py            | 21 ++++++++++++++++++---
 2 files changed, 34 insertions(+), 4 deletions(-)

diff --git a/api/pages/mail/mood-timeseries.py b/api/pages/mail/mood-timeseries.py
index 257a1d9..79c245b 100644
--- a/api/pages/mail/mood-timeseries.py
+++ b/api/pages/mail/mood-timeseries.py
@@ -168,6 +168,21 @@ def run(API, environ, indata, session):
                     'sum': {
                         'field': 'mood.analytical'
                     }                
+                },
+                'positive': {
+                    'sum': {
+                        'field': 'mood.positive'
+                    }                
+                },
+                'neutral': {
+                    'sum': {
+                        'field': 'mood.neutral'
+                    }                
+                },
+                'negative': {
+                    'sum': {
+                        'field': 'mood.negative'
+                    }                
                 }
             }
          }
@@ -180,7 +195,7 @@ def run(API, environ, indata, session):
         )
     
     timeseries = []
-    M = ['joy', 'sadness', 'tentative', 'confident', 'anger', 'fear', 'analytical', 'disgust']
+    M = ['joy', 'sadness', 'tentative', 'confident', 'anger', 'fear', 'analytical', 'disgust', 'positive', 'neutral', 'negative']
     
     for tz in res['aggregations']['history']['buckets']:
         moods = {}
diff --git a/api/pages/mail/mood.py b/api/pages/mail/mood.py
index 57191eb..5f5332a 100644
--- a/api/pages/mail/mood.py
+++ b/api/pages/mail/mood.py
@@ -158,6 +158,21 @@ def run(API, environ, indata, session):
                     'sum': {
                         'field': 'mood.analytical'
                     }                
+                },
+                'positive': {
+                    'sum': {
+                        'field': 'mood.positive'
+                    }                
+                },
+                'neutral': {
+                    'sum': {
+                        'field': 'mood.neutral'
+                    }                
+                },
+                'negative': {
+                    'sum': {
+                        'field': 'mood.negative'
+                    }                
                 }
     }
     
@@ -222,7 +237,7 @@ def run(API, environ, indata, session):
     
     # If relative mode and a field is missing, assume 100 (norm)
     if indata.get('relative'):
-        for M in ['joy', 'sadness', 'tentative', 'confident', 'anger', 'fear', 'analytical', 'disgust']:
+        for M in ['joy', 'sadness', 'tentative', 'confident', 'anger', 'fear', 'analytical', 'disgust', 'negative', 'neutral', 'positive']:
             if mood_compiled.get(M, 0) == 0:
                 mood_compiled[M] = 100
     
@@ -230,14 +245,14 @@ def run(API, environ, indata, session):
     MAX = max(max(mood_compiled.values()),1)
     X = 100 if indata.get('relative') else 0
     bads = X
-    for B in ['sadness', 'anger', 'fear', 'disgust']:
+    for B in ['sadness', 'anger', 'fear', 'disgust', 'negative']:
         if mood_compiled.get(B) and mood_compiled[B] > X:
             bads += mood_compiled[B]
     
     happ = 50
     
     goods = X
-    for B in ['joy', 'confident']:
+    for B in ['joy', 'confident', 'positive']:
         if mood_compiled.get(B) and mood_compiled[B] > X:
             goods += mood_compiled[B]
     MAX = max(MAX, bads, goods)

-- 
To stop receiving notification emails like this one, please contact
"commits@kibble.apache.org" <co...@kibble.apache.org>.