Skip to content
An application which displays India's region wise twitter sentiment on the map.
JavaScript Python Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
backend
geoJsonData
styles
.gitignore
README.md
index.html
index.js
states.js

README.md

How's India Feeling?

An application which displays India's region wise twitter sentiment on the map.

Site screenshot

How to run?

Clone

  1. git clone https://github.com/geekyJock8/hows_india_feeling.git

Configurations

  1. In the backend folder create a new file config.py

  2. In config.py paste the following code with your twitter api credentials:

    consumer_key = 'YOUR KEY'
    consumer_secret = 'YOUR SECRECT'
    access_token = 'YOUR TOKEN'
    access_token_secret = 'YOUR TOKEN SECRET'
    

Latest data

  1. cd into backend
  2. Run python3 tweet_handler.py

This will fetch the latest data from Twitter API. tweet_handler.py contains the logic of fetching tweets.

Run Server

  1. Inside backend run python app.py

Note down the url of your local server

Set API Endpoint

  1. In root directory, in index.js:

    Set api_url = 'YOUR LOCAL SERVER'

    (It's most likely going to be at http://127.0.0.1:5000/)

Run

  1. Open index.html in a browser

Tweet Fetching

The idea was to show the sentiment of each particular area. So, far it only fetches tweets state wise.

Since Twitter doesn't allow a geometry parameter to filter tweets, we are using points and radius filter of twitter api. The mapping is stored in constants.py

Twitter limit

Since there's a limit on the number of tweets we can fetch, only a few number of tweets are fetched per 15 minutes. The tweet_handler.py is required to added as cron job which is to be run every 15 minutes.

Also, the number of tweets fetched per state is not same, rather's proportional to the state's population density.

Mapping Visualized

State Mapping

Next step would be to replace this logic with something which is more correct. One possible solution is to fill each area with smaller circles and use these circles. This is a good starting point.

TODOS

  1. Improve UI
  2. Improve mapping logic
  3. Create Logic for smaller areas
  4. Make a better todo list

Contributions are welcome!

You can’t perform that action at this time.