How's India Feeling?
An application which displays India's region wise twitter sentiment on the map.
How to run?
git clone https://github.com/geekyJock8/hows_india_feeling.git
In the backend folder create a new file
config.pypaste 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'
- cd into backend
This will fetch the latest data from Twitter API.
tweet_handler.py contains the logic of fetching tweets.
- Inside backend run
Note down the url of your local server
Set API Endpoint
In root directory, in
api_url = 'YOUR LOCAL SERVER'
(It's most likely going to be at
index.htmlin a browser
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
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.
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.
- Improve UI
- Improve mapping logic
- Create Logic for smaller areas
- Make a better todo list
Contributions are welcome!