• Stars
    star
    189
  • Rank 197,715 (Top 5 %)
  • Language
    CoffeeScript
  • Created almost 9 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🌍 Sentiment analysis over real-time social media data, rendering live charts to visualise trends

🌍 Twitter Sentiment Visualisations

Visualising sentiment trends from real-time social media data
sentiment-sweep.com

Contents

About

What

A project to make large quantities of social media data more understandable.

How

The app that streams live social media data, and runs it through a custom sentiment analysis algorithm, to determine trends which are then visualised with a series of dynamic real-time charts.

Why

The aim of the app is to allow trends to be found between sentiment and other factors such as geographical location, time of day, demographics, similar topics, etc.

It has a range of uses, like analysing the effectiveness of a marketing campaign, comparing competing products, viewing local trends, gauging public opinion by location, determining best time of day to advertise to certain audiences, etc.

Where

A live demo is available at: http://sentiment-sweep.com

When

This project was initially developed in 2015. Some of the technologies used are a little out-dated now, although the app still works great. A few of the external services that were used to provide additional context (like HP Idol on Demand, and IBM Watson, and certain GCP features) have been discontinued, meaning certain features may now be unavailible on the live instance.


Building

Developing

See the Dev Setup docs for local dev setup.

  1. Prerequisites - You will need Node.js, MongoDB and git installed on your system.
  2. Get the files - git clone https://github.com/Lissy93/twitter-sentiment-visualisation.git tsv then cd tsv
  3. Install dependencies - npm i / yarn will download requirements into node_modules, then automatically kick off a bower install for frontend libraries
  4. Set Config - yarn run config will generate the config\src\keys.coffee file, which you will then need to populate with your API keys and save. 5. Apply Settings - Check that your happy with the general app config in config/src/app-config.coffee
  5. Build Project - yarn build will compile the project from the source, outputting files into dist ready to be published
  6. Start MongoDB - mongod will start a MongoDB instance (run in separate terminal instance, see instructions: Starting a MongoDB instance)
  7. Run the project - yarn dev will build, start the dev server, with live-reload and auto-testing
  8. Open Browser - Navigate to the specified port, to view running app, e.g. http://localhost:8080

Deploying

See the [Prod Deployment(/docs/build-environment.md) docs for more info.

Follow the instructions above, then

  1. Execute Tests - yarn test Ensure all tests pass and everything is working as expected
  2. Build for Prod - yarn build Compile all source files to the dist directory
  3. Start Server - yarn start Spin up HTTP server to start API and serve up compiled files

Testing

See the Test Strategy Docs for more info.
TSV is fully unit tested, and follows a BHD pattern. Unit, integration, coverage and depencency tests can be run using yarn test.

Pass/ Fail Criteria
Test Type Pass Condition
Functional Testing All acceptance criteria must be met, checked and documented
Unit Tests 100% of unit tests must pass. It will be immediately clear when a unit test is failing
Integration Tests 100% pass rate after every commit
Coverage Tests 80% or greater
Code Reviews B grade/ Level 4 or higher. Ideally A grade/ Level 5 if possible.
Dependency Checks Mostly up-to-date dependencies except in justified circumstances.
Testing Tool
  • Framework - Mocha
    • Used in order to store, write and run the tests in a structured way
  • Assertion Library - Chai
    • Provides a structure and syntax in order to actually write the test cases
  • Coverage Testing - Istanbul
    • Measures the proportion of your source code that is covered by your unit tests
  • Stubs, Spies and Mocking - Sinon.js
    • Mocking removes the need to call production APIs while running frontend unit tests
  • Continuous Integration Testing - Travis CI
    • Ensures that all the standalone modules function correctly when put together
  • Dependency Checking - David
    • Checks that each dependency is present, correct, secure and functional
  • Automated Code Review's - Code Climate
    • Scans for best practices, and fails in any part of the code could be improved upon
  • Headless Browser Testing - PhantomJS
    • Runs frontend tests without the need for a GUI browser
  • Testing HTTP services - SuperTest
    • Tests API endpoints and ensures routing is working correctly

Automated Workflows

TSV uses the Gulp streaming build tool to automate the prod and dev workflows. For more info, see the Build Environment docs.

The following tasks are useful for getting started:

  • gulp generate-config - Generates correctly structured default configuration files for settings and API keys
  • gulp build - Builds the project fully, including optimization, compilation, minification and validation
  • gulp nodemon - Runs the application on the default port (probably 8080), with live refresh
  • gulp test - Executes all unit and coverage tests, and generates a report containing the results
  • gulp - Default dev task - check the project is configured correctly, build ALL the files, run the server, watch for changes, recompile relevant files and reload browsers on change, and keep all browsers in sync, when a test condition changes it will also re-run tests - a lot going on!

Modules

The project was developed in a modular approach, made up of several distinct components. Each is published as a fully tested, documented and MIT-licensed NPM module for easy re-use.

  • sentiment-analysis - Useses AFINN-111 approach to calculate overall sentiment of a given sentence
  • fetch-tweets - Fetches tweets from Twitter based on topic, location, timeframe or combination
  • stream-tweets - Streams live Twitter data in real-time, based on location, given term, etc
  • remove-words - Removes all non-key words from a given string
  • place-lookup - Finds the latitude and longitude for any fuzzy place name using the Google Places API
  • hp-haven-sentiment-analysis - A Node.js client library for HP Haven OnDemand Sentiment Analysis module
  • haven-entity-extraction - Node.js client for HP Haven OnDemand Entity Extraction
  • tweet-location - Calculates the location from geo-tagged Tweets using the Twitter Geo API
  • find-region-from-location - Given a latitude and longitude calculates which region that point belongs in

Project Info

Project Planning

A set of User Stories with Acceptance Criteria and Complexity Estimates were drawn up outlining what features the finished solution should have. These were expaned upon further with wireframes in the Methodology section.

Technologies

View full tech stack at: stackshare.io/Lissy93/sentiment-sweep

The backend is primarily written in Node.js, with web-sockets facilitating the real-time communication with the frontend, and a data cache stored in MongoDB. Pages are rendered isomorphically, with data visualizations written using D3.js. Social data is fetched from Twitter, compute happens locally, and a few external APIs were used to provide additional context in the form of AI. Views are written in Pug, styles in Less, scripts in CoffeeScript and everything is compiled via a Gulp script.

The project and app are still functional, however 5 years on, this would not be an ideal tech stack. There are now better technologies available that would enable greater performance, less code, easier project management and improved developer experience. If I was to re-write this project in 2022, a better tech stack would likely be Go for the backend, Svelte + Svelte Kit for the frontend and TypeScript for the code, with Pixi.js for the interactive content, styled-components for styling and Rollup for putting it all together.

Status

Build Status View on Snyk Code Climate Size Website

Demo

A live demo of the application has been deployed to: http://sentiment-sweep.com

View Screenshots of each screen in the docs.

Screenshots

Awards

Alicia Sykes - StartHack Winner Alicia Sykes - Oxford Winner

The first stages of the project were developed at StartHack Switzerland 2014, where it won first-place.

It was then further expanded upon, and used as part of my undergraduate thesis, where it won the Oxford BCS best Dissertation Award.




The University Project recieved 96%, so feel free to use it as an example - here's the Final Report in PDF format (warning - it's 300 pages!). And the deck used for the technical presentation, us available at: presentation.sentiment-sweep.com


Documentation


License

twitter-sentiment-visualisation was developed by Alicia Sykes, licensed under MIT Β© 2014 - 2022.

For information, see TLDR Legal > MIT

The MIT License (MIT)
Copyright (c) Alicia Sykes <[email protected]> 

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
(the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merge,
publish, distribute, sub-license, and/or sell copies of the Software,
and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be
included install copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANT ABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Β© Alicia Sykes 2015 - 2020
Licensed under MIT

Thanks for visiting :)

More Repositories

1

dashy

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!
Vue
11,322
star
2

personal-security-checklist

πŸ”’ A compiled checklist of 300+ tips for protecting digital security and privacy in 2022
11,205
star
3

awesome-privacy

πŸ¦„ A curated list of privacy & security-focused software and services
4,081
star
4

portainer-templates

🚒 400+ 1-click Portainer app templates
Python
512
star
5

dotfiles

🧰 ~ β€’ My Đotfiles
Shell
102
star
6

email-comparison

πŸ“¬ A quick comparison of private and / or secure email providers
TypeScript
57
star
7

espanso-config

πŸ¦„ My configuration files for the Espanso text expander
Shell
48
star
8

Lissy93

πŸ₯³ Hello World!
42
star
9

Brewfile

🍺 My Brewfile, for installing all packages required for development maching on MacOS via Homebrew
Ruby
42
star
10

anti-theft-charge

πŸ”‹ Safely charge your phone in public places without the worry of it being stolen
Kotlin
39
star
11

minimal-terminal-prompt

πŸ“Ÿ A clean PS1 bash prompt, showing user, host, pathname and git status
Shell
38
star
12

hasami-shogi

πŸ€„ 2-player tactical iOS game: Based on the traditional Japanese board game, Hasami Shogi (Swift V1.0)
Swift
31
star
13

devolio

✨ A developer portfolio site for the rest of us! Aggregates all your projects, blog posts, and stats in one place
Svelte
27
star
14

sentiment-analysis

🎈 A Node.js AFINN-111 based sentiment analysis module
CoffeeScript
26
star
15

md-cv-maker

πŸŽ“ A highly customisable template for a single-page material design CV website
Pug
24
star
16

quick-example-of-testing-in-nodejs

πŸ›‘ An example TDD project in Node.js, with unit tests, coverage tests, a stubbed API, continuous integration, code quality reviews and automated dependency checking
JavaScript
21
star
17

all-the-countries

🌎 Just a quick app, for learning the countries, their capital cities, flags and other info
Vue
20
star
18

cheat-code

πŸ’« An AI-powered coding assistant, built to try out the ChatGPT API
Svelte
18
star
19

go-apod

🌌 A CORS-enabled, no-auth API for NASA's Astronomy Picture of the Day
Go
17
star
20

pax

πŸ“Έ A script which removes flashes from a video stream
Python
17
star
21

wapalyzer

🌐 Identify the technologies powering any website. This is a fork of the now deleted Wappalyzer project by @AliasIO and community.
JavaScript
15
star
22

usermonkey

πŸ’ A complete user system written in PHP
PHP
13
star
23

cyber-defence-presentation

πŸ–₯️ A reveal.js website for presenting the cyber security basics to humans
JavaScript
11
star
24

aliciasykes.com

πŸš€ The homepage for Alicia Sykes
Vue
11
star
25

realtime-speech-analytics

πŸ—£οΈ Real-time visual analytics and entity extraction of live speech
JavaScript
11
star
26

happy-app

πŸ˜ƒ Frictionless and anonymouse feedback system for agile teams
JavaScript
11
star
27

tfl-lift-availability-dash

↕️ Dashboard showing real-time availability of lifts at train stations | Infra-hack project
Vue
8
star
28

dash

πŸ’¨ A customizable personal dashboard with a focus on speed, simplicity and security. ⚠️ Depricated, see Dashy: https://github.com/Lissy93/dashy instead
Vue
8
star
29

conky-system-stats-widget

πŸŽ€ A minimal conky configuration to show real-time system resource usage on Linux
Shell
7
star
30

tweet-location

πŸ—ΊοΈ Returns a latitude and longitude from a Twitter place ID
JavaScript
7
star
31

repo-badge-maker

πŸ›‘οΈ Very, very quick script to generate repo badges for blog posts
HTML
7
star
32

callisto-theme-standard-notes

πŸŒ‘ A dusty navy and teal color theme for Standard Notes and Listed.to
CSS
7
star
33

md-toc-generator

πŸ“’ Quick script to generate a table of contents from a markdown document
HTML
6
star
34

ahk-to-espanso

⌨️ Just a quick tool to convert AutoHotkey scripts into Espanso config files
HTML
6
star
35

place-lookup

πŸ—ΊοΈ A lightweight Node.js module to get the latitude and longitude for any fuzzy place name using the Google Places API
JavaScript
6
star
36

docker-tcpdump

🐳 Small Docker container to sniff the traffic of any other Docker container with tcpdump
Dockerfile
6
star
37

remove-words

πŸ“° A node module that returns all words from a string in a custom defined list. By default will remove all pronouns and conjunctions.
JavaScript
6
star
38

nfu

🀦 NFU: Not Fucking Up- A Flutter app to help you really easily keep track of your targets
Dart
5
star
39

super-simple-static-site

A template for a static website with an easily customisable gulp config (CofeeScript, SASS and Jade by default).
JavaScript
5
star
40

spotter

β›³ An iOS app for recording observations geographically, and visualizing them on a map
Swift
5
star
41

Study-Time

πŸ“š An (Android) app to reduce distraction while your studying
Java
5
star
42

currency-flags

πŸ‡ͺπŸ‡Ί Flag assets to represent world currencies
Astro
5
star
43

email-extractor

πŸ“¨ Quick tool to finds and extract email addresses from a body of text
HTML
5
star
44

bullet-convertor

⏺️ Just a quick script to automate a common plain-text to markdown formatting task
HTML
5
star
45

vue-checklist

β˜‘οΈ Simple vue component for showing checklists
Vue
4
star
46

digital-bucket-web-analytics

node.js web app displaying visual analytic for money donated to charities via the digital bucket app
JavaScript
4
star
47

gulp-example

πŸ’Ž An example implementation of the gulp build tool in a Node.js Express web app
JavaScript
4
star
48

un-wasted

πŸ” A blockchain implementation of a social food app | Un-Wasted! | Your Bite on the Block
JavaScript
4
star
49

voronoi-site-template

πŸ’ The template, for my GitHub pages sites, the background is an interactive voronoi diagram.
HTML
4
star
50

stream-tweets

A Node module that uses the Twitter API to stream Tweets in real-time
JavaScript
4
star
51

digital-defense.io_depricated

πŸ‘₯ A website/ blog containing a series of guides to help inform people about personal cyber security and online privacy
Vue
4
star
52

TreasureHunt

🧭 A native Android app for treasure hunts
Java
4
star
53

parker

πŸ“‘ Parker is a helpful bot that uses NLP to read privacy policies for you, so you know what your signing up to! [Dead]
Shell
4
star
54

AlternativeVoteSystem

πŸ“’ MVC Java Application
Java
3
star
55

repo-heroes

πŸ‘‘ Identifying the true heroes of open source projects
CSS
3
star
56

TuneSender

🎢 An Android application that sends musical tones via SMS
Java
3
star
57

repo-template

:octocat: A full-featured, ready to go GitHub repository template
3
star
58

node-smart-depart

⏰ The backend for a smart alarm that looks for delays on your commute and wakes you up earlier is necessary
JavaScript
3
star
59

vue-link-grid

◻️ Just a grid of link buttons
CSS
3
star
60

web-dev-school

πŸŽ’ The source code for a web development tutorial site based on an XML database
JavaScript
3
star
61

find-region-from-location

πŸ“ Finds the country name, alpha-2 and alpha-3 codes from latitude and longitude
JavaScript
3
star
62

DEPRICATED-realtime-ev-charging-stats

πŸš— A ReactJS app that gets real-time data from electric vehicle charring posts around the world. Then displays the results in a series of live visual analytics using D3.js
CSS
3
star
63

got-home-safe

🏑 An Android app for sending automated SMS messages when at a particular GPS location
Java
3
star
64

fetch-tweets

A node module that fetches tweets from Twitter based on topic, location or timeframe
JavaScript
3
star
65

node-tfl-journey-planner

πŸš† A node module for the TFL journey planner
LiveScript
2
star
66

haven-entity-extraction

Node.js client for HP Haven OnDemand Entity Extraction
JavaScript
2
star
67

hackathon_elevate-to-awesome

πŸ—οΈ React Native app built at Hack Junction Helsinki. Make KONE elevators smart.
JavaScript
2
star
68

placemaker-hackathon

All code developed during the #placemeker hackathon
JavaScript
2
star
69

OlliePoole.github.io

HTML
2
star
70

homepage-for-awesome-code.co.uk

🌊 Just a quick homepage so that this domain isn't blank
HTML
2
star
71

feeds

πŸ—žοΈ Cache of RSS Feeds (used to render posts section on my website)
1
star
72

gen-art-sketch-pad

A place for my crappy Processing draftsπŸ–οΈ
1
star
73

intern-magnet

🧲 A fully-functional PHP prototype app which matches interns with employers
PHP
1
star
74

minesweper

πŸ•ΉοΈ A remake of the classic minesweeper game for Android devices
Java
1
star
75

make-package.json-great-again

😎 OSX app to run scripts defined in a package.json with one press using that fancy new touchbar on the Macbook Pro
Swift
1
star
76

callisto-theme

1
star
77

haven-sentiment-analysis

🎩 A Node.js client library for HP Haven OnDemand Sentiment Analysis module
JavaScript
1
star
78

london-underground-live-sentiment-analysis

A node modules that analyses recent Twitter feeds mentioning each London Underground line, and than uses HP IDOL OnDemand Sentiment Analysis to determine whether overall each line is receiving positive or negative tweets.
JavaScript
1
star
79

raid-calculator

πŸ’½ A quick tool for determining and comparing approximate capacity, speed and fault tolerance of different RAID configurations
TypeScript
1
star
80

digital-defense.io

TypeScript
1
star