MyMood
Project Details
My Mood is an interactive Alexa application that a user can talk about their day with. The goal of this application is to improve, assess, and get help for the user's mental state.
Features
MyMood has three main features:
- Sentiment analysis based on user's raw input
- Activated with the keyword "Today". Ex: "Today, it's my birthday"
- Currently passes the input to a Naive-Bayes classifier to determine the sentiment. Classifier is trained with data set provided by sentiment140
- Responds with congratulatory or sympathetic statement based on classification
- Diagnose the user for depression with a series of questions
- Activated with the intent trigger "take an assessment"
- Questions are based off of the Diagnostic and Statistical Manual of Mental Disorders, 4th Edition
- Computes using a decision tree constructed based on the "Differential Diagnosis of Mood Disorders" from the manual above
- Locate a nearby clinic using the set Alexa location in conjunction with Google Places API
- Activated with the intent trigger "look for professional help"
- Sends a get request to the Amazon Device Address API if the user has granted authorization
- Uses the location obtained to retrieve the details of a nearby mental health institute by issuing a series of get requests to Google Places API
Components
Components Overview Figure
The following is a list of components relevant to MyMood:
- Python 3 - General purpose programming language with well maintained machine learning libraries
- Flask-Ask - A flask extension to create Alexa skills using Python to streamline the development process
- Amazon Echo - Hardware device also known as Amazon Alexa. The target platform that this application will run on
- Alexa Skills Kit - API used to create Alexa skills by handling the properties of the skill
- Amazon Web Services - Provides on-demand cloud computing platforms such as Lambda and DynamoDB
- Amazon Lambda - Event-driven server-less computing platform used by Alexa skills. It is also used for machine learning model computing
- Amazon DynamoDB - A NoSQL database service managed on the cloud. Used to gather anonymous interactions as data for researchers and system improvement
- Google Places API - Provides local clinic information based on the user's location
On-Boarding Guide
Development Team Guidelines
Scrum Process
- Issues are tracked on Waffle.io
- Sprints start Tuesday morning and end Monday night
- Developers should attempt to have their tasks completed by Saturday and address feedback by Monday night
Developer Guidelines
One exception is that we prefer
if(...) {
...
}
else {
...
}
over
if(...) {
...
} else {
...
}
- Code should be tested before issuing a pull request
- Code needs to be reviewed and receive the approval of 2 other developers before being rebased and merged
-
There should be 1 commit per task, even if changes were made in response to feedback. This makes issue tracking and bug fixing a lot easier. Each commit should also have a matching issue in waffle with the same header.
E.g. If the task is to add a button to the interface, there should only be 1 commit for it in the commit tree
Environment Setup Instructions
Python Environment
- Download and Install Anaconda and Spyder
-
Using the Anaconda Prompt:
Check that Python 3.x is installed with python --version
Use: conda install python=3.6
and conda update python
if it isn't
Install Flask-Ask framework with conda install -c anaconda flask
on the Anaconda Prompt
DynamoDB
- Follow instructions to set up AWS CLI
- Install boto3 on anaconda with:
conda install -c anaconda boto3
- Follow instructions to configure boto3
- Run create_table() from database.py
- DynamoDB commands can be found here
Google Places API
- For local testing, get a Google Places API key here
- Create a config file in your local mymood repository named 'config.py'
- Insert your API key in config.py as
API_KEY='YOUR_KEY'
Local Testing
-
Download ngrok
-
Run main.py on Spyder
-
Without stopping main.py, run ngrok.exe and enter 'ngrok http 5000'
-
Copy the forwarding endpoint, which looks something like https://4986f389.ngrok.io
. Make sure it's the https endpoint
-
Go to Alexa Developer Console and under Build > Endpoint, paste the ngrok https endpoint in default region. Select 'My development endpoint is a subdomain of a domain...' and click 'Save Endpoints'
Ngrok Endpoint in Alexa Skill Console
-
Test through the Developer Console or with your Alexa
-
Terminate main.py and ngrok when you have finished testing
Useful GitHub Commands
Setting Up the Local Repository
- Fork organization’s master repository at https://github.com/MyMood-Alexa/MyMood to your own GitHub
git clone https://github.com/<your_github_id>/MyMood
git remote -v
should show 2 origin links
git remote add upstream https://github.com/MyMood-Alexa/MyMood
git remote -v
should show 2 origin links and 2 upstream links
Pull Request Workflow
git commit -m "<waffle_issue_header>"
to add your changes to a commit, or git commit --amend --no-edit
to amend your topmost commit without adding another commit. Use git rebase -i
to correct an even older commit.
git pull --rebase upstream master
to get the latest source code from the master repository while putting your commits on top
git push
to push to your forked repository, or git push upstream <your_local_branch>:<remote_branch>
to push to your branch on the master repository
- Submit pull request:
- If needed to fulfill a subtask: Add “required by #” to pull review description
- If needed to fix a bug: Add “closes #” to pull review description
- Attach testing screenshots to your pull review description
- Address any feedback regarding your pull request and retest if needed. When your pull review has received at least 2 approvals, it can be rebased and merged
Waffle management
- Epics should have tags
Ex: Sentiment Analysis Milestone 1 would look like this: [SA-1]
- To add a subtask to an epic, add "child of #" and "connects #" to the subtask description