SafeSpace / recommendations.py
AliSakr9997's picture
Upload folder using huggingface_hub
d47c7f6 verified
"""
recommendations.py
==================
Bilingual (EN + AR) recommendation system.
Uses:
- primary disease (anxiety / depression / stress)
- severity (mild / moderate / severe) from DASS-42 scores
- cause (extracted from user text)
- suicidal flag (extracted from user text)
"""
import re
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
# 1. SEVERITY FROM DASS-42 SCORES
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
# DASS-42 official cutoffs (raw sum, not percentage)
DASS_CUTOFFS = {
"depression": [(0, 9, "normal"), (10, 13, "mild"), (14, 20, "moderate"),
(21, 27, "severe"), (28, 999, "extremely_severe")],
"anxiety": [(0, 7, "normal"), (8, 9, "mild"), (10, 14, "moderate"),
(15, 19, "severe"), (20, 999, "extremely_severe")],
"stress": [(0, 14, "normal"),(15, 18, "mild"),(19, 25, "moderate"),
(26, 33, "severe"), (34, 999, "extremely_severe")],
}
def get_severity(disease: str, raw_score: float, max_score: float = 1.0) -> str:
"""
raw_score: ุฅู…ุง ู†ุณุจุฉ (0-1) ู…ู† ุงู„ู…ูˆุฏูŠู„ุŒ ูˆุฅู…ุง raw DASS score
ุจู†ุญูˆู‘ู„ ุงู„ู†ุณุจุฉ ู„ู€ raw score ุชู‚ุฑูŠุจูŠ ุนุดุงู† ู†ู‚ุฏุฑ ู†ุณุชุฎุฏู… ุงู„ู€ cutoffs
"""
# ู„ูˆ ุฌุงูŠ ู…ู† ุงู„ู…ูˆุฏูŠู„ ูƒู†ุณุจุฉ (0-1)ุŒ ู†ุญูˆู‘ู„ู‡ ู„ู€ raw score ุชู‚ุฑูŠุจูŠ
if max_score == 1.0:
# DASS-42 depression max=84, anxiety max=72, stress max=84
max_raw = {"depression": 84, "anxiety": 72, "stress": 84}
score = int(raw_score * max_raw.get(disease, 84))
else:
score = int(raw_score)
for low, high, label in DASS_CUTOFFS.get(disease, []):
if low <= score <= high:
return label
return "severe"
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
# 2. CAUSE EXTRACTION FROM TEXT
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
CAUSE_KEYWORDS = {
"work": [
"ุดุบู„", "ุนู…ู„", "ูˆุธูŠูุฉ", "ู…ุฏูŠุฑ", "boss", "deadline", "ู…ุดุฑูˆุน", "project",
"office", "ู…ูƒุชุจ", "ุฑุงุชุจ", "salary", "overtime", "job", "work", "career",
"ูƒุซูŠุฑ ุดุบู„", "ุถุบุท ุดุบู„", "ู…ุด ู‚ุงุฏุฑ ุฃูƒู…ู„ ุดุบู„", "tired from work",
],
"relationships": [
"ุญุจูŠุจ", "ุญุจูŠุจุฉ", "ุฒูˆุฌ", "ุฒูˆุฌุฉ", "ุฌูˆุฒ", "ู…ุฑุงุชูŠ", "ุนู„ุงู‚ุฉ", "relationship",
"ุฃู‡ู„", "ุนูŠู„ุฉ", "family", "ุตุงุญุจ", "ุตุญุงุจ", "friend", "ุฎูŠุงู†ุฉ", "betrayal",
"ูุฑุงู‚", "breakup", "ุทู„ุงู‚", "divorce", "ูˆุญูŠุฏ", "lonely", "ุฎู„ุงู", "conflict",
],
"financial": [
"ูู„ูˆุณ", "ู…ุงู„", "money", "ุฏูŠู†", "debt", "ูู‚ุฑ", "ู…ุตุงุฑูŠู", "broke",
"ุฅูŠุฌุงุฑ", "rent", "ู…ุฏูŠูˆู†", "financial", "ุจุทุงู„ุฉ", "unemployment",
],
"academic": [
"ุฏุฑุงุณุฉ", "ุงู…ุชุญุงู†", "exam", "ุฌุงู…ุนุฉ", "university", "ู…ุฏุฑุณุฉ", "school",
"ุฏุฑุฌุงุช", "grades", "ุฑุณูˆุจ", "fail", "ู…ุฐุงูƒุฑุฉ", "study", "ุชุฎุฑุฌ",
],
"health": [
"ู…ุฑุถ", "ูˆุฌุน", "pain", "ุตุญุฉ", "health", "doctor", "ุฏูƒุชูˆุฑ", "ู…ุณุชุดูู‰",
"hospital", "ุนู„ุงุฌ", "treatment", "ุฏูˆุงุก", "medication", "ู†ูˆู…", "sleep",
],
"social": [
"ู†ุงุณ", "people", "ู…ุฌุชู…ุน", "ุญูƒู…", "judgment", "ุฎุฌู„", "shy", "ู…ู†ุนุฒู„",
"isolated", "ุฎุงูŠู", "scared", "ู…ุด ู‚ุงุฏุฑ ุฃุชูƒู„ู…", "can't talk",
],
"self_worth": [
"ูุงุดู„", "failure", "ู…ุด ูƒุงููŠ", "not enough", "ุถุนูŠู", "weak", "worthless",
"ู„ุง ู‚ูŠู…ุฉ", "ู…ุง ูŠู†ูุนุด", "ู…ุด ุนุงุฑู ุฃู†ุฌุญ", "can't succeed", "loser",
],
"trauma": [
"ุตุฏู…ุฉ", "trauma", "ุญุงุฏุซุฉ", "accident", "ุฎุณุงุฑุฉ", "loss", "ูˆูุงุฉ", "death",
"ู…ุงุช", "died", "ุฅุณุงุกุฉ", "abuse", "ูƒูˆุงุจูŠุณ", "nightmares", "ุฐูƒุฑูŠุงุช",
],
}
def extract_cause(text: str) -> str:
text_lower = text.lower()
text_lower = re.sub(r'[^\w\s\u0600-\u06FF]', ' ', text_lower)
scores = {}
for cause, keywords in CAUSE_KEYWORDS.items():
count = sum(1 for kw in keywords if kw.lower() in text_lower)
if count > 0:
scores[cause] = count
if not scores:
return "general"
return max(scores, key=scores.get)
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
# 3. SUICIDAL IDEATION DETECTION
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
SUICIDAL_KEYWORDS = [
"ุงู†ุชุญุงุฑ", "suicide", "ุฃู‚ุชู„ ู†ูุณูŠ", "kill myself", "ุฃู…ูˆุช", "want to die",
"ุนุงูŠุฒ ุฃู…ูˆุช", "ู…ุด ุนุงูŠุฒ ุฃุนูŠุด", "don't want to live", "ู†ู‡ุงูŠุฉ ุญูŠุงุชูŠ",
"end my life", "ุฃุฑูŠุญ ู†ูุณูŠ", "rest forever", "ู…ููŠุด ูุงูŠุฏุฉ ู…ู† ุงู„ุญูŠุงุฉ",
"life is not worth", "ุฃุฐูŠ ู†ูุณูŠ", "hurt myself", "ุฅูŠุฐุงุก ุงู„ู†ูุณ",
"self harm", "ู…ุด ู‚ุงุฏุฑ ุฃูƒู…ู„", "can't go on", "ุนุงูŠุฒ ุฃุฎุชููŠ",
"want to disappear", "ู„ูˆ ู…ุช", "if i die", "ู„ูˆ ุงุฎุชููŠุช",
]
def detect_suicidal(text: str) -> bool:
text_lower = text.lower()
return any(kw.lower() in text_lower for kw in SUICIDAL_KEYWORDS)
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
# 4. RECOMMENDATIONS DATABASE (Bilingual)
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
# Structure: disease โ†’ cause โ†’ severity_group โ†’ {tips, resources, referral}
# severity_group: "mild_moderate" | "severe"
REC_DB = {
# โ”€โ”€ ANXIETY โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
"anxiety": {
"work": {
"mild_moderate": {
"tips_en": [
"Break your tasks into small steps and focus on one at a time",
"Take a 5-minute breathing break every hour",
"Communicate your workload clearly with your manager",
"Set clear boundaries between work time and rest time",
],
"tips_ar": [
"ู‚ุณู‘ู… ู…ู‡ุงู…ูƒ ู„ุฎุทูˆุงุช ุตุบูŠุฑุฉ ูˆุฑูƒุฒ ุนู„ู‰ ุฎุทูˆุฉ ูˆุงุญุฏุฉ ููŠ ูƒู„ ู…ุฑุฉ",
"ุฎุฐ ุงุณุชุฑุงุญุฉ ุชู†ูุณ 5 ุฏู‚ุงุฆู‚ ูƒู„ ุณุงุนุฉ",
"ุชุญุฏุซ ุจูˆุถูˆุญ ู…ุน ู…ุฏูŠุฑูƒ ุนู† ุญุฌู… ุนู…ู„ูƒ",
"ุญุฏุฏ ุญุฏูˆุฏุงู‹ ูˆุงุถุญุฉ ุจูŠู† ูˆู‚ุช ุงู„ุนู…ู„ ูˆุงู„ุฑุงุญุฉ",
],
"resources_en": ["App: Calm or Headspace for quick work breaks",
"Technique: 4-7-8 breathing (inhale 4s, hold 7s, exhale 8s)"],
"resources_ar": ["ุชุทุจูŠู‚: Calm ุฃูˆ Headspace ู„ูุชุฑุงุช ุงู„ุฑุงุญุฉ ุงู„ุณุฑูŠุนุฉ",
"ุชู‚ู†ูŠุฉ: ุงู„ุชู†ูุณ 4-7-8 (ุงุณุชู†ุดู‚ 4 ุซูˆุงู†ูŠุŒ ุงุญุจุณ 7ุŒ ุงุทุฑุฏ 8)"],
"referral_en": "If work anxiety persists for more than 2 weeks, consider speaking with a mental health professional.",
"referral_ar": "ู„ูˆ ู‚ู„ู‚ ุงู„ุนู…ู„ ู…ุณุชู…ุฑ ุฃูƒุซุฑ ู…ู† ุฃุณุจูˆุนูŠู†ุŒ ููƒู‘ุฑ ููŠ ุงู„ุชุญุฏุซ ู…ุน ู…ุชุฎุตุต ู†ูุณูŠ.",
},
"severe": {
"tips_en": [
"Consider taking a short leave if possible โ€” your mental health comes first",
"Talk to HR or a trusted colleague about your situation",
"Avoid making major work decisions when anxiety is high",
],
"tips_ar": [
"ููƒู‘ุฑ ููŠ ุฃุฎุฐ ุฅุฌุงุฒุฉ ู‚ุตูŠุฑุฉ ู„ูˆ ู…ู…ูƒู† โ€” ุตุญุชูƒ ุงู„ู†ูุณูŠุฉ ุฃูˆู„ุงู‹",
"ุชุญุฏุซ ู…ุน ู‚ุณู… ุงู„ู…ูˆุงุฑุฏ ุงู„ุจุดุฑูŠุฉ ุฃูˆ ุฒู…ูŠู„ ู…ูˆุซูˆู‚ ุนู† ูˆุถุนูƒ",
"ุชุฌู†ุจ ุงุชุฎุงุฐ ู‚ุฑุงุฑุงุช ุนู…ู„ ูƒุจูŠุฑุฉ ููŠ ูˆู‚ุช ุงู„ู‚ู„ู‚ ุงู„ุดุฏูŠุฏ",
],
"resources_en": ["Cognitive Behavioral Therapy (CBT) is highly effective for work anxiety",
"Book: 'Anxiety at Work' by Adrian Gostick"],
"resources_ar": ["ุงู„ุนู„ุงุฌ ุงู„ู…ุนุฑููŠ ุงู„ุณู„ูˆูƒูŠ (CBT) ูุนู‘ุงู„ ุฌุฏุงู‹ ู„ู‚ู„ู‚ ุงู„ุนู…ู„",
"ูƒุชุงุจ: 'Anxiety at Work' ู„ู€ Adrian Gostick"],
"referral_en": "Severe work-related anxiety requires professional support. Please consult a therapist or psychiatrist.",
"referral_ar": "ู‚ู„ู‚ ุงู„ุนู…ู„ ุงู„ุดุฏูŠุฏ ูŠุญุชุงุฌ ุฏุนู…ุงู‹ ู…ุชุฎุตุตุงู‹. ู…ู† ูุถู„ูƒ ุงุณุชุดุฑ ู…ุนุงู„ุฌุงู‹ ู†ูุณูŠุงู‹ ุฃูˆ ุทุจูŠุจุงู‹ ู†ูุณูŠุงู‹.",
},
},
"relationships": {
"mild_moderate": {
"tips_en": [
"Express your feelings calmly using 'I feel...' statements",
"Set healthy boundaries in your relationships",
"Don't try to solve everything at once",
],
"tips_ar": [
"ุนุจู‘ุฑ ุนู† ู…ุดุงุนุฑูƒ ุจู‡ุฏูˆุก ุจุงุณุชุฎุฏุงู… ุนุจุงุฑุงุช 'ุฃู†ุง ุฃุดุนุฑ...'",
"ุญุฏุฏ ุญุฏูˆุฏุงู‹ ุตุญูŠุฉ ููŠ ุนู„ุงู‚ุงุชูƒ",
"ู„ุง ุชุญุงูˆู„ ุญู„ ูƒู„ ุดูŠุก ุฏูุนุฉ ูˆุงุญุฏุฉ",
],
"resources_en": ["Book: 'Attached' by Amir Levine โ€” understanding relationship patterns",
"Couples or individual counseling can help significantly"],
"resources_ar": ["ูƒุชุงุจ: 'Attached' ู„ู€ Amir Levine โ€” ู„ูู‡ู… ุฃู†ู…ุงุท ุงู„ุนู„ุงู‚ุงุช",
"ุงู„ุฅุฑุดุงุฏ ุงู„ูุฑุฏูŠ ุฃูˆ ู„ู„ุฃุฒูˆุงุฌ ุจูŠุณุงุนุฏ ูƒุชูŠุฑ"],
"referral_en": "If relationship anxiety is affecting your sleep or daily function, a therapist can help.",
"referral_ar": "ู„ูˆ ู‚ู„ู‚ ุงู„ุนู„ุงู‚ุงุช ุจูŠุฃุซุฑ ุนู„ู‰ ู†ูˆู…ูƒ ุฃูˆ ุญูŠุงุชูƒ ุงู„ูŠูˆู…ูŠุฉุŒ ู…ุนุงู„ุฌ ู†ูุณูŠ ูŠู‚ุฏุฑ ูŠุณุงุนุฏ.",
},
"severe": {
"tips_en": [
"Create some distance if the relationship is causing constant distress",
"Reach out to a trusted family member or friend for support",
"Journaling your feelings daily can help process the anxiety",
],
"tips_ar": [
"ุฎู„ู‚ ู…ุณุงูุฉ ู…ุคู‚ุชุฉ ู„ูˆ ุงู„ุนู„ุงู‚ุฉ ุจุชุณุจุจ ุถูŠู‚ุงู‹ ู…ุณุชู…ุฑุงู‹",
"ุชูˆุงุตู„ ู…ุน ูุฑุฏ ู…ู† ุงู„ุนุงุฆู„ุฉ ุฃูˆ ุตุฏูŠู‚ ู…ูˆุซูˆู‚ ู„ู„ุฏุนู…",
"ูƒุชุงุจุฉ ู…ุดุงุนุฑูƒ ูŠูˆู…ูŠุงู‹ ููŠ ุฏูุชุฑ ุจูŠุณุงุนุฏ ุนู„ู‰ ู…ุนุงู„ุฌุฉ ุงู„ู‚ู„ู‚",
],
"resources_en": ["CBT or DBT therapy is recommended for severe relationship anxiety"],
"resources_ar": ["ุงู„ุนู„ุงุฌ ุงู„ู…ุนุฑููŠ ุงู„ุณู„ูˆูƒูŠ ุฃูˆ DBT ู…ูˆุตู‰ ุจู‡ ู„ู‚ู„ู‚ ุงู„ุนู„ุงู‚ุงุช ุงู„ุดุฏูŠุฏ"],
"referral_en": "Please consult a mental health professional. Severe relationship anxiety is treatable.",
"referral_ar": "ู…ู† ูุถู„ูƒ ุงุณุชุดุฑ ู…ุชุฎุตุตุงู‹ ู†ูุณูŠุงู‹. ู‚ู„ู‚ ุงู„ุนู„ุงู‚ุงุช ุงู„ุดุฏูŠุฏ ู‚ุงุจู„ ู„ู„ุนู„ุงุฌ.",
},
},
"general": {
"mild_moderate": {
"tips_en": [
"Practice 4-7-8 breathing daily",
"Reduce caffeine intake โ€” it worsens anxiety",
"Exercise for at least 20 minutes a day",
"Limit news and social media consumption",
],
"tips_ar": [
"ู…ุงุฑุณ ุชู†ูุณ 4-7-8 ูŠูˆู…ูŠุงู‹",
"ู‚ู„ู„ ุงู„ูƒุงููŠูŠู† โ€” ุจูŠุฒูŠุฏ ุงู„ู‚ู„ู‚",
"ู…ุงุฑุณ ุงู„ุฑูŠุงุถุฉ 20 ุฏู‚ูŠู‚ุฉ ุนู„ู‰ ุงู„ุฃู‚ู„ ูŠูˆู…ูŠุงู‹",
"ู‚ู„ู„ ุงุณุชู‡ู„ุงูƒ ุงู„ุฃุฎุจุงุฑ ูˆูˆุณุงุฆู„ ุงู„ุชูˆุงุตู„ ุงู„ุงุฌุชู…ุงุนูŠ",
],
"resources_en": ["App: Calm or Insight Timer",
"Book: 'Dare' by Barry McDonagh",
"YouTube: Progressive Muscle Relaxation guided sessions"],
"resources_ar": ["ุชุทุจูŠู‚: Calm ุฃูˆ Insight Timer",
"ูƒุชุงุจ: 'Dare' ู„ู€ Barry McDonagh",
"YouTube: ุฌู„ุณุงุช Progressive Muscle Relaxation ู…ูˆุฌู‘ู‡ุฉ"],
"referral_en": "If anxiety persists for more than 2 weeks, consider speaking with a professional.",
"referral_ar": "ู„ูˆ ุงู„ู‚ู„ู‚ ู…ุณุชู…ุฑ ุฃูƒุซุฑ ู…ู† ุฃุณุจูˆุนูŠู†ุŒ ููƒู‘ุฑ ููŠ ุงู„ุชุญุฏุซ ู…ุน ู…ุชุฎุตุต.",
},
"severe": {
"tips_en": [
"Do not isolate yourself โ€” stay connected with safe people",
"Try grounding: name 5 things you see, 4 you hear, 3 you touch",
"Avoid making big decisions when anxiety peaks",
],
"tips_ar": [
"ู„ุง ุชุนุฒู„ ู†ูุณูƒ โ€” ุงุจู‚ูŽ ุนู„ู‰ ุชูˆุงุตู„ ู…ุน ุงู„ู†ุงุณ ุงู„ุขู…ู†ูŠู†",
"ุฌุฑุจ ุชู‚ู†ูŠุฉ ุงู„ุชุฃุฑูŠุถ: ุงุฐูƒุฑ 5 ุฃุดูŠุงุก ุชุฑุงู‡ุงุŒ 4 ุชุณู…ุนู‡ุงุŒ 3 ุชู„ู…ุณู‡ุง",
"ุชุฌู†ุจ ุงุชุฎุงุฐ ู‚ุฑุงุฑุงุช ูƒุจูŠุฑุฉ ููŠ ูˆู‚ุช ุฐุฑูˆุฉ ุงู„ู‚ู„ู‚",
],
"resources_en": ["CBT is the gold standard for severe anxiety",
"Medication may help โ€” consult a psychiatrist"],
"resources_ar": ["CBT ู‡ูˆ ุงู„ู…ุนูŠุงุฑ ุงู„ุฐู‡ุจูŠ ู„ุนู„ุงุฌ ุงู„ู‚ู„ู‚ ุงู„ุดุฏูŠุฏ",
"ุงู„ุฏูˆุงุก ู‚ุฏ ูŠุณุงุนุฏ โ€” ุงุณุชุดุฑ ุทุจูŠุจุงู‹ ู†ูุณูŠุงู‹"],
"referral_en": "Severe anxiety requires professional treatment. Please reach out to a therapist or psychiatrist soon.",
"referral_ar": "ุงู„ู‚ู„ู‚ ุงู„ุดุฏูŠุฏ ูŠุญุชุงุฌ ุนู„ุงุฌุงู‹ ู…ุชุฎุตุตุงู‹. ู…ู† ูุถู„ูƒ ุชูˆุงุตู„ ู…ุน ู…ุนุงู„ุฌ ู†ูุณูŠ ุฃูˆ ุทุจูŠุจ ู†ูุณูŠ ููŠ ุฃู‚ุฑุจ ูˆู‚ุช.",
},
},
},
# โ”€โ”€ DEPRESSION โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
"depression": {
"work": {
"mild_moderate": {
"tips_en": [
"Try to find one small meaningful task at work each day",
"Take short walks outside during your lunch break",
"Talk to a trusted colleague โ€” connection helps",
],
"tips_ar": [
"ุญุงูˆู„ ุชู„ุงู‚ูŠ ู…ู‡ู…ุฉ ุตุบูŠุฑุฉ ุฐุงุช ู…ุนู†ู‰ ููŠ ุงู„ุนู…ู„ ูƒู„ ูŠูˆู…",
"ุงุฎุฑุฌ ููŠ ู†ุฒู‡ุฉ ู‚ุตูŠุฑุฉ ุฃุซู†ุงุก ุงุณุชุฑุงุญุฉ ุงู„ุบุฏุงุก",
"ุชุญุฏุซ ู…ุน ุฒู…ูŠู„ ู…ูˆุซูˆู‚ โ€” ุงู„ุชูˆุงุตู„ ุจูŠุณุงุนุฏ",
],
"resources_en": ["Book: 'Lost Connections' by Johann Hari",
"Technique: Behavioral Activation โ€” schedule small enjoyable activities"],
"resources_ar": ["ูƒุชุงุจ: 'Lost Connections' ู„ู€ Johann Hari",
"ุชู‚ู†ูŠุฉ: ุงู„ุชู†ุดูŠุท ุงู„ุณู„ูˆูƒูŠ โ€” ุฌุฏูˆู‘ู„ ุฃู†ุดุทุฉ ุตุบูŠุฑุฉ ู…ู…ุชุนุฉ"],
"referral_en": "Work-related depression responds well to therapy. Consider reaching out to a professional.",
"referral_ar": "ุงู„ุงูƒุชุฆุงุจ ุงู„ู…ุฑุชุจุท ุจุงู„ุนู…ู„ ูŠุณุชุฌูŠุจ ุฌูŠุฏุงู‹ ู„ู„ุนู„ุงุฌ. ููƒู‘ุฑ ููŠ ุงู„ุชูˆุงุตู„ ู…ุน ู…ุชุฎุตุต.",
},
"severe": {
"tips_en": [
"Take medical leave if possible โ€” you need recovery time",
"Maintain a basic daily routine even if it feels hard",
"Tell one trusted person how you truly feel",
],
"tips_ar": [
"ุฎุฐ ุฅุฌุงุฒุฉ ุทุจูŠุฉ ู„ูˆ ู…ู…ูƒู† โ€” ุชุญุชุงุฌ ูˆู‚ุชุงู‹ ู„ู„ุชุนุงููŠ",
"ุญุงูุธ ุนู„ู‰ ุฑูˆุชูŠู† ูŠูˆู…ูŠ ุฃุณุงุณูŠ ุญุชู‰ ู„ูˆ ุตุนุจ",
"ุฃุฎุจุฑ ุดุฎุตุงู‹ ู…ูˆุซูˆู‚ุงู‹ ูˆุงุญุฏุงู‹ ุจู…ุดุงุนุฑูƒ ุงู„ุญู‚ูŠู‚ูŠุฉ",
],
"resources_en": ["Antidepressants combined with therapy show strong results",
"Contact a psychiatrist as soon as possible"],
"resources_ar": ["ู…ุถุงุฏุงุช ุงู„ุงูƒุชุฆุงุจ ู…ุน ุงู„ุนู„ุงุฌ ุงู„ู†ูุณูŠ ุจุชุนุทูŠ ู†ุชุงุฆุฌ ู‚ูˆูŠุฉ",
"ุชูˆุงุตู„ ู…ุน ุทุจูŠุจ ู†ูุณูŠ ููŠ ุฃู‚ุฑุจ ูˆู‚ุช ู…ู…ูƒู†"],
"referral_en": "Severe depression is a medical condition. Please see a psychiatrist urgently.",
"referral_ar": "ุงู„ุงูƒุชุฆุงุจ ุงู„ุดุฏูŠุฏ ุญุงู„ุฉ ุทุจูŠุฉ. ู…ู† ูุถู„ูƒ ุฑุงุฌุน ุทุจูŠุจุงู‹ ู†ูุณูŠุงู‹ ุจุดูƒู„ ุนุงุฌู„.",
},
},
"self_worth": {
"mild_moderate": {
"tips_en": [
"Write 3 things you did well today โ€” no matter how small",
"The critical voice in your head is not the truth",
"Treat yourself with the same kindness you'd give a friend",
],
"tips_ar": [
"ุงูƒุชุจ 3 ุฃุดูŠุงุก ู‚ู…ุช ุจู‡ุง ุจุดูƒู„ ุฌูŠุฏ ุงู„ูŠูˆู… โ€” ู…ู‡ู…ุง ูƒุงู†ุช ุตุบูŠุฑุฉ",
"ุงู„ุตูˆุช ุงู„ู†ุงู‚ุฏ ููŠ ุฑุฃุณูƒ ู„ูŠุณ ุงู„ุญู‚ูŠู‚ุฉ",
"ุชุนุงู…ู„ ู…ุน ู†ูุณูƒ ุจู†ูุณ ุงู„ู„ุทู ุงู„ุฐูŠ ุชุนุทูŠู‡ ู„ุตุฏูŠู‚",
],
"resources_en": ["Book: 'Feeling Good' by David Burns",
"Book: 'Self-Compassion' by Kristin Neff"],
"resources_ar": ["ูƒุชุงุจ: 'Feeling Good' ู„ู€ David Burns",
"ูƒุชุงุจ: 'Self-Compassion' ู„ู€ Kristin Neff"],
"referral_en": "Low self-worth with depression responds very well to CBT therapy.",
"referral_ar": "ุถุนู ุงู„ุซู‚ุฉ ู…ุน ุงู„ุงูƒุชุฆุงุจ ูŠุณุชุฌูŠุจ ุฌูŠุฏุงู‹ ุฌุฏุงู‹ ู„ู„ุนู„ุงุฌ ุงู„ู…ุนุฑููŠ ุงู„ุณู„ูˆูƒูŠ.",
},
"severe": {
"tips_en": [
"You are not your worst thoughts โ€” please reach out for help",
"Start with one tiny act of self-care today",
"Connect with someone safe right now",
],
"tips_ar": [
"ุฃู†ุช ู„ุณุช ุฃููƒุงุฑูƒ ุงู„ุณูŠุฆุฉ โ€” ู…ู† ูุถู„ูƒ ุงุทู„ุจ ุงู„ู…ุณุงุนุฏุฉ",
"ุงุจุฏุฃ ุจูุนู„ ุตุบูŠุฑ ุฌุฏุงู‹ ู…ู† ุงู„ุฑุนุงูŠุฉ ุงู„ุฐุงุชูŠุฉ ุงู„ูŠูˆู…",
"ุชูˆุงุตู„ ู…ุน ุดุฎุต ุขู…ู† ุงู„ุขู†",
],
"resources_en": ["Urgent: Please contact a mental health professional",
"CBT and medication together are very effective"],
"resources_ar": ["ุนุงุฌู„: ู…ู† ูุถู„ูƒ ุชูˆุงุตู„ ู…ุน ู…ุชุฎุตุต ู†ูุณูŠ",
"ุงู„ุนู„ุงุฌ ุงู„ู…ุนุฑููŠ ุงู„ุณู„ูˆูƒูŠ ูˆุงู„ุฏูˆุงุก ู…ุนุงู‹ ูุนู‘ุงู„ุงู† ุฌุฏุงู‹"],
"referral_en": "Please seek professional help immediately. You deserve support and recovery.",
"referral_ar": "ู…ู† ูุถู„ูƒ ุงุทู„ุจ ู…ุณุงุนุฏุฉ ู…ุชุฎุตุตุฉ ููˆุฑุงู‹. ุฃู†ุช ุชุณุชุญู‚ ุงู„ุฏุนู… ูˆุงู„ุชุนุงููŠ.",
},
},
"general": {
"mild_moderate": {
"tips_en": [
"Maintain a consistent daily routine",
"Get 15 minutes of sunlight every day โ€” it genuinely helps",
"Light exercise (a 30-minute walk) is clinically proven to reduce mild depression",
"Connect with at least one person daily",
],
"tips_ar": [
"ุญุงูุธ ุนู„ู‰ ุฑูˆุชูŠู† ูŠูˆู…ูŠ ุซุงุจุช",
"ุงุญุตู„ ุนู„ู‰ 15 ุฏู‚ูŠู‚ุฉ ู…ู† ุฃุดุนุฉ ุงู„ุดู…ุณ ูƒู„ ูŠูˆู… โ€” ุจูŠุณุงุนุฏ ูุนู„ุงู‹",
"ุงู„ุฑูŠุงุถุฉ ุงู„ุฎููŠูุฉ (ู…ุดูŠ 30 ุฏู‚ูŠู‚ุฉ) ุซุจุช ุนู„ู…ูŠุงู‹ ุฅู†ู‡ุง ุจุชู‚ู„ู„ ุงู„ุงูƒุชุฆุงุจ ุงู„ุฎููŠู",
"ุชูˆุงุตู„ ู…ุน ุดุฎุต ูˆุงุญุฏ ุนู„ู‰ ุงู„ุฃู‚ู„ ูŠูˆู…ูŠุงู‹",
],
"resources_en": ["App: Woebot for daily mental health support",
"Book: 'The Depression Cure' by Stephen Ilardi",
"Book: 'Feeling Good' by David Burns"],
"resources_ar": ["ุชุทุจูŠู‚: Woebot ู„ู„ุฏุนู… ุงู„ู†ูุณูŠ ุงู„ูŠูˆู…ูŠ",
"ูƒุชุงุจ: 'The Depression Cure' ู„ู€ Stephen Ilardi",
"ูƒุชุงุจ: 'Feeling Good' ู„ู€ David Burns"],
"referral_en": "If symptoms persist more than 2 weeks, please speak with a doctor or therapist.",
"referral_ar": "ู„ูˆ ุงู„ุฃุนุฑุงุถ ู…ุณุชู…ุฑุฉ ุฃูƒุซุฑ ู…ู† ุฃุณุจูˆุนูŠู†ุŒ ู…ู† ูุถู„ูƒ ุชุญุฏุซ ู…ุน ุทุจูŠุจ ุฃูˆ ู…ุนุงู„ุฌ.",
},
"severe": {
"tips_en": [
"Do not be alone โ€” stay with safe people",
"Focus only on the next hour, not the whole day",
"Even getting out of bed is an achievement today",
],
"tips_ar": [
"ู„ุง ุชูƒู† ูˆุญุฏูƒ โ€” ุงุจู‚ูŽ ู…ุน ุฃุดุฎุงุต ุขู…ู†ูŠู†",
"ุฑูƒุฒ ุนู„ู‰ ุงู„ุณุงุนุฉ ุงู„ู‚ุงุฏู…ุฉ ูู‚ุทุŒ ู„ูŠุณ ุงู„ูŠูˆู… ูƒู„ู‡",
"ุญุชู‰ ุงู„ู†ู‡ูˆุถ ู…ู† ุงู„ุณุฑูŠุฑ ุฅู†ุฌุงุฒ ุงู„ูŠูˆู…",
],
"resources_en": ["Combination of therapy and medication is most effective for severe depression",
"Please contact a psychiatrist as soon as possible"],
"resources_ar": ["ู…ุฒูŠุฌ ุงู„ุนู„ุงุฌ ุงู„ู†ูุณูŠ ูˆุงู„ุฏูˆุงุก ู‡ูˆ ุงู„ุฃูƒุซุฑ ูุนุงู„ูŠุฉ ู„ู„ุงูƒุชุฆุงุจ ุงู„ุดุฏูŠุฏ",
"ู…ู† ูุถู„ูƒ ุชูˆุงุตู„ ู…ุน ุทุจูŠุจ ู†ูุณูŠ ููŠ ุฃู‚ุฑุจ ูˆู‚ุช ู…ู…ูƒู†"],
"referral_en": "Severe depression is a serious medical condition. Please seek help urgently.",
"referral_ar": "ุงู„ุงูƒุชุฆุงุจ ุงู„ุดุฏูŠุฏ ุญุงู„ุฉ ุทุจูŠุฉ ุฎุทูŠุฑุฉ. ู…ู† ูุถู„ูƒ ุงุทู„ุจ ุงู„ู…ุณุงุนุฏุฉ ุจุดูƒู„ ุนุงุฌู„.",
},
},
},
# โ”€โ”€ STRESS โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
"stress": {
"work": {
"mild_moderate": {
"tips_en": [
"Use the Pomodoro technique: 25 min work + 5 min break",
"Write your top 3 priorities each morning and stick to them",
"Learn to say no to extra tasks when overloaded",
"Disconnect from work emails after working hours",
],
"tips_ar": [
"ุงุณุชุฎุฏู… ุชู‚ู†ูŠุฉ Pomodoro: 25 ุฏู‚ูŠู‚ุฉ ุนู…ู„ + 5 ุฏู‚ุงุฆู‚ ุฑุงุญุฉ",
"ุงูƒุชุจ ุฃู‡ู… 3 ุฃูˆู„ูˆูŠุงุช ูƒู„ ุตุจุงุญ ูˆุงู„ุชุฒู… ุจู‡ุง",
"ุชุนู„ู‘ู… ู‚ูˆู„ 'ู„ุง' ู„ู„ู…ู‡ุงู… ุงู„ุฅุถุงููŠุฉ ุนู†ุฏ ุงู„ุถุบุท ุงู„ุฒุงุฆุฏ",
"ุงูุตู„ ู†ูุณูƒ ุนู† ุฅูŠู…ูŠู„ุงุช ุงู„ุนู…ู„ ุจุนุฏ ุณุงุนุงุช ุงู„ุนู…ู„",
],
"resources_en": ["App: Todoist or Notion for task management",
"Book: 'Deep Work' by Cal Newport"],
"resources_ar": ["ุชุทุจูŠู‚: Todoist ุฃูˆ Notion ู„ุฅุฏุงุฑุฉ ุงู„ู…ู‡ุงู…",
"ูƒุชุงุจ: 'Deep Work' ู„ู€ Cal Newport"],
"referral_en": "If work stress is causing physical symptoms, consult a doctor.",
"referral_ar": "ู„ูˆ ุถุบุท ุงู„ุนู…ู„ ุจูŠุณุจุจ ุฃุนุฑุงุถุงู‹ ุฌุณู…ุงู†ูŠุฉุŒ ุงุณุชุดุฑ ุทุจูŠุจุงู‹.",
},
"severe": {
"tips_en": [
"You may be experiencing burnout โ€” this is a real medical condition",
"Take urgent time off if possible",
"Talk to your manager or HR about workload redistribution",
],
"tips_ar": [
"ู‚ุฏ ุชูƒูˆู† ุชุนุงู†ูŠ ู…ู† ุงู„ุฅุฑู‡ุงู‚ ุงู„ูˆุธูŠููŠ (Burnout) โ€” ูˆู‡ุฐู‡ ุญุงู„ุฉ ุทุจูŠุฉ ุญู‚ูŠู‚ูŠุฉ",
"ุฎุฐ ุฅุฌุงุฒุฉ ุนุงุฌู„ุฉ ู„ูˆ ู…ู…ูƒู†",
"ุชุญุฏุซ ู…ุน ู…ุฏูŠุฑูƒ ุฃูˆ ุงู„ู…ูˆุงุฑุฏ ุงู„ุจุดุฑูŠุฉ ุนู† ุฅุนุงุฏุฉ ุชูˆุฒูŠุน ุนุจุก ุงู„ุนู…ู„",
],
"resources_en": ["Book: 'Burnout' by Emily Nagoski",
"Urgent: Consult an occupational health specialist"],
"resources_ar": ["ูƒุชุงุจ: 'Burnout' ู„ู€ Emily Nagoski",
"ุนุงุฌู„: ุงุณุชุดุฑ ุฃุฎุตุงุฆูŠ ุงู„ุตุญุฉ ุงู„ู…ู‡ู†ูŠุฉ"],
"referral_en": "Severe burnout requires professional support. Please consult a doctor or therapist.",
"referral_ar": "ุงู„ุฅุฑู‡ุงู‚ ุงู„ูˆุธูŠููŠ ุงู„ุดุฏูŠุฏ ูŠุญุชุงุฌ ุฏุนู…ุงู‹ ู…ุชุฎุตุตุงู‹. ู…ู† ูุถู„ูƒ ุงุณุชุดุฑ ุทุจูŠุจุงู‹ ุฃูˆ ู…ุนุงู„ุฌุงู‹.",
},
},
"academic": {
"mild_moderate": {
"tips_en": [
"Plan your study schedule in advance โ€” avoid last-minute cramming",
"Use Active Recall and Spaced Repetition for effective studying",
"Sleep is more valuable than all-nighters before exams",
],
"tips_ar": [
"ุฎุทุท ุฌุฏูˆู„ ู…ุฐุงูƒุฑุชูƒ ู…ุณุจู‚ุงู‹ โ€” ุชุฌู†ุจ ุงู„ุฏุฑุงุณุฉ ููŠ ุงู„ู„ุญุธุฉ ุงู„ุฃุฎูŠุฑุฉ",
"ุงุณุชุฎุฏู… Active Recall ูˆSpaced Repetition ู„ู„ู…ุฐุงูƒุฑุฉ ุงู„ูุนู‘ุงู„ุฉ",
"ุงู„ู†ูˆู… ุฃู‡ู… ู…ู† ุงู„ุณู‡ุฑ ู‚ุจู„ ุงู„ุงู…ุชุญุงู†ุงุช",
],
"resources_en": ["App: Anki for Spaced Repetition",
"App: Forest to block distractions while studying"],
"resources_ar": ["ุชุทุจูŠู‚: Anki ู„ู€ Spaced Repetition",
"ุชุทุจูŠู‚: Forest ู„ู…ู†ุน ุงู„ุชุดุชูŠุช ุฃุซู†ุงุก ุงู„ู…ุฐุงูƒุฑุฉ"],
"referral_en": "If academic stress is severely impacting you, talk to your university counselor.",
"referral_ar": "ู„ูˆ ุถุบุท ุงู„ุฏุฑุงุณุฉ ุจูŠุฃุซุฑ ุนู„ูŠูƒ ุจุดูƒู„ ูƒุจูŠุฑุŒ ุชุญุฏุซ ู…ุน ุงู„ู…ุฑุดุฏ ุงู„ุฃูƒุงุฏูŠู…ูŠ ููŠ ุฌุงู…ุนุชูƒ.",
},
"severe": {
"tips_en": [
"Your worth is not defined by your grades",
"Talk to your academic advisor โ€” they can offer real solutions",
"Seek your university's mental health support services",
],
"tips_ar": [
"ู‚ูŠู…ุชูƒ ู„ุง ุชูุญุฏู‘ุฏ ุจุฏุฑุฌุงุชูƒ",
"ุชุญุฏุซ ู…ุน ู…ุฑุดุฏูƒ ุงู„ุฃูƒุงุฏูŠู…ูŠ โ€” ุจูŠู‚ุฏุฑ ูŠู‚ุฏู… ุญู„ูˆู„ุงู‹ ุญู‚ูŠู‚ูŠุฉ",
"ุงุทู„ุจ ุฎุฏู…ุงุช ุงู„ุฏุนู… ุงู„ู†ูุณูŠ ููŠ ุฌุงู…ุนุชูƒ",
],
"resources_en": ["Most universities offer free mental health counseling"],
"resources_ar": ["ู…ุนุธู… ุงู„ุฌุงู…ุนุงุช ุชู‚ุฏู… ุฅุฑุดุงุฏุงู‹ ู†ูุณูŠุงู‹ ู…ุฌุงู†ูŠุงู‹"],
"referral_en": "Please reach out to a counselor or therapist. Academic stress at this level needs support.",
"referral_ar": "ู…ู† ูุถู„ูƒ ุชูˆุงุตู„ ู…ุน ู…ุฑุดุฏ ุฃูˆ ู…ุนุงู„ุฌ. ุถุบุท ุงู„ุฏุฑุงุณุฉ ุจู‡ุฐุง ุงู„ู…ุณุชูˆู‰ ูŠุญุชุงุฌ ุฏุนู…ุงู‹.",
},
},
"general": {
"mild_moderate": {
"tips_en": [
"Exercise for 20 minutes daily โ€” it reduces cortisol significantly",
"Write your thoughts in a daily journal",
"Focus on what you can control, let go of what you can't",
"Schedule genuine rest time โ€” it's not wasted time",
],
"tips_ar": [
"ู…ุงุฑุณ ุงู„ุฑูŠุงุถุฉ 20 ุฏู‚ูŠู‚ุฉ ูŠูˆู…ูŠุงู‹ โ€” ุจูŠู‚ู„ู„ ุงู„ูƒูˆุฑุชูŠุฒูˆู„ ุจุดูƒู„ ู…ู„ุญูˆุธ",
"ุงูƒุชุจ ุฃููƒุงุฑูƒ ููŠ ุฏูุชุฑ ูŠูˆู…ูŠ",
"ุฑูƒุฒ ุนู„ู‰ ู…ุง ุชู‚ุฏุฑ ุชุชุญูƒู… ููŠู‡ุŒ ูˆุงุชุฑูƒ ู…ุง ู„ุง ุชู‚ุฏุฑ",
"ุฌุฏูˆู‘ู„ ูˆู‚ุช ุฑุงุญุฉ ุญู‚ูŠู‚ูŠ โ€” ู‡ูˆ ู…ุด ูˆู‚ุช ุถุงุฆุน",
],
"resources_en": ["App: Insight Timer for short meditation sessions",
"Book: 'The Stress Solution' by Rangan Chatterjee",
"Technique: Progressive Muscle Relaxation before sleep"],
"resources_ar": ["ุชุทุจูŠู‚: Insight Timer ู„ุฌู„ุณุงุช ุชุฃู…ู„ ู‚ุตูŠุฑุฉ",
"ูƒุชุงุจ: 'The Stress Solution' ู„ู€ Rangan Chatterjee",
"ุชู‚ู†ูŠุฉ: Progressive Muscle Relaxation ู‚ุจู„ ุงู„ู†ูˆู…"],
"referral_en": "Chronic stress (over 1 month) is worth discussing with a professional.",
"referral_ar": "ุงู„ุถุบุท ุงู„ู…ุฒู…ู† (ุฃูƒุซุฑ ู…ู† ุดู‡ุฑ) ูŠุณุชุญู‚ ุงู„ุชุญุฏุซ ุนู†ู‡ ู…ุน ู…ุชุฎุตุต.",
},
"severe": {
"tips_en": [
"Your body is sending serious signals โ€” please listen to them",
"Eliminate one major stressor if possible",
"Ask for help โ€” carrying everything alone is not sustainable",
],
"tips_ar": [
"ุฌุณู…ูƒ ูŠุฑุณู„ ุฅุดุงุฑุงุช ุฎุทูŠุฑุฉ โ€” ู…ู† ูุถู„ูƒ ุงุณุชู…ุน ุฅู„ูŠู‡ุง",
"ุฃุฒู„ ู…ุตุฏุฑ ุถุบุท ุฑุฆูŠุณูŠ ูˆุงุญุฏ ู„ูˆ ู…ู…ูƒู†",
"ุงุทู„ุจ ุงู„ู…ุณุงุนุฏุฉ โ€” ุญู…ู„ ูƒู„ ุดูŠุก ูˆุญุฏูƒ ู„ูŠุณ ู…ุณุชุฏุงู…ุงู‹",
],
"resources_en": ["Severe chronic stress can cause physical illness โ€” see a doctor",
"Therapy (CBT or mindfulness-based) is highly effective"],
"resources_ar": ["ุงู„ุถุบุท ุงู„ู…ุฒู…ู† ุงู„ุดุฏูŠุฏ ู‚ุฏ ูŠุณุจุจ ุฃู…ุฑุงุถุงู‹ ุฌุณุฏูŠุฉ โ€” ุฑุงุฌุน ุทุจูŠุจุงู‹",
"ุงู„ุนู„ุงุฌ ุงู„ู†ูุณูŠ (CBT ุฃูˆ ุงู„ู‚ุงุฆู… ุนู„ู‰ ุงู„ูŠู‚ุธุฉ ุงู„ุฐู‡ู†ูŠุฉ) ูุนู‘ุงู„ ุฌุฏุงู‹"],
"referral_en": "Please consult a doctor or therapist. Severe stress at this level needs professional attention.",
"referral_ar": "ู…ู† ูุถู„ูƒ ุงุณุชุดุฑ ุทุจูŠุจุงู‹ ุฃูˆ ู…ุนุงู„ุฌุงู‹. ุงู„ุถุบุท ุงู„ุดุฏูŠุฏ ุจู‡ุฐุง ุงู„ู…ุณุชูˆู‰ ูŠุญุชุงุฌ ุงู‡ุชู…ุงู…ุงู‹ ู…ุชุฎุตุตุงู‹.",
},
},
},
}
# Suicidal crisis โ€” overrides everything
SUICIDAL_REC = {
"tips_en": [
"You are not alone โ€” help is available right now",
"Please reach out to someone you trust immediately",
"Remove access to any means of self-harm if possible",
"Stay with another person โ€” do not be alone right now",
],
"tips_ar": [
"ุฃู†ุช ู„ุณุช ูˆุญุฏูƒ โ€” ุงู„ู…ุณุงุนุฏุฉ ู…ุชุงุญุฉ ุงู„ุขู†",
"ู…ู† ูุถู„ูƒ ุชูˆุงุตู„ ู…ุน ุดุฎุต ุชุซู‚ ุจู‡ ููˆุฑุงู‹",
"ุงุจุชุนุฏ ุนู† ุฃูŠ ูˆุณูŠู„ุฉ ู‚ุฏ ุชุคุฐูŠ ุจู‡ุง ู†ูุณูƒ",
"ุงุจู‚ูŽ ู…ุน ุดุฎุต ุขุฎุฑ โ€” ู„ุง ุชูƒู† ูˆุญุฏูƒ ุงู„ุขู†",
],
"resources_en": [
"๐Ÿ†˜ International Association for Suicide Prevention: https://www.iasp.info/resources/Crisis_Centres/",
"๐Ÿ†˜ Crisis Text Line (US): Text HOME to 741741",
"๐Ÿ†˜ Befrienders Worldwide: https://www.befrienders.org",
],
"resources_ar": [
"๐Ÿ†˜ ุงู„ุฑุงุจุทุฉ ุงู„ุฏูˆู„ูŠุฉ ู„ู„ูˆู‚ุงูŠุฉ ู…ู† ุงู„ุงู†ุชุญุงุฑ: https://www.iasp.info/resources/Crisis_Centres/",
"๐Ÿ†˜ ุฎุท ุฃุฒู…ุงุช ุฅูŠู…ูŠุฌ (ู…ุตุฑ): 08008880700",
"๐Ÿ†˜ ุฎุท ู…ุณุงู†ุฏุฉ (ุงู„ุณุนูˆุฏูŠุฉ): 920033360",
"๐Ÿ†˜ ู…ูˆู‚ุน Befrienders ุงู„ุนุงู„ู…ูŠ: https://www.befrienders.org",
],
"referral_en": "๐Ÿšจ URGENT: Please contact a mental health crisis line or go to the nearest emergency room immediately. Your life has value and help is available.",
"referral_ar": "๐Ÿšจ ุนุงุฌู„ ุฌุฏุงู‹: ู…ู† ูุถู„ูƒ ุชูˆุงุตู„ ู…ุน ุฎุท ุฃุฒู…ุงุช ุงู„ุตุญุฉ ุงู„ู†ูุณูŠุฉ ุฃูˆ ุงุฐู‡ุจ ู„ุฃู‚ุฑุจ ุทูˆุงุฑุฆ ููˆุฑุงู‹. ุญูŠุงุชูƒ ู„ู‡ุง ู‚ูŠู…ุฉ ูˆุงู„ู…ุณุงุนุฏุฉ ู…ุชุงุญุฉ.",
}
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
# 5. MAIN FUNCTION
# โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•
def get_recommendations(
disease: str,
disease_score: float,
user_text: str,
) -> dict:
"""
disease : 'anxiety' | 'depression' | 'stress'
disease_score: float 0-1 ู…ู† ุงู„ู…ูˆุฏูŠู„
user_text : ุงู„ู†ุต ุงู„ุฐูŠ ูƒุชุจู‡ ุงู„ู…ุณุชุฎุฏู…
returns : dict ุจุงู„ุชูˆุตูŠุงุช ุงู„ูƒุงู…ู„ุฉ
"""
is_suicidal = detect_suicidal(user_text)
if is_suicidal:
return {
"suicidal_flag": True,
"severity": "crisis",
"cause": "crisis",
**SUICIDAL_REC,
}
severity = get_severity(disease, disease_score)
severity_group = "severe" if severity in ("severe", "extremely_severe") else "mild_moderate"
cause = extract_cause(user_text)
disease_db = REC_DB.get(disease, REC_DB["stress"])
cause_db = disease_db.get(cause, disease_db.get("general", {}))
rec = cause_db.get(severity_group, cause_db.get("mild_moderate", {}))
return {
"suicidal_flag": False,
"severity": severity,
"cause": cause,
"tips_en": rec.get("tips_en", []),
"tips_ar": rec.get("tips_ar", []),
"resources_en": rec.get("resources_en", []),
"resources_ar": rec.get("resources_ar", []),
"referral_en": rec.get("referral_en", ""),
"referral_ar": rec.get("referral_ar", ""),
}