• Stars
    star
    189
  • Rank 204,649 (Top 5 %)
  • Language
    CoffeeScript
  • Created over 9 years ago
  • Updated over 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

conky-system-stats-widget

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

tweet-location

๐Ÿ—บ๏ธ Returns a latitude and longitude from a Twitter place ID
JavaScript
7
star
30

repo-badge-maker

๐Ÿ›ก๏ธ Very, very quick script to generate repo badges for blog posts
HTML
7
star
31

callisto-theme-standard-notes

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

md-toc-generator

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

ahk-to-espanso

โŒจ๏ธ Just a quick tool to convert AutoHotkey scripts into Espanso config files
HTML
6
star
34

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
35

docker-tcpdump

๐Ÿณ Small Docker container to sniff the traffic of any other Docker container with tcpdump
Dockerfile
6
star
36

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
37

nfu

๐Ÿคฆ NFU: Not Fucking Up- A Flutter app to help you really easily keep track of your targets
Dart
5
star
38

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
39

spotter

โ›ณ An iOS app for recording observations geographically, and visualizing them on a map
Swift
5
star
40

Study-Time

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

currency-flags

๐Ÿ‡ช๐Ÿ‡บ Flag assets to represent world currencies
Astro
5
star
42

email-extractor

๐Ÿ“จ Quick tool to finds and extract email addresses from a body of text
HTML
5
star
43

bullet-convertor

โบ๏ธ Just a quick script to automate a common plain-text to markdown formatting task
HTML
5
star
44

vue-checklist

โ˜‘๏ธ Simple vue component for showing checklists
Vue
4
star
45

digital-bucket-web-analytics

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

un-wasted

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

voronoi-site-template

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

stream-tweets

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

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
50

TreasureHunt

๐Ÿงญ A native Android app for treasure hunts
Java
4
star
51

gulp-example

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

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
53

AlternativeVoteSystem

๐Ÿ“ข MVC Java Application
Java
3
star
54

repo-heroes

๐Ÿ‘‘ Identifying the true heroes of open source projects
CSS
3
star
55

TuneSender

๐ŸŽถ An Android application that sends musical tones via SMS
Java
3
star
56

repo-template

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

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
58

vue-link-grid

โ—ป๏ธ Just a grid of link buttons
CSS
3
star
59

find-region-from-location

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

web-dev-school

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

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
62

got-home-safe

๐Ÿก An Android app for sending automated SMS messages when at a particular GPS location
Java
3
star
63

fetch-tweets

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

node-tfl-journey-planner

๐Ÿš† A node module for the TFL journey planner
LiveScript
2
star
65

haven-entity-extraction

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

hackathon_elevate-to-awesome

๐Ÿ—๏ธ React Native app built at Hack Junction Helsinki. Make KONE elevators smart.
JavaScript
2
star
67

placemaker-hackathon

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

OlliePoole.github.io

HTML
2
star
69

homepage-for-awesome-code.co.uk

๐ŸŒŠ Just a quick homepage so that this domain isn't blank
HTML
2
star
70

feeds

๐Ÿ—ž๏ธ Cache of RSS Feeds (used to render posts section on my website)
1
star
71

gen-art-sketch-pad

A place for my crappy Processing drafts๐Ÿ–๏ธ
1
star
72

readme-contribs

๐Ÿ’ž Simple embeddable contributor and sponsor widgets for your GitHub README
TypeScript
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