Covid MentAid uses various IBM Technologies to analyze sentiment of the tweets of the public from all over the world during the covid19 Pandemic. The resulting analysis is presented in a Live web-framework (dashboard) as a series of graphs and charts and a Twitter bot which replies to people’s tweet which indicates fear, sadness, scared with funny memes/gifs/motivating pics from Reddit.
- Short description
- Youtube video
- PPT
- Live App Link
- Flow of the Project
- Included components
- Featured technologies
- Steps to run the Dashboard (UBUNTU-Angular)
- Steps to run the Twitter Reddit Bot (Python)
- Results
- Contributors
COVID-19 outbreak was first reported in Wuhan, China, and has spread to more than 50 countries. WHO declared COVID-19 as a Public Health Emergency of International Concern (PHEIC) on 30 January 2020. Currently, people are staying inside their homes for 4 months for self-quarantine purposes. This has led to a sharp increase in mental health problems and suicide rates all across the globe.
In this project, our server application subscribes to a LIVE Twitter feed with hashtags of "Covid19". Each tweet received will be analyzed for emotional tone and sentiment, and the intent of the tweet will be determined by the Watson Assistant service. All data is stored in a Cloudant database. The resulting analysis is presented in a web-framework (dashboard) as a series of graphs and charts.
In addition to this, we have a Twitter Bot which replies to people’s tweets which indicates fear, sadness, scared with funny memes/gifs/motivating lines and a hotline for suicide help based on their geo-location supplied by twitter API.
Note: - The link may or may not be active. We are using the free plan of IBM cloud service and as this project takes LIVE tweets this requires us to change the api credentials after certain period of time based on the number of tweets stored in the cloudant.
If you want to see the live demo, refer the youtube link given above or contact us to on the website at
2018.abhay.gupta@ves.ac.in
- Tweets are pushed out by Twitter.
- The Sentiment Analysis of COVID-19 Tweets app processes the tweet.
- The Watson Tone Analyzer Service performs analysis of sentiment and emotional tone.
- The Watson Natural Language Understanding Service pulls out keywords and entities.
- The Watson Assistant Service extracts the intents (verbs) from the tweets.
- Tweets and metadata are stored in Cloudant
- The dashboard displays charts and graphs as well as the tweets.
- Watson Assistant: Watson Assistant is a robust platform that allows developers and non-technical users to collaborate on building conversational AI solution.
- Watson Tone Analyzer: Uses linguistic analysis to detect communication tones in written text.
- Watson Natural Language Understanding: Natural language processing for advanced text analysis.
- IBM Cloudant: A managed NoSQL database service that moves application data closer to all the places it needs to be — for uninterrupted data access, offline or on.
- Cloud Foundry: Build, deploy, and run applications on an open source cloud platform.
- Artificial Intelligence: Artificial intelligence can be applied to disparate solution spaces to deliver disruptive technologies.
- Databases: Repository for storing and managing collections of data.
- Angular: A framework to build UI for mobile and desktop application.
- Node.js: An open-source JavaScript run-time environment for executing server-side JavaScript code.
- Express: Fast, unopinionated, minimalist web framework for Node.js
We can deploy the code to IBM Cloud (or run the code locally, there will be one more step to configure the credentials locally.)
- Install Dependencies
- Twitter Requirements
- Create Watson services with IBM Cloud
- Import the Assistant workspace
- Configure credentials
- Run the application
The application requires the following software to be installed locally.
- Node (6.9+): Application runtime environment, download and install the package.
- Angular CLI (6.1.1): A CLI for Angular applications, installed with:
npm install -g @angular/cli
. - Angular (6.1.0): Angular will be added as a dependency of client in
package.json
when setting up client usingAngular cli
. - Express (4.16.3): Express will be added as a dependency in
package.json
for server.
If you have Angular CLI already installed. Please read the upgrade instructions for Angular CLI when you upgrade the software.
Run the following command, from the application folder, to install both the client and server dependencies.
$ npm run app-install
To subscribe to Tweets from a specific handle or hashtag in this application, it is required to create a Twitter account and a Twitter application. The Twitter account will be used as the account that receives the messages from other Twitter users as well as the owner of the application, required by Twitter, to receive Tweets.
- You can create a normal Twitter account on Twitter or use an existing account. It is required to provide a unique email id that isn't already associated with an existing Twitter account as well as a phone number to verify the account.
- Once you have the Twitter account created and verified, log in to Twitter Dev and create an application.
- Select the Keys and Access Tokens tab and generate a Consumer Key and Secret. Keep this page open as you will need to use these tokens into setup procedure in the application later on.
Either Setup the IBM Cloud Deployment or Setup Local Deployment.
Create the IBM Cloud services and configure them to use on a locally running server app.
If you do not already have a IBM Cloud account, signup for IBM Cloud. Create the following services:
NOTE: When provisioning Cloudant, for
Available authentication methods
chooseUse both legacy credentials and IAM
- Find the Assistant service in your IBM Cloud Dashboard.
- Click on the service and then click on
Launch tool
. - Go to the
Skills
tab. - Click
Create new
- Click the
Import skill
tab. - Click
Choose JSON file
, and upload this. the workspace.json file in - Select
Everything
and clickImport
.
To find the WORKSPACE_ID
for Watson Assistant:
- Go back to the
Skills
tab. - Click on the three dots in the upper right-hand corner of the app and select
View API Details
. - Copy the
Workspace ID
GUID.
Fill in the requried details needed in the server/env.sample
Change it's name to ".env"
This is to be done before executing on the IBM server.
The
.env
file is where all the parameters like credentials, log settings and other constants required by this application is kept.
The credentials for IBM Cloud services (Tone Analyzer, Natural Language Understanding, and Cloudant), can be found in the Services
menu in IBM Cloud, by selecting the Service Credentials
option for each service.
NOTE: When provisioning Cloudant, for
Available authentication methods
chooseUse both legacy credentials and IAM
From the root of the project, go to server
folder (cd server
) and
Add all the credentials that you have saved from creating the services, as explained earlier, in the .env
file.
Either Run the app on IBM Cloud
or Run the app locally
.
- Compile the Angular client code and Express server code using the following command. This creates a
dist
folder in your project root directory and copies the compile code and necessary files to be deployed to IBM cloud.
$ npm run build
- Connect to IBM Cloud in the command line tool and follow the prompts to log in
$ ibmcloud cf login -a https://api.ng.bluemix.net
Make sure you set the
target
andspace
correctly usingibmcloud target -o <target> -s <space>
- Push the app to IBM Cloud.
$ ibmcloud app push
- The application should now be running on IBM Cloud and listening to Tweets. You can get the application URL by going to
Cloud Foundry Applications
section of IBM cloud dashboard. Click the name of the application you just pushed and clikcVisit App URL
to access the application.
Once all the credentials are in place, the application can be started with:
$ npm run start
The server runs on port 3000
and the client
runs on port 4200
. You can access the UI by accessing the following URL in the browser:
http://localhost:4200
- Our bot replies to original tweets of user using a particular hashtag(eg: #Covid19) which it detects sad using the IBM watson tone analyzer with a motivation pic using the reddit api from the subreddit MotivationalPics.
- Twitter Handle of the bot: - profile
- Twitter Keys: Use the previously created twitter dev acc's keys or make new one and use them to fill the consumer_ket, consumer_secret, access_token, access_token_secret fields.
- Ibm Keys: Create a new tone analyzer service using a new IBM cloud account and use these to fill ibm_key, ibm_url fields.
- Reddit Keys: Create a reddit api and use the given keys to fill the C_id, C_secret, User_agent, Uname, Password. Note: User_agent: can be any string, it's a description of ur app,, Uname: username use to login on reddit,, Password: main password of your reddit account, C_id is the first yellow box and C_secret is the second yellow box as shown: -
- Use
pip install -r requirements.txt
to install all the dependecies. - run the tempBot.py program to start the bot.
Note: - To change subreddit from which the reddit bot gives posts, change the name on line number 20 in reddit_twitter_bot.py
Note: - To host the bot to run 24/7 we reccomend python anywhere (use pip3
to install and python3
on it's console to run the files.
You will see informations about Tweets:
as well as Classification of live tweets, Sentiment over time, Emotional Tone over time, and Keywords mentioned:
Twitter bot replying to sad/depressed tweets with motivational pics/quotes:
Jay Jhaveri: https://github.com/JayJhaveri1906
Prem Chhabria: https://github.com/premchhabria
Abhay Gupta: https://github.com/abhay8463
Neeraj Ochani: https://github.com/neeraj0008
Prasad Govekar: https://github.com/govekarmohit