This app is a combination of Ruby on Rails and Processing. It currently lives at: http://tweetography.herokuapp.com
Ruby 1.9.3p125 / Rails 3.2.3
- install necessary packages (gcc, git, etc)
- install ruby version manager (rvm)
- install the latest version of ruby with rvm
- install rails
- within the project directory, run
bundle install
to install any necessary gems - set up environment variables:
RESQUE_USER
,RESQUE_PASS
,TWITTER_CONSUMER_KEY
,TWITTER_CONSUMER_SECRET
,TWITTER_OAUTH_TOKEN
,TWITTER_OAUTH_TOKEN_SECRET
,REDISTOGO_URL
- run
rails s
to fire up an instance of the server - navigate to http://localhost:3000
Processing (visualization only)
- extract the 4 library files in the
libraries.zip
folder to /Username/Documents/Processing/libraries or c:/My Documents/Processing (on PC, you might need to make a new folder) - load finalProject.pde
- run
Overall, the app hinges on two primary capabilities:
- data collection through Ruby and APIs
- visualization through Processing
The Ruby/Rails app is fairly simple. A basic search form allows users to search for tweets by keyword and near a location. The work is pushed off to a Resque worker. A series of steps takes place:
- Location input is converted to lat/lon for Twitter API call via Ruby Geocoder
- Twitter search API returns a list of tweet objects
- Tweets can be geocoded and come with lat/lon, but the large majority of them do not; we then try to use user-reported location to query via Ruby Geocoder to ascertain location coordinates. If no location can be found, the tweet is thrown out.
- Mood of the user is analyzed through calls to the Twitter Sentiment API, which measures tweets on a 0,2,4 scale from sad to happy.
- Additional information, like tweet source, number of followers of a user, etc are also collected
- Results are stored in a database, which can then be queried by the visualization.