# TextMemoirs

## nwHacks 2023 Submission by Victor Parangue, Kareem El-Wishahy, Parmvir Shergill, and Daniel Lee

Journalling is a well-established practice that has been shown to have many benefits for mental health and overall well-being. Some of the main benefits of journalling include the ability to reflect on one's thoughts and emotions, reduce stress and anxiety, and document progress and growth. By writing down our experiences and feelings, we are able to process and understand them better, which can lead to greater self-awareness and insight. We can track our personal development, and identify the patterns and triggers that may be contributing to our stress and anxiety. Journalling is a practice that everyone can benefit from.

Text Memoirs is designed to make the benefits of journalling easy and accessible to everyone. By using a mobile text-message based journaling format, users can document their thoughts and feelings in a real-time sequential journal, as they go about their day.

Simply text your assigned number, and your journal text entry gets saved to our database. You're journal text entries are then displayed on our web app GUI. You can view all your text journal entries on any given specific day on the GUI.

You can also text commands to your assigned number using /EDIT and /DELETE to update your text journal entries on the database and the GUI (see the image gallery).

Text Memoirs utilizes Twilio’s API to receive and store user’s text messages in a CockroachDB database. The frontend interface for viewing a user’s daily journals is built using Flutter.

![]()
![]()

# TextMemoirs API

This API allows you to insert users, get all users, add texts, get texts by user and day, delete texts by id, get all texts and edit texts by id.

## Endpoints

### Insert User

Insert a user into the system.

* Method: **POST**
* URL: `/insertUser`
* Body:
`{
"phoneNumber": "+17707626118",
"userName": "Test User",
"password": "Test Password"
}`

### Get Users

Get all users in the system.

* Method: **GET**
* URL: `/getUsers`

### Add Text

Add a text to the system for a specific user.

* Method: **POST**
* URL: `/addText`
* Body:
`{

"phoneNumber": "+17707626118", "textMessage": "Text message #3", "creationDate": "1/21/2023", "creationTime": "2:57:14 PM"

}`

### Get Texts By User And Day

Get all texts for a specific user and day.

* Method: **GET**
* URL: `/getTextsByUserAndDay`
* Parameters:
	+ phoneNumber: The phone number of the user.
	+ creationDate: The date of the texts in the format `MM/DD/YYYY`.

### Delete Texts By ID

Delete a specific text by ID.

* Method: **DELETE**
* URL: `/deleteTextsById`
* Body:
`{
"textId": 3
}`

### Edit Texts By ID

Edit a specific text by ID.

* Method: **PUT**
* URL: `/editTextsById`
* Parameters:
	+ id: The ID of the text to edit.
* Body:
`{
"textId": 2,
"textMessage": "Updated text message"
}`

### Get All Texts

Get all texts in the database.

* Method: **GET**
* URL: `/getAllTexts`
## Inspiration

Considering our team is so diverse (Pakistan, Sweden, Brazil, and Nigeria) it was natural for us to consider worldwide problems when creating our project. This problem especially has such a large societal impact, that we were very motivated to move towards a solution.

## What it does

Our service takes requests from users by SMS, which we then convert to an executable query. When the query result is received we send it back using SMS. Our application makes the process user-friendly and allows for more features when accessing the internet, such as ordering an Uber or ordering food.

## How we built it

The app can convert the user selection into text messages, sending them to our Twilio number.
We used the Twilio API to automatically manage these texts. Using C# and python scripts we convert the text into a google search, sending the result back as a text message.

## Challenges we ran into

The main challenge we faced was making the different protocols interact, it was also challenging to produce and debug everything under the time constraint.

## Accomplishments that we're proud of

We are very proud of our presentation and our creative solution. As well as having such an effective collaboration that enabled us to complete as much as we did.
We are very proud of how we successfully created a novel solution that is simple enough to be applicable on a large scale, having a large impact on the world.

## What we learned

We learned how to automize the management of text messages, and how to make the different protocols communicate correctly

## What's next for Access

What's next for Access is to expand our service, fulfilling the large potential that our solution has. We want to make more parts of the internet accessible through our service, make the process more efficient and most importantly extend our reach to those who need it the most.
## Inspiration

The inspiration behind MoodJournal comes from a desire to reflect on and cherish the good times, especially in an era where digital overload often makes us overlook the beauty of everyday moments. We wanted to create a digital sanctuary where users can not only store their daily and memories but also discover what truly makes them happy. By leveraging cutting-edge technology, we sought to bring a modern twist to the nostalgic act of keeping a diary, transforming it into a dynamic tool for self-reflection and emotional well-being

## What it does

MoodJournal is a digital diary app that allows users to capture their daily life through text entries and photographs. Utilizing semantic analysis and image-to-text conversion technologies, the app evaluates the emotional content of each entry to generate 5 happiness scores in range from Very Happy to Very Sad. This innovative approach enables MoodJournal to identify and highlight the user's happiest moments. At the end of the year, it creates a personalized collage of these joyous times, showcasing a summary of the texts and photos from those special days, serving as a powerful visual reminder of the year's highlights

## How we built it

MoodJournal's development combined React and JavaScript for a dynamic frontend, utilizing open-source libraries for enhanced functionality. The backend was structured around Python and Flask, providing a solid foundation for simple REST APIs. Cohere's semantic classification API was integrated for text analysis, enabling accurate emotion assessment. ChatGPT helped generate training data, ensuring our algorithms could effectively analyze and interpret users' entries.

## Challenges we ran into

The theme of nostalgia itself presented a conceptual challenge, making it difficult initially to settle on a compelling idea. Our limited experience in frontend development and UX/UI design further complicated the project, requiring substantial effort and learning. Thanks to invaluable guidance from mentors like Leon, Shiv, and Arash, we navigated these obstacles. Additionally, while the Cohere API served our text analysis needs well, we recognized the necessity for a larger dataset to enhance accuracy, underscoring the critical role of comprehensive data in achieving precise analytical outcomes.

## Accomplishments that we're proud of

We take great pride in achieving meaningful results from the Cohere API, which enabled us to conduct a thorough analysis of emotions from text entries. A significant breakthrough was our innovative approach to photo emotion analysis; by generating descriptive text from images using ChatGPT and then analyzing these descriptions with Cohere, we established a novel method for capturing emotional insights from visual content. Additionally, completing the core functionalities of MoodJournal to demonstrate an end-to-end flow of our primary objective was a milestone accomplishment. This project marked our first foray into utilizing a range of technologies, including React, Firebase, the Cohere API, and Flask. Successfully integrating these tools and delivering a functioning app, despite being new to them, is something we are especially proud of.

## What we learned

This hackathon was a tremendous learning opportunity. We dove into tools and technologies new to us, such as React, where we explored new libraries and features like useEffect, and Firebase, achieving data storage and retrieval. Our first-hand experience with Cohere's APIs, facilitated by direct engagement with their team, was invaluable, enhancing our app's text and photo analysis capabilities. Additionally, attending workshops, particularly on Cohere technologies like RAG, broadened our understanding of AI's possibilities. This event not only expanded our technical skills but also opened new horizons for future projects.

## What's next for MoodJournal

We're planning exciting updates to make diary-keeping easier and more engaging:

* AI-Generated Entries: Users can have diary entries created by AI, simplifying daily reflections.
* Photo Analysis for Entry Generation: Transform photos into diary texts with AI, offering an effortless way to document days.
* Integration with Snapchat Memories: This feature will allow users to turn snaps into diary entries, merging social moments with personal reflections.
* Monthly Collages and Emotional Insights: We'll introduce monthly summaries and visual insights into past emotions, alongside our yearly wrap-ups.
* User Accounts: Implementing login/signup functionality for a personalized and secure experience.

These enhancements aim to streamline the journaling process and deepen user engagement with MoodJournal.