Commit 8bc6b6c3 authored by Alberto Pascual's avatar Alberto Pascual
Browse files

dashboard updates

parent f986360b
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<number-chart <number-chart
data="{{data}}" data="{{data}}"
object="cnn" object="cnn"
aggKey="author" aggKey="schema:author"
title="CNN" title="CNN"
icon="/images/cnn.png" icon="/images/cnn.png"
stylebg="bg-yellow"> stylebg="bg-yellow">
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<number-chart <number-chart
data="{{data}}" data="{{data}}"
object="The New York Times" object="The New York Times"
aggKey="author" aggKey="schema:author"
title="The New York Times" title="The New York Times"
icon="/images/times.png" icon="/images/times.png"
aggkey="location" aggkey="location"
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<div style="width: 100%; display: inline-block"> <div style="width: 100%; display: inline-block">
<div class="chart_container" style="right: 0; float: right"> <div class="chart_container" style="right: 0; float: right">
<entities-chart <entities-chart
field="about" field="entities.dbps:anyURI"
data="{{data}}" data="{{data}}"
title="Entities founded" title="Entities founded"
icon="icons:list" icon="icons:list"
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
</div> </div>
<div class="chart_container" style="left: 0; float: left"> <div class="chart_container" style="left: 0; float: left">
<google-chart <google-chart
field="author" field="schema:author"
data="{{data}}" data="{{data}}"
id='pie-chart3' id='pie-chart3'
extra-id='pie-chart3' extra-id='pie-chart3'
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<div class="chart_container" style="left: 0; float: left; width: 100%"> <div class="chart_container" style="left: 0; float: left; width: 100%">
<google-chart <google-chart
field="dataPublished" field="schema:datePublished"
data="{{data}}" data="{{data}}"
id='line-chart' id='line-chart'
extra-id='line-chart' extra-id='line-chart'
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
</div> </div>
<div> <div>
<yasgui-ui <yasgui-ui
endpoint="http://${FUSEKI_ENPOINT_DASHBOARD}/gsicrawler/query" endpoint="http:///krusti.gsi/gsicrawler/query"
queries="{{queries}}"> queries="{{queries}}">
</yasgui-ui> </yasgui-ui>
</div> </div>
...@@ -237,7 +237,7 @@ ...@@ -237,7 +237,7 @@
query: { query: {
multi_match:{ multi_match:{
query: this.query, query: this.query,
fields: ['author', 'headline', 'sentiments', 'about'] fields: ['schema:author', 'schema:headline', 'sentiments', 'schema:about']
} }
}, },
aggs: { aggs: {
...@@ -249,17 +249,17 @@ ...@@ -249,17 +249,17 @@
} }
} }
}, },
author: { 'schema:author': {
terms: { terms: {
field: "author.keyword", field: "schema:author.keyword",
order: { order: {
_count: "desc" _count: "desc"
} }
} }
}, },
about: { 'entities.dbps:anyURI': {
terms: { terms: {
field: "about.keyword", field: "entities.dbps:anyURI.keyword",
order: { order: {
_count: "desc" _count: "desc"
} }
...@@ -281,9 +281,9 @@ ...@@ -281,9 +281,9 @@
} }
} }
}, },
dataPublished: { 'schema:datePublished': {
date_histogram : { date_histogram : {
field : "dataPublished", field : "schema:datePublished",
format: "MM-yyyy", format: "MM-yyyy",
interval : "month" interval : "month"
} }
...@@ -325,17 +325,17 @@ ...@@ -325,17 +325,17 @@
} }
} }
}, },
author: { 'schema:author': {
terms: { terms: {
field: "author.keyword", field: "schema:author.keyword",
order: { order: {
_count: "desc" _count: "desc"
} }
} }
}, },
about: { 'entities.dbps:anyURI': {
terms: { terms: {
field: "about.keyword", field: "entities.dbps:anyURI.keyword",
order: { order: {
_count: "desc" _count: "desc"
} }
...@@ -357,9 +357,9 @@ ...@@ -357,9 +357,9 @@
} }
} }
}, },
dataPublished: { 'schema:datePublished': {
date_histogram : { date_histogram : {
field : "dataPublished", field : "schema:datePublished",
format: "MM-yyyy", format: "MM-yyyy",
interval : "month" interval : "month"
} }
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
<number-chart <number-chart
data="{{data}}" data="{{data}}"
object="cnn" object="cnn"
aggKey="author" aggKey="schema:author"
title="CNN" title="CNN"
icon="/images/cnn.png" icon="/images/cnn.png"
stylebg="bg-yellow"> stylebg="bg-yellow">
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
<number-chart <number-chart
data="{{data}}" data="{{data}}"
object="The New York Times" object="The New York Times"
aggKey="author" aggKey="schema:author"
title="The New York Times" title="The New York Times"
icon="/images/times.png" icon="/images/times.png"
aggkey="location" aggkey="location"
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
<div style="width: 100%; display: inline-block"> <div style="width: 100%; display: inline-block">
<div class="chart_container" style="right: 0; float: right"> <div class="chart_container" style="right: 0; float: right">
<entities-chart <entities-chart
field="about" field="entities.dbps:anyURI"
data="{{data}}" data="{{data}}"
title="Entities founded" title="Entities founded"
icon="icons:list" icon="icons:list"
...@@ -82,7 +82,7 @@ ...@@ -82,7 +82,7 @@
</div> </div>
<div class="chart_container" style="left: 0; float: left"> <div class="chart_container" style="left: 0; float: left">
<google-chart <google-chart
field="author" field="schema:author"
data="{{data}}" data="{{data}}"
id='pie-chart3' id='pie-chart3'
extra-id='pie-chart3' extra-id='pie-chart3'
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
<div class="chart_container" style="left: 0; float: left; width: 100%"> <div class="chart_container" style="left: 0; float: left; width: 100%">
<google-chart <google-chart
field="dataPublished" field="schema:datePublished"
data="{{data}}" data="{{data}}"
id='line-chart' id='line-chart'
extra-id='line-chart' extra-id='line-chart'
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
</div> </div>
<div> <div>
<yasgui-ui <yasgui-ui
endpoint="http:///gsicrawler/query" endpoint="http:///krusti.gsi/gsicrawler/query"
queries="{{queries}}"> queries="{{queries}}">
</yasgui-ui> </yasgui-ui>
</div> </div>
...@@ -222,7 +222,6 @@ ...@@ -222,7 +222,6 @@
else this._ESsearch() else this._ESsearch()
}, },
_filtersChange: function() { _filtersChange: function() {
var myfilters = []
this._query(); this._query();
}, },
_ESsearch: function() { _ESsearch: function() {
...@@ -238,7 +237,7 @@ ...@@ -238,7 +237,7 @@
query: { query: {
multi_match:{ multi_match:{
query: this.query, query: this.query,
fields: ['author', 'headline', 'sentiments', 'about'] fields: ['schema:author', 'schema:headline', 'sentiments', 'schema:about']
} }
}, },
aggs: { aggs: {
...@@ -250,17 +249,18 @@ ...@@ -250,17 +249,18 @@
} }
} }
}, },
author: { 'schema:author': {
terms: { terms: {
field: "author.keyword", field: "schema:author.keyword",
order: { order: {
_count: "desc" _count: "desc"
} }
} }
}, },
about: { 'entities.dbps:anyURI': {
terms: { terms: {
field: "about.keyword", field: "entities.dbps:anyURI.keyword",
size: 20,
order: { order: {
_count: "desc" _count: "desc"
} }
...@@ -282,9 +282,9 @@ ...@@ -282,9 +282,9 @@
} }
} }
}, },
dataPublished: { 'schema:datePublished': {
date_histogram : { date_histogram : {
field : "dataPublished", field : "schema:datePublished",
format: "MM-yyyy", format: "MM-yyyy",
interval : "month" interval : "month"
} }
...@@ -326,17 +326,18 @@ ...@@ -326,17 +326,18 @@
} }
} }
}, },
author: { 'schema:author': {
terms: { terms: {
field: "author.keyword", field: "schema:author.keyword",
order: { order: {
_count: "desc" _count: "desc"
} }
} }
}, },
about: { 'entities.dbps:anyURI': {
terms: { terms: {
field: "about.keyword", field: "entities.dbps:anyURI.keyword",
size: 20,
order: { order: {
_count: "desc" _count: "desc"
} }
...@@ -358,9 +359,9 @@ ...@@ -358,9 +359,9 @@
} }
} }
}, },
dataPublished: { 'schema:datePublished': {
date_histogram : { date_histogram : {
field : "dataPublished", field : "schema:datePublished",
format: "MM-yyyy", format: "MM-yyyy",
interval : "month" interval : "month"
} }
......
...@@ -209,6 +209,7 @@ ...@@ -209,6 +209,7 @@
_dataChanged: function() { _dataChanged: function() {
var that = this var that = this
var aggs = 0 var aggs = 0
console.log(this.field)
try{ try{
var hits = this.data.aggregations[this.field].buckets; var hits = this.data.aggregations[this.field].buckets;
} }
...@@ -217,7 +218,7 @@ ...@@ -217,7 +218,7 @@
} }
var data = []; var data = [];
hits.forEach(function(entry) { hits.forEach(function(entry) {
data.push([entry.key.toUpperCase(), entry.doc_count]); data.push([entry.key.toUpperCase().split("/")[4], entry.doc_count]);
}); });
that.entities = data; that.entities = data;
filtered = true; filtered = true;
...@@ -229,7 +230,7 @@ ...@@ -229,7 +230,7 @@
filter: function(e) { filter: function(e) {
var myfilters = e.model.__data__.entity[0].toLowerCase().split(" ") var myfilters = e.model.__data__.entity[0].toLowerCase().split(" ")
this.push('filters', { terms: { about: myfilters}}) this.push('filters', { terms: { 'entities.dbps:anyURI': myfilters}})
} }
}); });
......
...@@ -290,15 +290,15 @@ Data can be provided in one of three ways: ...@@ -290,15 +290,15 @@ Data can be provided in one of three ways:
if (field == "sentiment") field = 'sentiments.marl:hasPolarity' if (field == "sentiment") field = 'sentiments.marl:hasPolarity'
if (field == "emotion") field = 'emotions.onyx:hasEmotion.onyx:hasEmotionCategory' if (field == "emotion") field = 'emotions.onyx:hasEmotion.onyx:hasEmotionCategory'
term1[field] = param.toLowerCase().split(" "); term1[field] = param.toLowerCase().split(" ");
if (field == 'dataPublished'){ if (field == 'datePublished'){
term1[field] = param.toLowerCase().split("-"); term1[field] = param.toLowerCase().split("-");
} }
console.log(term1) console.log(term1)
var object = {terms: term1} var object = {terms: term1}
if (field == 'dataPublished'){ if (field == 'schema:datePublished'){
var date = param.toLowerCase().toString().split("-"); var date = param.toLowerCase().toString().split("-");
var term = date[1]+'-'+date[0]+'-01' var term = date[1]+'-'+date[0]+'-01'
object = {range: {dataPublished: {gte: term, boost: 5}}} object = {range: {'schema:datePublished': {gte: term, boost: 5}}}
} }
var isInside = -1 var isInside = -1
for(var i = 0; i < this.filters.length; i++){ for(var i = 0; i < this.filters.length; i++){
...@@ -484,8 +484,8 @@ Data can be provided in one of three ways: ...@@ -484,8 +484,8 @@ Data can be provided in one of three ways:
_dataChanged: function() { _dataChanged: function() {
//console.log("_dataChanged") //console.log("_dataChanged")
console.log(this.field) //console.log(this.field)
console.log(this.data) //console.log(this.data)
var that = this var that = this
var aggs = 0 var aggs = 0
try{ try{
...@@ -495,7 +495,7 @@ Data can be provided in one of three ways: ...@@ -495,7 +495,7 @@ Data can be provided in one of three ways:
var hits = [] var hits = []
} }
var data = []; var data = [];
if (this.field == "dataPublished") { if (this.field == "schema:datePublished") {
hits.forEach(function(entry) { hits.forEach(function(entry) {
data.push([entry.key_as_string, entry.doc_count]); data.push([entry.key_as_string, entry.doc_count]);
}); });
...@@ -505,7 +505,7 @@ Data can be provided in one of three ways: ...@@ -505,7 +505,7 @@ Data can be provided in one of three ways:
data.push([entry.key, entry.doc_count]); data.push([entry.key, entry.doc_count]);
}); });
} }
console.log(data) //console.log(data)
if(data.length == 0 ){ if(data.length == 0 ){
this.$.chartdiv.style.visibility = 'hidden'; this.$.chartdiv.style.visibility = 'hidden';
this.$.nodata.style.visibility = 'visible'; this.$.nodata.style.visibility = 'visible';
......
...@@ -17,11 +17,28 @@ ...@@ -17,11 +17,28 @@
<span>{{title}}</span> <span>{{title}}</span>
</div> </div>
<template is="dom-repeat" items="{{data}}" as="news"> <template is="dom-repeat" items="{{data}}" as="news">
<div class="tweet same-height" style="border: 2px dashed rgba(96, 125, 139, .5); text-align: center;"> <div class$="tweet {{checkSentiment(news.sentiments)}} same-height" style="border: 2px dashed rgba(96, 125, 139, .5); text-align: center;">
<span style="font-weight: bold; font-size:30px; text-align:center; margin: 0 auto; display:block;">{{news.headline}}</span></br> <div class="row"><div class="col-md-7 headline">
<div class="col-md-4">
<img src="{{news.schema:thumbnailUrl}}" style="width: 100%; display:inline-block; left: 0%; position: relative; ">
</div>
<div class="col-md-8">
<span style="font-weight: bold; font-size:30px; display:inline-block; vertical-align: middle;">{{news.schema:headline}}</span>
</div>
</div>
<div class="col-md-1 see-more">
<img src={{checkSource(news.schema:author)}} style="width: 100%; display:block; position: relative;" align="left">
</div>
<div class="col-md-2 emotion-box">
<img src={{checkEmotion(news.emotions)}} style="width: 30%; margin: 0 auto; display: block; position:relative;" data-toggle="tooltip" data-placement="top" title="{{getemotion(news.emotions)}}">
<p class$="emotion {{getemotion(news.emotions)}}">Emotion: {{getemotion(news.emotions)}}</p></br>
</div>
<div class="see-more col-md-2">
<button class="btn btn-primary" ident$="subitem[[index]]" on-click="toggle" aria-expanded$="[[opened]]" aria-controls="collapse">{{buttontext}}<iron-icon icon="expand-more"></iron-icon></button> <button class="btn btn-primary" ident$="subitem[[index]]" on-click="toggle" aria-expanded$="[[opened]]" aria-controls="collapse">{{buttontext}}<iron-icon icon="expand-more"></iron-icon></button>
<img src={{checkSource(news.author)}} style="width: 10%; display:block; left: 3%; position: relative;"> </div>
<img src={{checkEmotion(news.emotions)}} style="width: 3%; margin: 0 auto; display:block; float:right; position:relative; top:-65px;left: -43px;" data-toggle="tooltip" data-placement="top" title="{{getemotion(news.emotions)}}"> </div>
<iron-collapse ident$="subitem[[index]]"> <iron-collapse ident$="subitem[[index]]">
<div class="content" style="text-align:justify; width: 94%; margin: 0 auto;"> <div class="content" style="text-align:justify; width: 94%; margin: 0 auto;">
<br> <br>
...@@ -138,17 +155,17 @@ ...@@ -138,17 +155,17 @@
}, },
checkSentiment: function(sentiment) { checkSentiment: function(sentiment) {
//console.log(sentiment) console.log(sentiment[0]['marl:hasPolarity'])
if (sentiment == "marl:Positive") if (sentiment[0]['marl:hasPolarity'] == "marl:Positive")
return "tweet positive" return "tweet positive-news"
else if (sentiment == "marl:Negative") else if (sentiment[0]['marl:hasPolarity'] == "marl:Negative")
return "tweet negative" return "tweet negative-news"
else else
return "tweet neutral" return "tweet neutral-news"
}, },
getemotion: function(emotion) { getemotion: function(emotion) {
//console.log(sentiment) //console.log(emotion)
return emotion[0]['onyx:hasEmotion']['onyx:hasEmotionCategory'].split('#')[1] return emotion[0]['onyx:hasEmotion']['onyx:hasEmotionCategory'].split(':')[1]
}, },
checkSpanSentiment: function(sentiment) { checkSpanSentiment: function(sentiment) {
//console.log(sentiment) //console.log(sentiment)
......
...@@ -15,6 +15,46 @@ ...@@ -15,6 +15,46 @@
line-height: 35px; line-height: 35px;
} }
.emotion{
text-align: center;
}
.headline{
text-align: left;
}
.emotion-box{
padding-top: 2%;
}
.see-more{
padding-top: 3%;
}
.neutral-emotion{
color: #F7EA2A;
}
.negative-fear{
color: #054990;
}
.sadness{
color: #395EAD;
}
.joy{
color: #75B84C;
}
.disgust{