Spaces:
Sleeping
SMS Automation Summary for AIMHSA
β SMS is Sent Automatically to Both User and Professional
Your AIMHSA system now automatically sends SMS notifications to both the user and professional whenever a high-risk mental health case is detected and a booking is created.
π How It Works (Fully Automated)
1. User Sends High-Risk Message
User: "I want to kill myself and end this pain forever"
2. System Automatically:
- β Detects high-risk indicators
- β Matches with appropriate professional
- β Creates automated booking
- β Sends SMS to USER π±
- β Sends SMS to PROFESSIONAL π±
3. No Manual Intervention Required
The entire process happens automatically - no human intervention needed!
π± SMS Messages Sent Automatically
To User:
AIMHSA Mental Health Support
URGENT: Professional mental health support has been scheduled
Professional: Dr. Marie Mukamana
Specialization: Psychiatrist
Scheduled: 2024-01-15 14:30
Session Type: Emergency
You will be contacted shortly. If this is an emergency, call 112 or the Mental Health Hotline at 105.
Stay safe and take care.
AIMHSA Team
To Professional:
AIMHSA Professional Alert
New HIGH risk booking assigned to you.
Booking ID: 12345-abcde-67890
User: Demo User
Risk Level: HIGH
Scheduled: 2024-01-15 14:30
Please check your professional dashboard for details and accept/decline the booking.
AIMHSA System
π Files Created/Modified
New Files:
sms_service.py- SMS service with HDEV API integrationtest_sms_integration.py- Comprehensive testingverify_sms_automation.py- Verification scriptdemo_sms_automation.py- Live demonstrationcreate_sample_data_with_sms.py- Sample data with phone numbersSMS_INTEGRATION_README.md- Complete documentation
Modified Files:
app.py- Enhanced with automatic SMS notifications- Added SMS service initialization
- Enhanced
create_automated_booking()function - Added SMS testing endpoints
π§ͺ Testing the SMS Automation
Quick Test:
python verify_sms_automation.py
Live Demo:
python demo_sms_automation.py
Create Sample Data:
python create_sample_data_with_sms.py
π SMS Automation Flow
User Message β Risk Assessment β Professional Matching β Booking Creation
β
π± SMS to User
β
π± SMS to Professional
β
Both Notified Automatically
π§ Configuration
Your SMS credentials are already configured:
- API ID:
HDEV-23fb1b59-aec0-4aef-a351-bfc1c3aa3c52-ID - API Key:
HDEV-6e36c286-19bb-4b45-838e-8b5cd0240857-KEY
β What Happens Automatically
- User sends high-risk message β System detects risk
- Risk assessment triggered β AI analyzes message content
- High/Critical risk detected β System escalates case
- Professional matching β AI finds best available professional
- Booking created β System creates emergency booking
- SMS sent to user β User gets confirmation with professional details
- SMS sent to professional β Professional gets alert to check dashboard
- Both parties notified β No manual intervention needed
π― Key Features
β
Fully Automated - No manual intervention required
β
Dual Notifications - Both user and professional get SMS
β
Real-time Alerts - Immediate notifications for high-risk cases
β
Professional Details - User knows who will help them
β
Emergency Response - Critical cases get immediate attention
β
Rwanda Phone Format - Automatic phone number formatting
β
Error Handling - Robust error handling and logging
β
Testing Tools - Comprehensive testing and verification
π¨ Emergency Response
When a user sends a high-risk message like:
- "I want to kill myself"
- "I'm going to overdose"
- "I want to end it all"
- "I can't take this pain anymore"
The system automatically:
- Creates an emergency booking
- Sends SMS to the user with professional details
- Sends SMS to the professional with case details
- Both parties are immediately notified
π± Phone Number Requirements
For Users:
- Must register with phone number during signup
- Format:
+250XXXXXXXXX(Rwanda format) - Stored in
users.telephonefield
For Professionals:
- Must have phone number in profile
- Format:
+250XXXXXXXXX(Rwanda format) - Stored in
professionals.phonefield
π Ready to Use!
Your AIMHSA system now automatically sends SMS notifications to both users and professionals whenever high-risk mental health cases are detected. The integration is production-ready and will help ensure immediate response to mental health crises! π
Note: This automation ensures that no high-risk case goes unnoticed and both the person in crisis and the mental health professional are immediately notified via SMS.