Building a Serverless Dashboard for Real-time Social Media Data Analysis
top of page

LBSocial

Building a Serverless Dashboard for Real-time Social Media Data Analysis


In this video tutorial, you'll learn how to create a serverless dashboard to analyze and visualize social media data in real time using AWS Lambda functions and MongoDB.

Create Lambda functions

  1. Open AWS Console. Search and open AWS Lambda Service.

  2. Create the first Lambda function

  3. Name: collect_tweets

  4. Runtime: python 3.9

  5. Leave everything else as default and create the function

  6. Upload the collect_tweets.zip

  7. In Configuration/General configuration:

  • Memory: 500 MB

  • Ephemeral storage: 1000 MB

  • Timeout: 1 min

  1. In Configuration/Environment variables, create the following variables and provide corresponding values:

  • api_key

  • api_secret

  • access_token

  • access_secret

  • mongodb_connect

  • database_name

  • geocode

  • q_parameter

  1. In Test, create a new event to test the function.

  2. If the test is successful, add a trigger:

  • Source: EventBridge

  • Create a new rule

  • Name: every5min

  • Schedule expression: rate(5 minutes)

  1. Create the second Lambda function

  2. Name: sentiment_tweets

  3. Runtime: python 3.9

  4. Leave everything else as default and create the function

  5. Upload the sentiment_tweets.zip

  6. In Configuration/General configuration:

  • Memory: 500 MB

  • Ephemeral storage: 1000 MB

  • Timeout: 1 min

  1. In Configuration/Environment variables, create the following variables and provide corresponding values:

  • mongodb_connect

  • database_name

  • lang

  1. In Test, create a new event to test the function.

  2. If the test is successful, add a trigger:

  • Source: EventBridge

  • Use existing rule: every5min

Create a MongoDB Dashboard

  1. Log in to the MongoDB website and find the database that contains the collected tweets.

  2. Open MongoDB Chart and add a dashboard. Use the final project database as the data resource. Create the following charts and add filters to all charts to show the data from the last 60 minutes.

  3. A number chart to show the total number of collected Tweets

  4. A line chart shows the number of tweets with different sentiments over time. Use the local time zone.

  5. A word cloud to show the top 50 popular hashtags

  6. A bar chart to show the top 10 active Twitter users

  7. A table to show the Twitter texts, number of favorites, positive scores, and negative scores.



29 views0 comments
bottom of page