/Tweets-Realtime-Analysis

Realtime Tweet Analysis using Kafka and Spark Streaming to visualize trending hashtags

Primary LanguagePython

Tweet Analysis using Kafka and Spark Streaming

Built a real-time analytics dashboard to visualize the trending hashtags and @mentions at a given location by using real time streaming twitter API to get data.


Technology stack

stack


Area Technology
Front-End HTML5, Bootstrap, CSS3, Socket.IO, highcharts.js
Back-End Express, Node.js
Cluster Computing Framework Apache Spark (python)
Message Broker Apache kafka

Architecture


architecture


How it works

  1. Extract data from Twitter's streaming API and put it into Kakfa topic.
  2. Spark is listening to this topic, it will read the data from topic, analyze it is using spark streaming and put top 10 trending hashtags and @mentions into another kafka topic.
  3. Spark Streaming creates DStream whenever it read the data from kafka and analyze it by performing operation like map, filter, updateStateByKey, countByValues and forEachRDD on the RDD and top 10 hashtags and mentions are obtained from RDD using SparkSQL.
  4. Node.js will pick up the this data from kafka topic on server side and emit it to the socket.
  5. Socket will push data to user's dashboard which is rendered using highcharts.js in realtime.
  6. The dashboard is refreshed every 60 secs.


hashtags

mentions