Programming Utopia, an Alexa skill

4 minute read

According to the World Health Organization, 350 million people worldwide suffer from depression. Depression is the leading cause of disability.

More than 16 million American adults, or 6.7% of the adult population, have experienced at least one major depressive episode in the last year.

  • Anxiety and Depression Association of America.

Recently, there has been a spike in the rise of suicides in the United States. In the past week, two celebrities (Anthony Bourdain and Kate Spade) committed suicide due to depression. There is a need for more ways that victims of depression can get help. This is the motivation behind why I created Utopia.

This blog post will be about a project I’ve been working on for the past couple of months. Using Python, some third party Python packages, and the Alexa Skills kit, I programmed Utopia, an Alexa skill that is designed to help people cope with depression.

[UPDATE 06/07/2018] After a couple iterations with the Alexa Skills team, I am happy to say that Utopia is now live and available in the Alexa Skill store and can be accessed via this link: Utopia Alexa skill or by simply saying, ​​"Alexa, start happy place" to any Alexa supported device.

Disclaimer : Utopia is not meant to be a substitute for professional medical advice, treatment or diagnosis. It is more of a supplemental and informational helper to mitigate depression. The person who programmed this are not experts in mental illnesses such as depression, and this is a product of our subjectivity and couple months of research on depression.

The GitHub Page for this project is located here: Utopia GitHub Page.

The GitHub Repo is located here.

Description

This skill is meant to help people who are going through depression. The main feature of this skill involves taking the Hamilton Depression Rating Scale Survey to get a general idea of the severity of depression, and based on the score of the survey, the skill would recommend certain natural remedies to help. The other complementary features include giving positive and motivational quotes (other types of quotes are also supported), proposing natural solutions, a mindfulness meditation exercise, recommendations for nearby therapists, and, if necessary, getting help from the National Suicide Prevention Lifeline.

Architecture

Utopia-alexa-skill-architecture.png

Features

  • Hamilton Depression Rating Scale Survey consisting of 16 questions to analyze and evaluate level of depression.
    • Added three bonus questions that uses NLTK sentiment analysis to contribute to the survey score.
  • Listen to different categories of quotes from BrainyQuote
    • A few popular categories of quotes include positive, motivational, inspirational, family, love, and positive.
  • Listen to advice and ideas for activities to improve mood
    • Examples include:
      • Listen to music that makes you feel good.
      • Take note of all the small things you’ve accomplished today.
  • Listen to a collection of uplifting & powerful poems
  • Recommend therapists nearby using Google Places API by providing contact information, current availability, and open hours
    • Will find nearby available therapists, and if there are no open therapists nearby, will default to all nearby therapist places (open or closed)
  • National Suicide Prevention Lifeline
    • If certain trigger words are said, this feature will automatically trigger and provide user with contact information for the suicide hotline.
    • For a full list of trigger words, see Trigger Words

Usage

Different from the skill name, the invocation name is ‘happy place’.

To start using it, say a simple invocation phrase, such as the following listed below:

Starting Phrase Example
<invocation name> Alexa, happy place
Launch <invocation name> Alexa, Launch happy place
Open <invocation name> Alexa, Open happy place
Start <invocation name> Alexa, Start happy place

To start and hear the available features, you can say the following:

Alexa, ask happy place for available features

Testing & Code Coverage

To run tests and check code coverage, run the following command in the root project folder:

$ pytest tests/test\_utopia\_unit.py -v —cov utopia —cov-report term-missing

This command will execute the tests and check for test code coverage of the main program (utopia.py), and report which lines were not covered by the test suite (test_utopia_unit.py).

Travis CI  Build Status

This project uses Travis-CI, a hosted, distributed continuous integration service that builds and tests software hosted on GitHub. Every commit that is pushed to a GitHub repo automatically triggers Travis CI to run, build and test your software.

The continuous integration configuration is specified in .travis.yml file, and specifies the programming language used, desired building and testing environments, and various other parameters. For this project, the configuration is set up to create environment variables, install necessary dependencies, run the test suite, and after a successful test run, report code coverage.

Travis CI generates a badge with the current build status (displayed above). Click on the badge for more information.

Codecov  codecov

This project uses Codecov to generate code coverage reports. Codecov is a free, open source code coverage reporting tool that integrates seamlessly with GitHub. It calculates and measures code coverage and delivers the coverage metrics in a clear, understandable way. Similar to Travis CI, Codecov also generates a clickable badge (displayed above) with the current code coverage metrics.