SlideShare a Scribd company logo
www.autentia.com
GeoSentimentZ
domingo 2 de junio de 13
www.autentia.com
Who’s that guy
domingo 2 de junio de 13
www.autentia.com
Want to track something?
Probably people is talking
about it on the Web and
social media
domingo 2 de junio de 13
www.autentia.com
Are you trendy?
domingo 2 de junio de 13
www.autentia.com
Are you trendy?
domingo 2 de junio de 13
www.autentia.com
New ways to measure
TPS: Tweets Per Second
domingo 2 de junio de 13
www.autentia.com
New ways to measure
TPS: Tweets Per Second
domingo 2 de junio de 13
www.autentia.com
New ways to measure
TPS: Tweets Per Second
domingo 2 de junio de 13
www.autentia.com
New ways to measure
TPS: Tweets Per Second
domingo 2 de junio de 13
www.autentia.com
How influential are you?
domingo 2 de junio de 13
www.autentia.com
New tools to measure
Built on APIs to get data
Built on APIs to represent data
domingo 2 de junio de 13
www.autentia.com
The Building blocks:
The APIs
domingo 2 de junio de 13
www.autentia.com
Google Maps API
Well known interface
Gives different layers
- Map
- Terrain
- Satellite
Place Points Of Interest
Group POIs
POI metadata
domingo 2 de junio de 13
www.autentia.com
Google Maps API use
<script	
  src="http://maps.google.com/maps/api/js?sensor=false"></script>
var	
  map;
function	
  initialize()	
  {
	
  	
  var	
  center	
  =	
  new	
  google.maps.LatLng(50,	
  20);
	
  	
  map	
  =	
  new	
  google.maps.Map(document.getElementById('map'),	
  {
	
  	
  	
  	
  zoom:	
  3,
	
  	
  	
  	
  center:	
  center,
	
  	
  	
  	
  mapTypeId:	
  google.maps.MapTypeId.ROADMAP
	
  	
  });
}
google.maps.event.addDomListener(window,	
  'load',	
  initialize);
domingo 2 de junio de 13
www.autentia.com
Google Maps API use
<script	
  src="http://maps.google.com/maps/api/js?sensor=false"></script>
var	
  map;
function	
  initialize()	
  {
	
  	
  var	
  center	
  =	
  new	
  google.maps.LatLng(50,	
  20);
	
  	
  map	
  =	
  new	
  google.maps.Map(document.getElementById('map'),	
  {
	
  	
  	
  	
  zoom:	
  3,
	
  	
  	
  	
  center:	
  center,
	
  	
  	
  	
  mapTypeId:	
  google.maps.MapTypeId.ROADMAP
	
  	
  });
}
google.maps.event.addDomListener(window,	
  'load',	
  initialize);
<div id="map-container">
<div id="map"></div>
</div>
domingo 2 de junio de 13
www.autentia.com
Google Maps API use
function	
  callEvents(){
	
   var	
  searchQuery	
  =	
  $('#searchQuery').value;
	
   $.ajax({
	
   	
   url:	
  '/sentimentz/pois/'	
  +	
  encodeURIComponent(searchQuery),
	
   	
   type:	
  'GET',
	
   	
   contentType:	
  'application/json',
	
   	
   success:	
  function(data){
	
   	
   	
   setTimeout(function(){	
  putEvents(data)},	
  500);
	
   	
   },
	
   	
   error:	
  function(data,	
  status,	
  er){
	
   	
   	
   //....
	
   	
   }
	
   });
}
domingo 2 de junio de 13
www.autentia.com
Google Maps API use
function	
  callEvents(){
	
   var	
  searchQuery	
  =	
  $('#searchQuery').value;
	
   $.ajax({
	
   	
   url:	
  '/sentimentz/pois/'	
  +	
  encodeURIComponent(searchQuery),
	
   	
   type:	
  'GET',
	
   	
   contentType:	
  'application/json',
	
   	
   success:	
  function(data){
	
   	
   	
   setTimeout(function(){	
  putEvents(data)},	
  500);
	
   	
   },
	
   	
   error:	
  function(data,	
  status,	
  er){
	
   	
   	
   //....
	
   	
   }
	
   });
}
[
	
  	
  	
  {
	
  	
  	
  	
  	
  	
  "rate":0,
	
  	
  	
  	
  	
  	
  "msg":"Muy	
  buena	
  exposición	
  	
  sobre	
  API	
  business	
  
model	
  #APIDays",
	
  	
  	
  	
  	
  	
  "location":{
	
  	
  	
  	
  	
  	
  	
  	
  	
  "latitude":40.44614387,
	
  	
  	
  	
  	
  	
  	
  	
  	
  "longitude":-­‐3.67365923
	
  	
  	
  	
  	
  	
  },
	
  	
  	
  	
  	
  	
  "id":340414678016593920,
	
  	
  	
  	
  	
  	
  "createAt":1369996158000
	
  	
  	
  }
]
domingo 2 de junio de 13
www.autentia.com
Google Maps API use
function	
  putEvents(events){
	
   var	
  bounds	
  =	
  new	
  google.maps.LatLngBounds();
	
   var	
  markers	
  =	
  [];
	
   document.getElementById("totalGeoTweets").innerHTML	
  =	
  events.length;
	
  	
  	
  	
  for	
  (var	
  i	
  =	
  0;	
  i	
  <	
  events.length;	
  i++)	
  {
	
  	
  	
  	
  	
  	
  var	
  event	
  =	
  events[i];
	
  	
  	
  	
  	
  	
  var	
  latLng	
  =	
  new	
  google.maps.LatLng(event.location.latitude,
	
  	
  	
  	
  	
  	
  	
  	
  	
  	
  event.location.longitude);
	
  	
  	
  	
  	
  	
  bounds.extend(latLng);
	
  	
  	
  	
  	
  	
  var	
  marker	
  =	
  new	
  google.maps.Marker({
	
  	
  	
  	
  	
  	
  	
  	
  position:	
  latLng,
	
  	
  	
  	
  	
  	
  	
  	
  map:	
  map,
	
  	
  	
  	
  	
  	
  });
	
  	
  	
  	
  	
  	
  markers.push(marker);
	
  	
  	
  	
  }
	
   map.fitBounds(bounds);
	
  	
  	
  	
  var	
  markerCluster	
  =	
  new	
  MarkerClusterer(map,	
  markers);
}
domingo 2 de junio de 13
www.autentia.com
The Source: twitter
An open window to shout your
thougths...
... that everyone can listen
#hashtags
@users
queryStrings
Geolocalized
domingo 2 de junio de 13
www.autentia.com
Info contained in a tweet
http://www.geekosystem.com/tweet-diagram/
domingo 2 de junio de 13
www.autentia.com
Twitter: The search API
domingo 2 de junio de 13
www.autentia.com
Twitter: The search API
<dependency>
	 <groupId>org.twitter4j</groupId>
	 <artifactId>twitter4j-core</artifactId>
	 <version>3.0.3</version>
</dependency>
domingo 2 de junio de 13
www.autentia.com
Twitter: The search API
<dependency>
	 <groupId>org.twitter4j</groupId>
	 <artifactId>twitter4j-core</artifactId>
	 <version>3.0.3</version>
</dependency>
public	
  List<Event>	
  retrieveAllTweetsByQuery(String	
  hashtag)
	
   	
   throws	
  TwitterException,	
  MalformedURLException	
  {
	
   Twitter	
  twitter	
  =	
  TwitterFactory.getInstance();
	
   Query	
  query	
  =	
  new	
  Query(hashtag);
	
   QueryResult	
  result;
	
   List<Status>	
  tweets	
  =	
  new	
  ArrayList<Status>();
	
   do	
  {
	
   	
   result	
  =	
  twitter.search(query);
	
   	
   tweets.addAll(result.getTweets());
	
   }	
  while	
  ((query	
  =	
  result.nextQuery())	
  !=	
  null);
}	
  
domingo 2 de junio de 13
www.autentia.com
Twitter: The search API
public	
  List<Event>	
  retrieveAllTweetsByQuery(String	
  hashtag)
	
   	
   throws	
  TwitterException,	
  MalformedURLException	
  {
	
   Twitter	
  twitter	
  =	
  getTwitterAccessor();
	
   Query	
  query	
  =	
  new	
  Query(hashtag);
	
   QueryResult	
  result;
	
   List<Status>	
  tweets	
  =	
  new	
  ArrayList<Status>();
	
   do	
  {
	
   	
   result	
  =	
  twitter.search(query);
	
   	
   tweets.addAll(result.getTweets());
	
   }	
  while	
  ((query	
  =	
  result.nextQuery())	
  !=	
  null);
}	
  
domingo 2 de junio de 13
www.autentia.com
What others have done
World Cup TrendsMap
domingo 2 de junio de 13
www.autentia.com
What others have done
Magnitude Calculator
http://hitching.net/magnitwude/
domingo 2 de junio de 13
www.autentia.com
What others have done
domingo 2 de junio de 13
www.autentia.com
The missing piece
Adding sentimental analysis
domingo 2 de junio de 13
www.autentia.com
The missing piece
Adding sentimental analysis
domingo 2 de junio de 13
www.autentia.com
The missing piece
@Value
("https://store.apicultur.com/api/stmtlk/1.0.0/valoracion/tweet/10")
private	
  String	
  serviceUrl	
  =	
  null;
private	
  RestTemplate	
  restTemplate;
<dependency>
	 <groupId>org.springframework</groupId>
	 <artifactId>spring-web</artifactId>
	 <version>${spring.version}</version>
</dependency>
domingo 2 de junio de 13
www.autentia.com
The missing piece
public	
  Sentiment	
  rate(Tweet	
  tweet)	
  {
	
  	
  	
  logger.debug("Rating	
  sentimentally	
  tweet	
  "	
  +	
  tweet.getText());
	
  	
  	
  Sentiment	
  sentiment;
	
  	
  	
  try	
  {
	
  	
  	
  	
  	
  	
  	
  sentiment	
  =	
  
restTemplate.postForObject(serviceUrl,	
  tweet,
	
  Sentiment.class);
	
  	
  	
  }	
  catch	
  (Exception	
  ex)	
  {
	
  	
  	
  	
  	
  	
  	
  logger.error("Could	
  not	
  rate	
  "	
  +	
  tweet	
  
+	
  "	
  Error:	
  "	
  +	
  ex.getMessage(),	
  ex);
	
  	
  	
  	
  	
  	
  	
  return	
  Sentiment.UNRATED;
	
  	
  	
  }
	
  	
  	
  logger.debug("Tweet	
  rated	
  sentimentally	
  as	
  :	
  "	
  +	
  sentiment);
	
  	
  	
  return	
  sentiment;
}
domingo 2 de junio de 13
www.autentia.com
The missing piece
public	
  class	
  Sentiment	
  {
	
  	
  	
  	
  private	
  static	
  final	
  int	
  LEVEL_UNKNOWN	
  =	
  0;
	
  	
  	
  	
  public	
  static	
  final	
  Sentiment	
  UNRATED	
  =	
  
new	
  Sentiment(LEVEL_UNKNOWN,	
  LEVEL_UNKNOWN,	
  "NEUTRO");
	
  	
  	
  	
  @JsonProperty("intensidad")
	
  	
  	
  	
  private	
  int	
  intensity	
  =	
  0;
	
  	
  	
  	
  @JsonProperty("certidumbre")
	
  	
  	
  	
  private	
  int	
  certainty	
  =	
  0;
	
  	
  	
  	
  @JsonProperty("ponderacion")
	
  	
  	
  	
  private	
  String	
  sentiment;
}
domingo 2 de junio de 13
www.autentia.com
The missing piece
public	
  class	
  Sentiment	
  {
	
  	
  	
  	
  private	
  static	
  final	
  int	
  LEVEL_UNKNOWN	
  =	
  0;
	
  	
  	
  	
  public	
  static	
  final	
  Sentiment	
  UNRATED	
  =	
  
new	
  Sentiment(LEVEL_UNKNOWN,	
  LEVEL_UNKNOWN,	
  "NEUTRO");
	
  	
  	
  	
  @JsonProperty("intensidad")
	
  	
  	
  	
  private	
  int	
  intensity	
  =	
  0;
	
  	
  	
  	
  @JsonProperty("certidumbre")
	
  	
  	
  	
  private	
  int	
  certainty	
  =	
  0;
	
  	
  	
  	
  @JsonProperty("ponderacion")
	
  	
  	
  	
  private	
  String	
  sentiment;
}
{
	
  	
  "intensidad":	
  4,
	
  	
  "certidumbre":	
  4,
	
  	
  "ponderacion":	
  "POSITIVA",
	
  	
  "texto":	
  "wso2	
  api	
  manager	
  interesante	
  
gestionar	
  apis	
  uso	
  http//kcyme/lqie	
  
apidays"
}
domingo 2 de junio de 13
www.autentia.com
Putting all the blocks
toghether:
GeoSentimentZ
domingo 2 de junio de 13
www.autentia.com
GeoSentimentz
domingo 2 de junio de 13
www.autentia.com
Some final considerations
Be careful with API invocation pace
(Some APIs have limits/prices)
Use Queues/Schedulers to calm API
calls traffic
Some Sentiment could not be reliable
Intruder tweets
Not spanish
Slang, arbbr, typos
domingo 2 de junio de 13
www.autentia.com
“Somos pocos, somos buenos, estamos
motivados y nos gusta lo que hacemos”
Thanks for listening
@dgomezg
@autentia
domingo 2 de junio de 13

More Related Content

Viewers also liked (6)

Unit v
Unit vUnit v
Unit v
 
Introduction to method overloading &amp; method overriding in java hdm
Introduction to method overloading &amp; method overriding  in java  hdmIntroduction to method overloading &amp; method overriding  in java  hdm
Introduction to method overloading &amp; method overriding in java hdm
 
Files in c++
Files in c++Files in c++
Files in c++
 
Data file handling in c++
Data file handling in c++Data file handling in c++
Data file handling in c++
 
File Handling in C++
File Handling in C++File Handling in C++
File Handling in C++
 
File Handling In C++
File Handling In C++File Handling In C++
File Handling In C++
 

Similar to Geo-SentimentZ

Parse - a mobile backend platform
Parse - a mobile backend platformParse - a mobile backend platform
Parse - a mobile backend platform
Carlotta Tatti
 
How Quick Can We Be? Data Visualization Techniques for Engineers.
How Quick Can We Be? Data Visualization Techniques for Engineers. How Quick Can We Be? Data Visualization Techniques for Engineers.
How Quick Can We Be? Data Visualization Techniques for Engineers.
Avni Khatri
 

Similar to Geo-SentimentZ (20)

Parse - a mobile backend platform
Parse - a mobile backend platformParse - a mobile backend platform
Parse - a mobile backend platform
 
Advancing the UI — Part 1: Look, Motion, and Gestures
Advancing the UI — Part 1: Look, Motion, and GesturesAdvancing the UI — Part 1: Look, Motion, and Gestures
Advancing the UI — Part 1: Look, Motion, and Gestures
 
WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015WordPress Realtime - WordCamp São Paulo 2015
WordPress Realtime - WordCamp São Paulo 2015
 
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
FITC Web Unleashed 2017 - Introduction to the World of Testing for Front-End ...
 
An Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End DevelopersAn Introduction to the World of Testing for Front-End Developers
An Introduction to the World of Testing for Front-End Developers
 
Harnessing the Power of the Web via R Clients for Web APIs
Harnessing the Power of the Web via R Clients for Web APIsHarnessing the Power of the Web via R Clients for Web APIs
Harnessing the Power of the Web via R Clients for Web APIs
 
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
Reactive Java Microservices with Spring Boot and JHipster - Denver JUG 2021
 
Fundamental of android
Fundamental of androidFundamental of android
Fundamental of android
 
Android basic 3 Dialogs
Android basic 3 DialogsAndroid basic 3 Dialogs
Android basic 3 Dialogs
 
Intro to Parse
Intro to ParseIntro to Parse
Intro to Parse
 
First meet with Android Auto
First meet with Android AutoFirst meet with Android Auto
First meet with Android Auto
 
Android Location-based應用開發分享
Android Location-based應用開發分享Android Location-based應用開發分享
Android Location-based應用開發分享
 
Creating a Facebook Clone - Part XLV.pdf
Creating a Facebook Clone - Part XLV.pdfCreating a Facebook Clone - Part XLV.pdf
Creating a Facebook Clone - Part XLV.pdf
 
@Anywhere
@Anywhere@Anywhere
@Anywhere
 
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікац...
 
How data rules the world: Telemetry in Battlefield Heroes
How data rules the world: Telemetry in Battlefield HeroesHow data rules the world: Telemetry in Battlefield Heroes
How data rules the world: Telemetry in Battlefield Heroes
 
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on AndroidMobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
Mobile 2.0 Open Ideas WorkShop: Building Social Media Enabled Apps on Android
 
Connecting Pebble to the World
Connecting Pebble to the WorldConnecting Pebble to the World
Connecting Pebble to the World
 
How Quick Can We Be? Data Visualization Techniques for Engineers.
How Quick Can We Be? Data Visualization Techniques for Engineers. How Quick Can We Be? Data Visualization Techniques for Engineers.
How Quick Can We Be? Data Visualization Techniques for Engineers.
 
Creating a Facebook Clone - Part XXVIII.pdf
Creating a Facebook Clone - Part XXVIII.pdfCreating a Facebook Clone - Part XXVIII.pdf
Creating a Facebook Clone - Part XXVIII.pdf
 

More from David Gómez García

Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
David Gómez García
 

More from David Gómez García (20)

Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022Leverage CompletableFutures to handle async queries. DevNexus 2022
Leverage CompletableFutures to handle async queries. DevNexus 2022
 
Building Modular monliths that could scale to microservices (only if they nee...
Building Modular monliths that could scale to microservices (only if they nee...Building Modular monliths that could scale to microservices (only if they nee...
Building Modular monliths that could scale to microservices (only if they nee...
 
Building modular monoliths that could scale to microservices (only if they ne...
Building modular monoliths that could scale to microservices (only if they ne...Building modular monoliths that could scale to microservices (only if they ne...
Building modular monoliths that could scale to microservices (only if they ne...
 
Leveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results AsynchrhonouslyLeveraging Completable Futures to handle your query results Asynchrhonously
Leveraging Completable Futures to handle your query results Asynchrhonously
 
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021Builiding Modular monoliths that can scale to microservices. JBCNConf 2021
Builiding Modular monoliths that can scale to microservices. JBCNConf 2021
 
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integrationCdm mil-18 - hypermedia ap is for headless platforms and data integration
Cdm mil-18 - hypermedia ap is for headless platforms and data integration
 
What's in a community like Liferay's
What's in a community like Liferay'sWhat's in a community like Liferay's
What's in a community like Liferay's
 
Java9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidadJava9 Beyond Modularity - Java 9 más allá de la modularidad
Java9 Beyond Modularity - Java 9 más allá de la modularidad
 
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTRT3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
 
Managing user's data with Spring Session
Managing user's data with Spring SessionManaging user's data with Spring Session
Managing user's data with Spring Session
 
Parallel streams in java 8
Parallel streams in java 8Parallel streams in java 8
Parallel streams in java 8
 
Construccion de proyectos con gradle
Construccion de proyectos con gradleConstruccion de proyectos con gradle
Construccion de proyectos con gradle
 
Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.Java 8 Stream API. A different way to process collections.
Java 8 Stream API. A different way to process collections.
 
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
 
Measuring Code Quality in WTF/min.
Measuring Code Quality in WTF/min. Measuring Code Quality in WTF/min.
Measuring Code Quality in WTF/min.
 
Spring4 whats up doc?
Spring4 whats up doc?Spring4 whats up doc?
Spring4 whats up doc?
 
Gradle como alternativa a maven
Gradle como alternativa a mavenGradle como alternativa a maven
Gradle como alternativa a maven
 
El poder del creador de Software. Entre la ingeniería y la artesanía
El poder del creador de Software. Entre la ingeniería y la artesaníaEl poder del creador de Software. Entre la ingeniería y la artesanía
El poder del creador de Software. Entre la ingeniería y la artesanía
 
HDTR images with Photoshop Javascript Scripting
HDTR images with Photoshop Javascript ScriptingHDTR images with Photoshop Javascript Scripting
HDTR images with Photoshop Javascript Scripting
 
Wtf per lineofcode
Wtf per lineofcodeWtf per lineofcode
Wtf per lineofcode
 

Recently uploaded

Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
Safe Software
 

Recently uploaded (20)

From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
From Daily Decisions to Bottom Line: Connecting Product Work to Revenue by VP...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Essentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with ParametersEssentials of Automations: Optimizing FME Workflows with Parameters
Essentials of Automations: Optimizing FME Workflows with Parameters
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptxIOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
IOS-PENTESTING-BEGINNERS-PRACTICAL-GUIDE-.pptx
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
Empowering NextGen Mobility via Large Action Model Infrastructure (LAMI): pav...
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1UiPath Test Automation using UiPath Test Suite series, part 1
UiPath Test Automation using UiPath Test Suite series, part 1
 
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
Exploring UiPath Orchestrator API: updates and limits in 2024 🚀
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 

Geo-SentimentZ

  • 3. www.autentia.com Want to track something? Probably people is talking about it on the Web and social media domingo 2 de junio de 13
  • 6. www.autentia.com New ways to measure TPS: Tweets Per Second domingo 2 de junio de 13
  • 7. www.autentia.com New ways to measure TPS: Tweets Per Second domingo 2 de junio de 13
  • 8. www.autentia.com New ways to measure TPS: Tweets Per Second domingo 2 de junio de 13
  • 9. www.autentia.com New ways to measure TPS: Tweets Per Second domingo 2 de junio de 13
  • 10. www.autentia.com How influential are you? domingo 2 de junio de 13
  • 11. www.autentia.com New tools to measure Built on APIs to get data Built on APIs to represent data domingo 2 de junio de 13
  • 12. www.autentia.com The Building blocks: The APIs domingo 2 de junio de 13
  • 13. www.autentia.com Google Maps API Well known interface Gives different layers - Map - Terrain - Satellite Place Points Of Interest Group POIs POI metadata domingo 2 de junio de 13
  • 14. www.autentia.com Google Maps API use <script  src="http://maps.google.com/maps/api/js?sensor=false"></script> var  map; function  initialize()  {    var  center  =  new  google.maps.LatLng(50,  20);    map  =  new  google.maps.Map(document.getElementById('map'),  {        zoom:  3,        center:  center,        mapTypeId:  google.maps.MapTypeId.ROADMAP    }); } google.maps.event.addDomListener(window,  'load',  initialize); domingo 2 de junio de 13
  • 15. www.autentia.com Google Maps API use <script  src="http://maps.google.com/maps/api/js?sensor=false"></script> var  map; function  initialize()  {    var  center  =  new  google.maps.LatLng(50,  20);    map  =  new  google.maps.Map(document.getElementById('map'),  {        zoom:  3,        center:  center,        mapTypeId:  google.maps.MapTypeId.ROADMAP    }); } google.maps.event.addDomListener(window,  'load',  initialize); <div id="map-container"> <div id="map"></div> </div> domingo 2 de junio de 13
  • 16. www.autentia.com Google Maps API use function  callEvents(){   var  searchQuery  =  $('#searchQuery').value;   $.ajax({     url:  '/sentimentz/pois/'  +  encodeURIComponent(searchQuery),     type:  'GET',     contentType:  'application/json',     success:  function(data){       setTimeout(function(){  putEvents(data)},  500);     },     error:  function(data,  status,  er){       //....     }   }); } domingo 2 de junio de 13
  • 17. www.autentia.com Google Maps API use function  callEvents(){   var  searchQuery  =  $('#searchQuery').value;   $.ajax({     url:  '/sentimentz/pois/'  +  encodeURIComponent(searchQuery),     type:  'GET',     contentType:  'application/json',     success:  function(data){       setTimeout(function(){  putEvents(data)},  500);     },     error:  function(data,  status,  er){       //....     }   }); } [      {            "rate":0,            "msg":"Muy  buena  exposición    sobre  API  business   model  #APIDays",            "location":{                  "latitude":40.44614387,                  "longitude":-­‐3.67365923            },            "id":340414678016593920,            "createAt":1369996158000      } ] domingo 2 de junio de 13
  • 18. www.autentia.com Google Maps API use function  putEvents(events){   var  bounds  =  new  google.maps.LatLngBounds();   var  markers  =  [];   document.getElementById("totalGeoTweets").innerHTML  =  events.length;        for  (var  i  =  0;  i  <  events.length;  i++)  {            var  event  =  events[i];            var  latLng  =  new  google.maps.LatLng(event.location.latitude,                    event.location.longitude);            bounds.extend(latLng);            var  marker  =  new  google.maps.Marker({                position:  latLng,                map:  map,            });            markers.push(marker);        }   map.fitBounds(bounds);        var  markerCluster  =  new  MarkerClusterer(map,  markers); } domingo 2 de junio de 13
  • 19. www.autentia.com The Source: twitter An open window to shout your thougths... ... that everyone can listen #hashtags @users queryStrings Geolocalized domingo 2 de junio de 13
  • 20. www.autentia.com Info contained in a tweet http://www.geekosystem.com/tweet-diagram/ domingo 2 de junio de 13
  • 21. www.autentia.com Twitter: The search API domingo 2 de junio de 13
  • 22. www.autentia.com Twitter: The search API <dependency> <groupId>org.twitter4j</groupId> <artifactId>twitter4j-core</artifactId> <version>3.0.3</version> </dependency> domingo 2 de junio de 13
  • 23. www.autentia.com Twitter: The search API <dependency> <groupId>org.twitter4j</groupId> <artifactId>twitter4j-core</artifactId> <version>3.0.3</version> </dependency> public  List<Event>  retrieveAllTweetsByQuery(String  hashtag)     throws  TwitterException,  MalformedURLException  {   Twitter  twitter  =  TwitterFactory.getInstance();   Query  query  =  new  Query(hashtag);   QueryResult  result;   List<Status>  tweets  =  new  ArrayList<Status>();   do  {     result  =  twitter.search(query);     tweets.addAll(result.getTweets());   }  while  ((query  =  result.nextQuery())  !=  null); }   domingo 2 de junio de 13
  • 24. www.autentia.com Twitter: The search API public  List<Event>  retrieveAllTweetsByQuery(String  hashtag)     throws  TwitterException,  MalformedURLException  {   Twitter  twitter  =  getTwitterAccessor();   Query  query  =  new  Query(hashtag);   QueryResult  result;   List<Status>  tweets  =  new  ArrayList<Status>();   do  {     result  =  twitter.search(query);     tweets.addAll(result.getTweets());   }  while  ((query  =  result.nextQuery())  !=  null); }   domingo 2 de junio de 13
  • 25. www.autentia.com What others have done World Cup TrendsMap domingo 2 de junio de 13
  • 26. www.autentia.com What others have done Magnitude Calculator http://hitching.net/magnitwude/ domingo 2 de junio de 13
  • 27. www.autentia.com What others have done domingo 2 de junio de 13
  • 28. www.autentia.com The missing piece Adding sentimental analysis domingo 2 de junio de 13
  • 29. www.autentia.com The missing piece Adding sentimental analysis domingo 2 de junio de 13
  • 30. www.autentia.com The missing piece @Value ("https://store.apicultur.com/api/stmtlk/1.0.0/valoracion/tweet/10") private  String  serviceUrl  =  null; private  RestTemplate  restTemplate; <dependency> <groupId>org.springframework</groupId> <artifactId>spring-web</artifactId> <version>${spring.version}</version> </dependency> domingo 2 de junio de 13
  • 31. www.autentia.com The missing piece public  Sentiment  rate(Tweet  tweet)  {      logger.debug("Rating  sentimentally  tweet  "  +  tweet.getText());      Sentiment  sentiment;      try  {              sentiment  =   restTemplate.postForObject(serviceUrl,  tweet,  Sentiment.class);      }  catch  (Exception  ex)  {              logger.error("Could  not  rate  "  +  tweet   +  "  Error:  "  +  ex.getMessage(),  ex);              return  Sentiment.UNRATED;      }      logger.debug("Tweet  rated  sentimentally  as  :  "  +  sentiment);      return  sentiment; } domingo 2 de junio de 13
  • 32. www.autentia.com The missing piece public  class  Sentiment  {        private  static  final  int  LEVEL_UNKNOWN  =  0;        public  static  final  Sentiment  UNRATED  =   new  Sentiment(LEVEL_UNKNOWN,  LEVEL_UNKNOWN,  "NEUTRO");        @JsonProperty("intensidad")        private  int  intensity  =  0;        @JsonProperty("certidumbre")        private  int  certainty  =  0;        @JsonProperty("ponderacion")        private  String  sentiment; } domingo 2 de junio de 13
  • 33. www.autentia.com The missing piece public  class  Sentiment  {        private  static  final  int  LEVEL_UNKNOWN  =  0;        public  static  final  Sentiment  UNRATED  =   new  Sentiment(LEVEL_UNKNOWN,  LEVEL_UNKNOWN,  "NEUTRO");        @JsonProperty("intensidad")        private  int  intensity  =  0;        @JsonProperty("certidumbre")        private  int  certainty  =  0;        @JsonProperty("ponderacion")        private  String  sentiment; } {    "intensidad":  4,    "certidumbre":  4,    "ponderacion":  "POSITIVA",    "texto":  "wso2  api  manager  interesante   gestionar  apis  uso  http//kcyme/lqie   apidays" } domingo 2 de junio de 13
  • 34. www.autentia.com Putting all the blocks toghether: GeoSentimentZ domingo 2 de junio de 13
  • 36. www.autentia.com Some final considerations Be careful with API invocation pace (Some APIs have limits/prices) Use Queues/Schedulers to calm API calls traffic Some Sentiment could not be reliable Intruder tweets Not spanish Slang, arbbr, typos domingo 2 de junio de 13
  • 37. www.autentia.com “Somos pocos, somos buenos, estamos motivados y nos gusta lo que hacemos” Thanks for listening @dgomezg @autentia domingo 2 de junio de 13