A Flask-based web application for mental health professionals to manage patient data, process therapy sessions, and analyze mental health indicators. This platform combines audio processing, natural language processing, and mental health analysis tools.
- Flask-based web interface for patient data management
- Features:
- Landing page and dashboard
- File upload system for therapist notes and audio files
- Patient-specific data organization
- Automatic processing of uploaded files
This module analyzes temporal patterns in emotional expressions using zero-shot classification. Features include:
- Zero-shot classification using Facebook's BART model
- Analysis of emotional patterns across different time scales:
- Daily analysis
- Weekly trends
- Monthly patterns
- Categorization into 8 emotional states:
- Insomnia
- Anxiety
- Depression
- Career Confusion
- Positive Outlook
- Stress
- Health Anxiety
- Eating Disorder
Outputs:
- Generates visualization plots saved as PNG files:
daily_emotional_score_first_week.png
weekly_emotional_score.png
monthly_emotional_score.png
- Detailed analysis report in
output_analysis.txt
- Zero-shot classification for mental health concerns
- Categories include:
- Insomnia
- Anxiety
- Depression
- Career Confusion
- Positive Outlook
- Stress
- Health Anxiety
- Eating Disorder
- Advanced text analysis for mental health indicators
- Features:
- Emotion and state detection
- Context analysis
- Pattern recognition
- Synonym expansion using WordNet
- Behavioral pattern analysis
- Measures the intensity of expressed mental health concerns
- Features:
- Quantifier-based scoring system
- Base intensity calculation
- Contextual intensity adjustment
This module implements sentiment analysis using the Hugging Face transformers library with the CardiffNLP Twitter RoBERTa model. Features include:
- Sentiment classification into three categories: Negative, Neutral, and Positive
- Pre-configured pipeline using the
cardiffnlp/twitter-roberta-base-sentiment
model - Simple interface through the
get_sentiment_label()
function - Example usage demonstration included in the script
flask
librosa
transformers
pydub
nltk
pandas
- Install required packages:
pip install -r requirements.txt
- Download NLTK data:
import nltk
nltk.download('stopwords')
nltk.download('punkt')
nltk.download('averaged_perceptron_tagger')
nltk.download('wordnet')
nltk.download('omw-1.4')
- Create necessary directories:
mkdir Data
[Note: Additional components and setup instructions will be added in Part 2]
- Start the Flask application:
python app.py
-
Access the web interface at
http://localhost:5000
-
Upload patient data:
- Navigate to the dashboard
- Upload audio files and therapist notes
- System will automatically process and analyze the data
# Example usage
from audio_text import transcribe_audio_file
transcribe_audio_file("patient_recording.mp3", "transcription.txt")
# Example usage
from concern_classifier import classify_concern
category, score = classify_concern("I'm feeling extremely anxious about my job security")
# Example usage
from extract import MentalHealthExtractor
extractor = MentalHealthExtractor()
concern = extractor.extract_concern("I've been feeling very depressed lately")
# Example usage
from intensity import get_intensity
intensity_score = get_intensity("I'm feeling very anxious about my health")
This is Part 1 of the documentation. Additional components and their documentation will be added in Part 2.
- Ensure proper access controls are implemented
- Keep patient data confidential and encrypted
- Regular backups of the Data directory
- Monitor system access logs
This script processes Spotify listening history data and analyzes user listening patterns. Key functionalities include:
- Data extraction from Spotify data export ZIP files
- Streaming history processing and filtering
- Audio feature retrieval using the Spotify API
- Temporal pattern analysis for various music features
- Generation of diurnal, daily, and monthly listening patterns
Key features:
- Handles invalid timestamp correction
- Filters out short songs (< 30 seconds)
- Retrieves detailed audio features for each track
- Creates visualizations for listening patterns
- Saves processed data in CSV format
Required environment variables:
SPOTIFY_CLIENT_ID
SPOTIFY_CLIENT_SECRET
- Transcribes therapy session recordings
- Features:
- MP3 to WAV conversion using
pydub
- Speech recognition using OpenAI's Whisper model
- Automatic transcription saving
- MP3 to WAV conversion using
Additional dependencies required for these components:
transformers
spotipy
pandas
matplotlib
tqdm
zipfile
ast
logging
filecmp
from polarity import get_sentiment_label
text = "I am feeling great today!"
sentiment = get_sentiment_label(text)
print(f"Sentiment: {sentiment}")
python script.py <username>
Replace <username>
with the target user's identifier. Ensure the Spotify data export is placed in Data/<username>/my_spotify_data.zip
.
- Prepare your input data in a CSV file named
input_sentences.csv
with a column named "Sentence" - Run the analysis:
python temporal_shifts.py
The scripts generate several output files:
filtered_streaming_history.csv
: Processed Spotify listening historydiurnal_patterns.csv
: Hour-by-hour listening patternsdaywise_week_patterns.csv
: Day-of-week patternsdaywise_month_patterns.csv
: Day-of-month patternsoutput_analysis.txt
: Detailed emotional pattern analysis- Various PNG files containing visualizations
- Ensure all required API credentials are properly configured
- The Spotify script requires a valid Spotify data export in ZIP format
- Large datasets may require significant processing time
- Consider memory requirements when processing large music libraries