Click on the GIF to view our full presentation PDF
The CC Diary backend provides the essential APIs to support the functionalities of the CC Diary app. It enables diary management, sentiment analysis, and chatbot responses, facilitating a seamless user experience focused on mental health and emotional well-being.
Ensure that the following tools are installed before running the backend:
- Python 3.12
- Flask
- Other required Python libraries (as listed in
requirements.txt
)
-
Clone the repository:
git clone https://github.com/Andrewtangtang/CCdiary-backend cd CCdiary-backend
-
Install the required Python packages:
pip install -r requirements.txt
-
Set the environment variable to avoid library conflicts:
export KMP_DUPLICATE_LIB_OK=True
Start the Flask server by running:
python app.py
The server will be accessible at http://0.0.0.0:5000/.
Description: Processes a diary entry and provides mental health feedback.
Request:
- JSON object with the following fields:
diary_description
: The text content of the diary entry.language
: The language of the entry (e.g.,zh_Hant_TW
for Traditional Chinese).
Response:
- JSON object containing:
feedback
: AI-generated feedback based on the diary entry.
Example Request:
{
"diary_description": "Today I felt very stressed.",
"language": "English"
}
Example Response:
{
"feedback": "It's important to acknowledge your stress. Consider practicing relaxation techniques such as deep breathing or mindfulness. If the stress persists, seeking support from a mental health professional might be beneficial."
}
Description: Handles health-related questions and provides responses through the chatbot.
Request:
- JSON object with the following fields:
question
: The user's health-related query.language
: The language of the query (e.g.,zh_Hant_TW
for Traditional Chinese).
Response:
- JSON object containing:
answer
: AI-generated answer to the question.
Example Request:
{
"question": "What are the symptoms of depression?",
"language": "English"
}
Example Response:
{
"answer": "Common symptoms of depression include persistent sadness, loss of interest in activities, changes in appetite or sleep patterns, and feelings of worthlessness or guilt."
}
Description: Retrieves all diary records in JSON format.
Response:
- JSON array containing all diary records.
Example Response:
[
{
"id": 1,
"diary_description": "Today I felt very stressed.",
"language": "English",
"timestamp": "2024-08-27T10:00:00Z"
},
{
"id": 2,
"diary_description": "Had a great day at work.",
"language": "English",
"timestamp": "2024-08-26T15:30:00Z"
}
]
- OpenAI: Powers the AI-based mental health feedback.
- LangChain: Facilitates customization of language model pipelines.
- Hugging Face: Provides models for sentiment analysis.
- Pytorch: Used for analyzing and generating feedback based on user diary entries.
- Flutter: Utilized for building the frontend of the app.frontend
Copyright (c) 2024 vaclis. All rights reserved.
This software and associated documentation files (the "Software") are the exclusive property of vaclis. The Software is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties.
Unauthorized copying, modification, distribution, or use of this Software, via any medium, is strictly prohibited without the express written permission of vaclis.
For licensing inquiries, please contact: [email protected]
Feel free to mail to us by [email protected] for collaboration or bugs report!
Developed with ❤️ by 游松澤 (Yu Song-Ze), 張羿軒 (Zhang Yi-Xuan), 劉力瑋 (Liu Li-Wei), 張昀棠 (Zhang Yun-Tang)
Project Team: 不嘻嘻的時候,黑客松松澤