Inspiration

With the social isolation and economic fallout brought upon by the COVID-19 pandemic, mental health has become a national crisis. In fact, in a survey conducted by Qualtrics, 54.7% of adults have reported experiencing feelings of depression during the pandemic. In my own personal experience, I have found journaling to be a helpful way of being more mindful of my mental health, especially under these circumstances. Journaling can help us express our emotions, reflect on our problems, or even keep track of the moments we're grateful for! As someone who is always interested in analyzing my habits and psyche, I wanted a way to be able to track the progression of my mental health and see how it changes over time— what better way to do that than integrate technology with this habit of mine? I had heard of Sentiment Analysis before in the context of academia and business strategies, but I thought it would be an interesting idea to bring this technology into the world of journaling.

What it does

Journly allows users to enter daily journal entries, and then it will use machine learning to analyze the text and outputs a positive or negative value, which is known as "polarity". Using a library called natural, Journly assigns salient words a normalized value ranging from -1 to 1: -1 corresponds to an entry that is strongly negative, while 1 corresponds to an entry that is strongly positive. Then, the entry as a whole is given an overall assessment based on these individual values. They are then added to a database so that they can be analyzed in the "insights" section. This section provides the user an average score among all entries, their lowest score and its corresponding post/date, their highest score and its corresponding post/date, and a chart showing the progression of a user's scores.

How I built it

I used Node.js & Express.js for the backend, MongoDB for the database (hosted on Google Cloud), EJS as a templating engine, the natural library for any NLP processing, and HTML/CSS/Bootstrap for some design elements.

Challenges I ran into

Before this project, I had never created a full-stack web application with a user database and authentication system. Because of this, I required a bit of a learning curve, and it took me a rather big chunk of time to figure out how to set up the database and have it connect to the backend. I also had trouble displaying the chart, as I couldn't access DOM objects from the server-side and couldn't pass my backend data to the client-side JavaScript through EJS, so it required a tricky workaround where I had to pass the data as an attribute in the HTML portion of my code and then access it using the JavaScript getAttribute() method.

Accomplishments that I'm proud of

I'm proud of how this project turned out, considering it's my first truly full-stack application. I also really liked how the insights page turned out and think that it was really cool to see the visualization of the data generated by the sentiment analysis through the chart.

What I learned

I learned a lot about user authentication and database design, as well as Natural Language Processing, which was super interesting to read more about! I also got better at working with MongoDB and Express, which are also fairly new to me.

What's next for Journly

In the future, I hope to add post-editing and removal functionality, as well as more data insight features. Some potential features I was interested in exploring but didn't have time to implement include adding location tags to see what places a user's most positive/negative entries come from, filtering by different time frames (ex. looking at data only from the past month, 6 months, year, etc), determining which objects/people/ideas (would involve part-of-speech tagging) are most commonly used in negative vs positive contexts (ex. perhaps "homework" is a subject that's commonly used in a user's negative entries, while "pizza" may be used in positive entries?), and the ability to search for posts and sort them in different ways (chronological, reverse-chronological, most positive to most negative, alphabetical, etc.).

Share this project:

Updates