DEV Community

Cover image for DreamScore: What are your COVID-19 dreams trying to tell you?
annacarey
annacarey

Posted on

DreamScore: What are your COVID-19 dreams trying to tell you?

What I built

DreamScore is your personal dream journal that allows you to track your mood by recording your daily dreams.

Category Submission: Interesting Integrations

The application reminds you via SMS to write down your dream each morning and then feeds what you wrote into Google’s Natural Language API, which uses machine learning to determine the emotional attitude of a text. Your entry is given a score (-1 as negative and +1 as positive) which shows your mood.

Over the last few weeks, COVID dreams (and nightmares) have been a common topic of conversation as many people have started sharing their dreams on social media and in the press—and how dreaming has grown in frequency and vividness. Whether because of increased stress and anxiety, a response to a lack of stimuli during social isolation, or a just that people are sleeping more hours than normal, COVID-19 dreams can help give us clues into the state of our subconscious.

Demo Link

http://www.mydreamscores.co

Youtube demo: https://www.youtube.com/watch?feature=player_embedded&v=trBBewI8dcg

Link to Code

Frontend Repo: https://github.com/annacarey/mydreamscores-frontend
Backend Repo: https://github.com/annacarey/mydreamscores-backend

How I built it

This application was built in React (frontend) and Ruby on Rails (backend) and uses Google's Natural Language Processing API and Geocoding API. The application uses the Twilio API to send SMS reminders via chron jobs / Heroku Scheduler. (I am a brand new developer and this is my first project!)

Authenticating the APIs, restricting API keys to certain referrers, and safely securing the private information when deploying to Github and Heroku were some of the most challenging aspects of this project. For example, Google provides authentication secrets in a file and then requests that they be referenced in the application as a file path instead of individual environment variables. Heroku uses secrets in environment variables, so I had to find a workaround when deploying. Also, in order to stay within the free tiers of these APIs, I had to optimize my code to make as few API calls as few as possible. Twilio was a little bit easier to work with, but I had some trouble switching from chron jobs in Rails from my development environment to Heroku Scheduler when I hosted the application.

Additional Resources

Resources about Dreams and COVID:

Resources about Dream Journaling:

Features

  1. Sign up by entering your zipcode first or login. (Zipcode is fed into Google's geocoding API to get your region.)

Homepage Screenshot

  1. Share the details of your dream in a digital journal.

Journal

  1. When you press save, the text is fed into Google's Natural Language Processing API to get the "mood score." The signup page is found here (unless you are already logged in.)

Mood View

  1. Once you have signed up or logged in, you will see the dashboard with your most recent mood score, weekly and all-time averages as well as averages globally and by your region.

Dashboard

  1. You can access your full history and see all past dream journal entries.

History

Top comments (0)