Giter Club home page Giter Club logo

gcptweetcapture's Introduction

tweetcapture

GCP tweet capture and sentiment analysis

This demo uses the following components of GCP: kubernetes, docker, pubsub, Natural Language (sentiment analysis), BigQuery, and Data Studio

Setup

Clone the example repo

If you haven't already, clone the Github repository for this demo:

git clone https://github.com/NeudesicGCP/GCPTweetCapture.git

Set project

gcloud config set project neu-ncaa

Changing topics

The topics that are being captured are found in the file neu-ncaa/tweetcapture/pubsub/tweet-capture-docker-image/twitter-to-pubsub.py

Edit the list of topics using your favorite editor

nano twitter-to-pubsub.py

Create the docker image using cloud build - (if topics are changed)

(from /neu/tweetcapture/pubsub/tweetcapture-docker-image folder)

gcloud builds submit --tag gcr.io/neu-ncaa/tweetcapture-image .

Capturing tweets

Kubernetes cluster create (cloud shell)

gcloud beta container --project "neu-ncaa" clusters create "ncaatweet-cluster" --zone "us-central1-a" --service-account "[email protected]"
gcloud container clusters get-credentials ncaatweet-cluster --zone us-central1-a --project neu-ncaa

Create the pods

(from /neu-ncaa/tweetcapture/pubsub folder)

kubectl create -f twitter-stream.yaml
kubectl create -f bigquery-controller.yaml

Check the pods

kubectl get pods

Stoping the tweet capture

kubectl delete deployment -l "name in (twitter-stream, bigquery-controller)"

###################################################################################

Sentiment Analysis using Google Natural Language API

(must be run from a virtual environment using CloudShell)

pip install virtualenv
virtualenv twitter
source twitter/bin/activate
twitter/bin/pip install google-cloud-language
pip install google-cloud-bigquery

Process tweet sentiment

(from /neu-ncaa/tweetcapture/sentiment folder)

run during and after the tweet capture

python bigquery-sentiment-analysis-naturallanguage.py ncaa_tweets

###################################################################################

Visualization - Data Studio

This visualization in Google Data Studio uses several views in BigQuery that pull from the tweet and tweetsentiment tables

https://datastudio.google.com/open/1m4S2Hqn1BCi7ql_2sfCEzz6H7x0oiAEY

###################################################################################

Cleanup

Delete kubernetes cluster

gcloud beta container --project "neu-ncaa" clusters delete "ncaatweet-cluster" --zone "us-central1-a"

gcptweetcapture's People

Contributors

mikesherrill avatar

Watchers

Matthew Emes avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.