Update DMH Hospital Diabetic Dost
@@ -93,6 +93,12 @@ ADMIN_HTML_PATH = TEMPLATES_DIR / "admin.html"
|
|||||||
|
|
||||||
@app.get("/favicon.ico", include_in_schema=False)
|
@app.get("/favicon.ico", include_in_schema=False)
|
||||||
async def favicon_endpoint():
|
async def favicon_endpoint():
|
||||||
|
fav_candidate = STATIC_DIR / "dmh_logo.png"
|
||||||
|
if fav_candidate.exists():
|
||||||
|
return FileResponse(fav_candidate, media_type="image/png")
|
||||||
|
fav_candidate = STATIC_DIR / "favicon.png"
|
||||||
|
if fav_candidate.exists():
|
||||||
|
return FileResponse(fav_candidate, media_type="image/png")
|
||||||
fav_candidate = STATIC_DIR / "chellaram_hospital_logo.png"
|
fav_candidate = STATIC_DIR / "chellaram_hospital_logo.png"
|
||||||
if fav_candidate.exists():
|
if fav_candidate.exists():
|
||||||
return FileResponse(fav_candidate, media_type="image/png")
|
return FileResponse(fav_candidate, media_type="image/png")
|
||||||
@@ -160,8 +166,8 @@ async def health_check():
|
|||||||
gpu_name = "CPU Mode"
|
gpu_name = "CPU Mode"
|
||||||
return {
|
return {
|
||||||
"status": "online",
|
"status": "online",
|
||||||
"app_name": "Chellaram Hospital — Diabetes Dost",
|
"app_name": "Dinanath Mangeshkar Hospital — Diabetes Dost",
|
||||||
"hospital_name": "Chellaram Hospital",
|
"hospital_name": "Dinanath Mangeshkar Hospital",
|
||||||
"motto": "Diabetes Care & Multispeciality",
|
"motto": "Diabetes Care & Multispeciality",
|
||||||
"bot_name": "Diabetes Dost",
|
"bot_name": "Diabetes Dost",
|
||||||
"language": "hi-IN",
|
"language": "hi-IN",
|
||||||
|
|||||||
@@ -37,25 +37,25 @@ EMERGENCY_TRIGGERS: List[Dict[str, Any]] = [
|
|||||||
"id": "EMERGENCY_CHEST_PAIN",
|
"id": "EMERGENCY_CHEST_PAIN",
|
||||||
"category": "cardiac_emergency",
|
"category": "cardiac_emergency",
|
||||||
"patterns": [r"सीने.*दर्द", r"छाती.*दर्द", r"छातीत.*दुख", r"chest.*pain", r"हार्ट.*अटैक", r"heart.*attack", r"बांह.*दर्द", r"छाती.*भारी"],
|
"patterns": [r"सीने.*दर्द", r"छाती.*दर्द", r"छातीत.*दुख", r"chest.*pain", r"हार्ट.*अटैक", r"heart.*attack", r"बांह.*दर्द", r"छाती.*भारी"],
|
||||||
"response": "सावधानी: सीने में तेज दर्द या दबाव एक गंभीर आपातकालीन स्थिति (Heart Emergency) हो सकती है। कृपया तुरंत Chellaram Hospital के इमरजेंसी विभाग में जाएं या एम्बुलेंस बुलाएं। खुद गाड़ी न चलाएं और तुरंत डॉक्टरी सहायता लें।"
|
"response": "सावधानी: सीने में तेज दर्द या दबाव एक गंभीर आपातकालीन स्थिति (Heart Emergency) हो सकती है। कृपया तुरंत Dinanath Mangeshkar Hospital के इमरजेंसी विभाग में जाएं या एम्बुलेंस बुलाएं। खुद गाड़ी न चलाएं और तुरंत डॉक्टरी सहायता लें।"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "EMERGENCY_BREATHING",
|
"id": "EMERGENCY_BREATHING",
|
||||||
"category": "respiratory_emergency",
|
"category": "respiratory_emergency",
|
||||||
"patterns": [r"सांस.*तकलीफ", r"दम.*घुट", r"सांस.*नहीं आ", r"breath.*difficult", r"सांस.*फूलना.*ज्यादा", r"श्वास.*त्रास"],
|
"patterns": [r"सांस.*तकलीफ", r"दम.*घुट", r"सांस.*नहीं आ", r"breath.*difficult", r"सांस.*फूलना.*ज्यादा", r"श्वास.*त्रास"],
|
||||||
"response": "महत्वपूर्ण चेतावनी: सांस लेने में अत्यधिक तकलीफ या दम घुटना गंभीर स्थिति है। कृपया तुरंत सीधे बैठें, खिड़की या खुली हवा में आएं और बिना देरी किए Chellaram Hospital के आपातकालीन कक्ष (Emergency Department) में संपर्क करें।"
|
"response": "महत्वपूर्ण चेतावनी: सांस लेने में अत्यधिक तकलीफ या दम घुटना गंभीर स्थिति है। कृपया तुरंत सीधे बैठें, खिड़की या खुली हवा में आएं और बिना देरी किए Dinanath Mangeshkar Hospital के आपातकालीन कक्ष (Emergency Department) में संपर्क करें।"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "EMERGENCY_SEVERE_HYPO",
|
"id": "EMERGENCY_SEVERE_HYPO",
|
||||||
"category": "severe_hypoglycemia",
|
"category": "severe_hypoglycemia",
|
||||||
"patterns": [r"शुगर.*\b(?:30|40|50)\b", r"sugar.*\b(?:30|40|50)\b", r"शुगर.*कम.*बेहोश", r"गंभीर.*लो.*शुगर"],
|
"patterns": [r"शुगर.*\b(?:30|40|50)\b", r"sugar.*\b(?:30|40|50)\b", r"शुगर.*कम.*बेहोश", r"गंभीर.*लो.*शुगर"],
|
||||||
"response": "आपातकालीन चेतावनी: ब्लड शुगर का स्तर बहुत खतरनाक रूप से कम हो गया है। यदि मरीज होश में है तो तुरंत 3-4 चम्मच चीनी, ग्लूकोज पानी या मीठा जूस दें। यदि मरीज अचेत हो तो मुंह में कुछ न डालें और तुरंत Chellaram Hospital इमरजेंसी में ले जाएं।"
|
"response": "आपातकालीन चेतावनी: ब्लड शुगर का स्तर बहुत खतरनाक रूप से कम हो गया है। यदि मरीज होश में है तो तुरंत 3-4 चम्मच चीनी, ग्लूकोज पानी या मीठा जूस दें। यदि मरीज अचेत हो तो मुंह में कुछ न डालें और तुरंत Dinanath Mangeshkar Hospital इमरजेंसी में ले जाएं।"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "EMERGENCY_STROKE_NEURO",
|
"id": "EMERGENCY_STROKE_NEURO",
|
||||||
"category": "stroke_emergency",
|
"category": "stroke_emergency",
|
||||||
"patterns": [r"बेहोश", r"अचेत", r"unconscious", r"लकवा", r"चेहरा.*टेढ़ा", r"बोली.*लड़खड़ा", r"stroke", r"paralysis", r"पक्षाघात"],
|
"patterns": [r"बेहोश", r"अचेत", r"unconscious", r"लकवा", r"चेहरा.*टेढ़ा", r"बोली.*लड़खड़ा", r"stroke", r"paralysis", r"पक्षाघात"],
|
||||||
"response": "अति आवश्यक चेतावनी: अचानक बेहोशी, चेहरे का टेढ़ापन या बोली लड़खड़ाना स्ट्रोक (Stroke) या न्यूरोलॉजिकल इमरजेंसी के लक्षण हो सकते हैं। रोगी को तुरंत Chellaram Hospital इमरजेंसी विभाग ले जाएं।"
|
"response": "अति आवश्यक चेतावनी: अचानक बेहोशी, चेहरे का टेढ़ापन या बोली लड़खड़ाना स्ट्रोक (Stroke) या न्यूरोलॉजिकल इमरजेंसी के लक्षण हो सकते हैं। रोगी को तुरंत Dinanath Mangeshkar Hospital इमरजेंसी विभाग ले जाएं।"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -271,11 +271,11 @@ class StructuredMedicalState:
|
|||||||
|
|
||||||
|
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
# 4. CLINICAL CONVERSATION SESSION (CHELLARAM HOSPITAL ASSISTANT)
|
# 4. CLINICAL CONVERSATION SESSION (DINANATH MANGESHKAR HOSPITAL ASSISTANT)
|
||||||
# =====================================================================
|
# =====================================================================
|
||||||
class ClinicalConversationSession:
|
class ClinicalConversationSession:
|
||||||
"""
|
"""
|
||||||
Chellaram Hospital Continuous Conversational Medical Assistant.
|
Dinanath Mangeshkar Hospital Continuous Conversational Medical Assistant.
|
||||||
"""
|
"""
|
||||||
def __init__(self, session_id: Optional[str] = None):
|
def __init__(self, session_id: Optional[str] = None):
|
||||||
self.session_id = session_id or str(uuid.uuid4())[:8]
|
self.session_id = session_id or str(uuid.uuid4())[:8]
|
||||||
@@ -570,14 +570,14 @@ class ClinicalConversationSession:
|
|||||||
resp = f"{ack_name}बताइए, आपको यह तकलीफ कब से हो रही है?"
|
resp = f"{ack_name}बताइए, आपको यह तकलीफ कब से हो रही है?"
|
||||||
return self._format_response("ACK_DEMOGRAPHICS_CONTINUE", "clinical_progression", resp)
|
return self._format_response("ACK_DEMOGRAPHICS_CONTINUE", "clinical_progression", resp)
|
||||||
|
|
||||||
# 5. Check Diabetes Risk Symptoms & Provide Awareness + Chellaram Hospital Recommendation
|
# 5. Check Diabetes Risk Symptoms & Provide Awareness + Dinanath Mangeshkar Hospital Recommendation
|
||||||
diabetes_risk_symptoms = ["excessive_thirst", "frequent_urination"]
|
diabetes_risk_symptoms = ["excessive_thirst", "frequent_urination"]
|
||||||
has_diabetes_risk = any(s in self.state.active_symptoms for s in diabetes_risk_symptoms) or any(w in text_lower for w in ["प्यास लगती", "पेशाब आता", "तहान", "लघवी", "थकान और कमजोरी", "वजन कम"])
|
has_diabetes_risk = any(s in self.state.active_symptoms for s in diabetes_risk_symptoms) or any(w in text_lower for w in ["प्यास लगती", "पेशाब आता", "तहान", "लघवी", "थकान और कमजोरी", "वजन कम"])
|
||||||
if has_diabetes_risk and "diabetes_awareness_given" not in self.state.asked_questions and not self.state.known_diabetes:
|
if has_diabetes_risk and "diabetes_awareness_given" not in self.state.asked_questions and not self.state.known_diabetes:
|
||||||
self.state.asked_questions.append("diabetes_awareness_given")
|
self.state.asked_questions.append("diabetes_awareness_given")
|
||||||
self.state.hospital_recommendation_given = True
|
self.state.hospital_recommendation_given = True
|
||||||
self.state.tests_discussed.append("Blood Sugar Screening")
|
self.state.tests_discussed.append("Blood Sugar Screening")
|
||||||
resp = f"{name_prefix}बहुत अधिक प्यास लगना और बार-बार पेशाब आना ब्लड शुगर (डायबिटीज) से संबंधित लक्षण भी हो सकते हैं। इसलिए ब्लड शुगर और आवश्यक जांचों की जरूरत हो सकती है। आप Chellaram Hospital में डॉक्टर से परामर्श और जरूरी टेस्ट के लिए संपर्क कर सकते हैं।"
|
resp = f"{name_prefix}बहुत अधिक प्यास लगना और बार-बार पेशाब आना ब्लड शुगर (डायबिटीज) से संबंधित लक्षण भी हो सकते हैं। इसलिए ब्लड शुगर और आवश्यक जांचों की जरूरत हो सकती है। आप Dinanath Mangeshkar Hospital में डॉक्टर से परामर्श और जरूरी टेस्ट के लिए संपर्क कर सकते हैं।"
|
||||||
return self._format_response("DIABETES_AWARENESS_POONA", "diabetes_awareness", resp)
|
return self._format_response("DIABETES_AWARENESS_POONA", "diabetes_awareness", resp)
|
||||||
|
|
||||||
# 6. Multi-Symptom Risk Assessment
|
# 6. Multi-Symptom Risk Assessment
|
||||||
@@ -615,10 +615,10 @@ class ClinicalConversationSession:
|
|||||||
resp = f"{name_prefix}Insulin का इंजेक्शन मुख्य भोजन से 15 से 20 मिनट पहले लिया जाता है।"
|
resp = f"{name_prefix}Insulin का इंजेक्शन मुख्य भोजन से 15 से 20 मिनट पहले लिया जाता है।"
|
||||||
return self._format_response("MED_TIMING_INSULIN", "medication", resp)
|
return self._format_response("MED_TIMING_INSULIN", "medication", resp)
|
||||||
|
|
||||||
# D. Lab Test / Blood Test / Consultation Inquiries -> Recommend Chellaram Hospital
|
# D. Lab Test / Blood Test / Consultation Inquiries -> Recommend Dinanath Mangeshkar Hospital
|
||||||
if any(w in text_lower for w in ["रक्त तपासणी", "ब्लड टेस्ट", "cbc", "खून की जांच", "test कब", "टेस्ट कब", "डॉक्टर को दिखाना", "जांच कहां"]):
|
if any(w in text_lower for w in ["रक्त तपासणी", "ब्लड टेस्ट", "cbc", "खून की जांच", "test कब", "टेस्ट कब", "डॉक्टर को दिखाना", "जांच कहां"]):
|
||||||
self.state.hospital_recommendation_given = True
|
self.state.hospital_recommendation_given = True
|
||||||
resp = f"{name_prefix}लक्षणों की सही पुष्टि के लिए CBC और ब्लड टेस्ट की सलाह दी जाती है। आप Chellaram Hospital में डॉक्टर से परामर्श और सभी जरूरी टेस्ट करवा सकते हैं।"
|
resp = f"{name_prefix}लक्षणों की सही पुष्टि के लिए CBC और ब्लड टेस्ट की सलाह दी जाती है। आप Dinanath Mangeshkar Hospital में डॉक्टर से परामर्श और सभी जरूरी टेस्ट करवा सकते हैं।"
|
||||||
return self._format_response("POONA_HOSPITAL_TESTS", "investigation", resp)
|
return self._format_response("POONA_HOSPITAL_TESTS", "investigation", resp)
|
||||||
|
|
||||||
# 8. Specialized Diabetes Flow (When Active)
|
# 8. Specialized Diabetes Flow (When Active)
|
||||||
@@ -646,11 +646,11 @@ class ClinicalConversationSession:
|
|||||||
resp = f"ठीक है {name_prefix}आप {med_list} ले रहे हैं। इसे भोजन के तुरंत बाद लें। क्या आपको बार-बार पेशाब या बहुत प्यास लग रही है?"
|
resp = f"ठीक है {name_prefix}आप {med_list} ले रहे हैं। इसे भोजन के तुरंत बाद लें। क्या आपको बार-बार पेशाब या बहुत प्यास लग रही है?"
|
||||||
return self._format_response("DIA_MED_ACK", "current_medications", resp)
|
return self._format_response("DIA_MED_ACK", "current_medications", resp)
|
||||||
|
|
||||||
# Follow-up with Chellaram Hospital Recommendation
|
# Follow-up with Dinanath Mangeshkar Hospital Recommendation
|
||||||
if "hospital_advised_dia" not in self.state.asked_questions:
|
if "hospital_advised_dia" not in self.state.asked_questions:
|
||||||
self.state.asked_questions.append("hospital_advised_dia")
|
self.state.asked_questions.append("hospital_advised_dia")
|
||||||
self.state.hospital_recommendation_given = True
|
self.state.hospital_recommendation_given = True
|
||||||
resp = f"{name_prefix}डायबिटीज को नियंत्रित रखने के लिए नियमित दवा लें और हर 3 महीने में HbA1c टेस्ट कराएं। आप Chellaram Hospital में डॉक्टर से परामर्श और चेकअप के लिए संपर्क कर सकते हैं।"
|
resp = f"{name_prefix}डायबिटीज को नियंत्रित रखने के लिए नियमित दवा लें और हर 3 महीने में HbA1c टेस्ट कराएं। आप Dinanath Mangeshkar Hospital में डॉक्टर से परामर्श और चेकअप के लिए संपर्क कर सकते हैं।"
|
||||||
return self._format_response("DIA_POONA_RECOMMEND", "diabetes_summary", resp)
|
return self._format_response("DIA_POONA_RECOMMEND", "diabetes_summary", resp)
|
||||||
|
|
||||||
# 9. General Clinical Slot Investigation & Progression
|
# 9. General Clinical Slot Investigation & Progression
|
||||||
@@ -678,12 +678,12 @@ class ClinicalConversationSession:
|
|||||||
follow_up = "क्या इसके साथ चक्कर या कमजोरी भी महसूस हो रही है?"
|
follow_up = "क्या इसके साथ चक्कर या कमजोरी भी महसूस हो रही है?"
|
||||||
return self._format_response(f"ASK_ASSOC_{primary_sym.upper()}", sym_data["category"], f"{name_prefix}{follow_up}")
|
return self._format_response(f"ASK_ASSOC_{primary_sym.upper()}", sym_data["category"], f"{name_prefix}{follow_up}")
|
||||||
|
|
||||||
# Guidance + Chellaram Hospital recommendation for persistent symptoms
|
# Guidance + Dinanath Mangeshkar Hospital recommendation for persistent symptoms
|
||||||
dur_text = f"{dur} से " if dur else ""
|
dur_text = f"{dur} से " if dur else ""
|
||||||
if not self.state.hospital_recommendation_given and "hospital_rec_done" not in self.state.asked_questions:
|
if not self.state.hospital_recommendation_given and "hospital_rec_done" not in self.state.asked_questions:
|
||||||
self.state.asked_questions.append("hospital_rec_done")
|
self.state.asked_questions.append("hospital_rec_done")
|
||||||
self.state.hospital_recommendation_given = True
|
self.state.hospital_recommendation_given = True
|
||||||
full_reply = f"{name_prefix}आपको {dur_text}{sym_data['name_hi']} है। {sym_data['guidance']} यदि तकलीफ 2-3 दिनों में ठीक न हो, तो आप Chellaram Hospital में डॉक्टर से परामर्श और जरूरी जांच के लिए संपर्क कर सकते हैं।"
|
full_reply = f"{name_prefix}आपको {dur_text}{sym_data['name_hi']} है। {sym_data['guidance']} यदि तकलीफ 2-3 दिनों में ठीक न हो, तो आप Dinanath Mangeshkar Hospital में डॉक्टर से परामर्श और जरूरी जांच के लिए संपर्क कर सकते हैं।"
|
||||||
else:
|
else:
|
||||||
full_reply = f"{name_prefix}आपको {dur_text}{sym_data['name_hi']} है। {sym_data['guidance']}"
|
full_reply = f"{name_prefix}आपको {dur_text}{sym_data['name_hi']} है। {sym_data['guidance']}"
|
||||||
|
|
||||||
|
|||||||
@@ -354,7 +354,7 @@ class DialogueManager:
|
|||||||
sugar_text = f" और पिछली बार आपकी Blood Sugar {last_sugar} mg/dL दर्ज थी" if last_sugar else ""
|
sugar_text = f" और पिछली बार आपकी Blood Sugar {last_sugar} mg/dL दर्ज थी" if last_sugar else ""
|
||||||
|
|
||||||
returning_speech = strip_all_punctuations(
|
returning_speech = strip_all_punctuations(
|
||||||
f"नमस्ते {p_name_rec} जी Chellaram Hospital के Diabetes Dost में आपका दोबारा स्वागत है "
|
f"नमस्ते {p_name_rec} जी Dinanath Mangeshkar Hospital के Diabetes Dost में आपका दोबारा स्वागत है "
|
||||||
f"हमारे रिकॉर्ड के अनुसार {meds_text}{sugar_text} आइए आज का आपका Regular Follow-up Check-up शुरू करते हैं "
|
f"हमारे रिकॉर्ड के अनुसार {meds_text}{sugar_text} आइए आज का आपका Regular Follow-up Check-up शुरू करते हैं "
|
||||||
f"{next_q.get('question_hi', '')}"
|
f"{next_q.get('question_hi', '')}"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ class EmergencyDetector:
|
|||||||
primary_cat = matched_categories[0] if matched_categories else "general_acute"
|
primary_cat = matched_categories[0] if matched_categories else "general_acute"
|
||||||
|
|
||||||
verbal_response = (
|
verbal_response = (
|
||||||
"आपके बताए Symptoms गंभीर हो सकते हैं। कृपया अभी तुरंत Chellaram Hospital के Emergency Department "
|
"आपके बताए Symptoms गंभीर हो सकते हैं। कृपया अभी तुरंत Dinanath Mangeshkar Hospital के Emergency Department "
|
||||||
"में संपर्क करें या Local Emergency Service (112 / 108) को Call करें। "
|
"में संपर्क करें या Local Emergency Service (112 / 108) को Call करें। "
|
||||||
"आपकी Safety के लिए इस Screening को अभी रोक दिया जा रहा है।"
|
"आपकी Safety के लिए इस Screening को अभी रोक दिया जा रहा है।"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ def generate_pdf(summary: Dict[str, Any]) -> bytes:
|
|||||||
|
|
||||||
header_data = [
|
header_data = [
|
||||||
[
|
[
|
||||||
Paragraph("<b>🏥 Chellaram Hospital</b><br/><font size=7.5 color='#a5f3fc'>Diabetes Care & Multispeciality — Diabetes Dost</font>", ps("Hdr1", fontName="Helvetica-Bold", fontSize=11, textColor=colors.white)),
|
Paragraph("<b>🏥 Dinanath Mangeshkar Hospital</b><br/><font size=7.5 color='#a5f3fc'>Diabetes Care & Multispeciality — Diabetes Dost</font>", ps("Hdr1", fontName="Helvetica-Bold", fontSize=11, textColor=colors.white)),
|
||||||
Paragraph(f"<b>Session:</b> {session_id}<br/><b>Generated:</b> {gen_at}", ps("Hdr2", fontName="Helvetica", fontSize=7.5, textColor=colors.HexColor("#cbd5e1"), alignment=TA_RIGHT)),
|
Paragraph(f"<b>Session:</b> {session_id}<br/><b>Generated:</b> {gen_at}", ps("Hdr2", fontName="Helvetica", fontSize=7.5, textColor=colors.HexColor("#cbd5e1"), alignment=TA_RIGHT)),
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
@@ -302,7 +302,7 @@ def generate_pdf(summary: Dict[str, Any]) -> bytes:
|
|||||||
story.append(Paragraph(
|
story.append(Paragraph(
|
||||||
"⚠️ DISCLAIMER: This is an AI-assisted pre-screening summary generated by Diabetes Dost. "
|
"⚠️ DISCLAIMER: This is an AI-assisted pre-screening summary generated by Diabetes Dost. "
|
||||||
"It is NOT a medical diagnosis. All findings must be reviewed and confirmed by a qualified physician. "
|
"It is NOT a medical diagnosis. All findings must be reviewed and confirmed by a qualified physician. "
|
||||||
"Chellaram Hospital — Diabetes Care & Multispeciality",
|
"Dinanath Mangeshkar Hospital — Diabetes Care & Multispeciality",
|
||||||
s_disclaimer
|
s_disclaimer
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|||||||
@@ -125,26 +125,26 @@ FOLLOWUP_TEMPLATES = {
|
|||||||
"label": "Follow-up अपॉइंटमेंट रिमाइंडर",
|
"label": "Follow-up अपॉइंटमेंट रिमाइंडर",
|
||||||
"icon": "📅",
|
"icon": "📅",
|
||||||
"mr": (
|
"mr": (
|
||||||
"🏥 *चेलाराम हॉस्पिटल (Chellaram Hospital) — Diabetes Dost*\n\n"
|
"🏥 *दीनानाथ मंगेशकर हॉस्पिटल (Dinanath Mangeshkar Hospital) — Diabetes Dost*\n\n"
|
||||||
"नमस्कार {name} जी! 🙏\n\n"
|
"नमस्कार {name} जी! 🙏\n\n"
|
||||||
"📅 *Follow-up भेटीची आठवण*\n\n"
|
"📅 *Follow-up भेटीची आठवण*\n\n"
|
||||||
"तुमची Diabetes Dost AI pre-screening झाली आहे.\n"
|
"तुमची Diabetes Dost AI pre-screening झाली आहे.\n"
|
||||||
"आता डॉक्टरांशी प्रत्यक्ष भेट घेणे महत्त्वाचे आहे!\n\n"
|
"आता डॉक्टरांशी प्रत्यक्ष भेट घेणे महत्त्वाचे आहे!\n\n"
|
||||||
"🏥 *Chellaram Hospital OPD — Diabetes & Endocrinology*\n"
|
"🏥 *Dinanath Mangeshkar Hospital OPD — Diabetes & Endocrinology*\n"
|
||||||
"📞 अपॉइंटमेंट बुक करा: 020-66839777\n"
|
"📞 अपॉइंटमेंट बुक करा: 020-66023000\n"
|
||||||
"🌐 ऑनलाईन: www.chellaramhospital.org\n\n"
|
"🌐 ऑनलाईन: www.dmhpune.org\n\n"
|
||||||
"Session ID: `{session_id}`\n\n"
|
"Session ID: `{session_id}`\n\n"
|
||||||
"⚕️ हा अहवाल डॉक्टरांना दाखवा."
|
"⚕️ हा अहवाल डॉक्टरांना दाखवा."
|
||||||
),
|
),
|
||||||
"hi": (
|
"hi": (
|
||||||
"🏥 *Chellaram Hospital — Diabetes Dost*\n\n"
|
"🏥 *Dinanath Mangeshkar Hospital — Diabetes Dost*\n\n"
|
||||||
"नमस्ते {name} जी! 🙏\n\n"
|
"नमस्ते {name} जी! 🙏\n\n"
|
||||||
"📅 *Follow-up अपॉइंटमेंट रिमाइंडर*\n\n"
|
"📅 *Follow-up अपॉइंटमेंट रिमाइंडर*\n\n"
|
||||||
"आपकी Diabetes Dost AI pre-screening हो गई है।\n"
|
"आपकी Diabetes Dost AI pre-screening हो गई है।\n"
|
||||||
"अब डॉक्टर से मिलना जरूरी है!\n\n"
|
"अब डॉक्टर से मिलना जरूरी है!\n\n"
|
||||||
"🏥 *Chellaram Hospital OPD — Diabetes & Endocrinology*\n"
|
"🏥 *Dinanath Mangeshkar Hospital OPD — Diabetes & Endocrinology*\n"
|
||||||
"📞 अपॉइंटमेंट: 020-66839777\n"
|
"📞 अपॉइंटमेंट: 020-66023000\n"
|
||||||
"🌐 Online: www.chellaramhospital.org\n\n"
|
"🌐 Online: www.dmhpune.org\n\n"
|
||||||
"Session ID: `{session_id}`\n\n"
|
"Session ID: `{session_id}`\n\n"
|
||||||
"⚕️ यह रिपोर्ट डॉक्टर को दिखाएं।"
|
"⚕️ यह रिपोर्ट डॉक्टर को दिखाएं।"
|
||||||
)
|
)
|
||||||
@@ -291,13 +291,13 @@ class WhatsAppDeliveryService:
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
message_body = (
|
message_body = (
|
||||||
f"🏥 *Chellaram Hospital — Diabetes Dost*\n\n"
|
f"🏥 *Dinanath Mangeshkar Hospital — Diabetes Dost*\n\n"
|
||||||
f"Hello {patient_name}! 🙏\n"
|
f"Hello {patient_name}! 🙏\n"
|
||||||
f"Your diabetes pre-screening report is ready.\n\n"
|
f"Your diabetes pre-screening report is ready.\n\n"
|
||||||
f"📄 *Download Report:*\n"
|
f"📄 *Download Report:*\n"
|
||||||
f"Session ID: `{session_id}`\n\n"
|
f"Session ID: `{session_id}`\n\n"
|
||||||
f"⚠️ This is an AI-assisted pre-screening. Please consult your doctor.\n"
|
f"⚠️ This is an AI-assisted pre-screening. Please consult your doctor.\n"
|
||||||
f"📞 Chellaram Helpline: 020-66839777"
|
f"📞 DMH Helpline: 020-66023000"
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.is_twilio_configured:
|
if self.is_twilio_configured:
|
||||||
@@ -418,7 +418,7 @@ class WhatsAppDeliveryService:
|
|||||||
pdf_block = f"\n📄 *Clinical PDF Report:* {pdf_url}" if pdf_url else ""
|
pdf_block = f"\n📄 *Clinical PDF Report:* {pdf_url}" if pdf_url else ""
|
||||||
|
|
||||||
msg = (
|
msg = (
|
||||||
f"🏥 *CHELLARAM HOSPITAL*\n"
|
f"🏥 *DINANATH MANGESHKAR HOSPITAL*\n"
|
||||||
f"🩺 *DIABETES DOST — PRE-SCREENING SUMMARY*\n"
|
f"🩺 *DIABETES DOST — PRE-SCREENING SUMMARY*\n"
|
||||||
f"━━━━━━━━━━━━━━━━━━━━━━━━\n"
|
f"━━━━━━━━━━━━━━━━━━━━━━━━\n"
|
||||||
f"👤 *Patient:* {p_name} | {p_age} yrs | {p_sex}\n"
|
f"👤 *Patient:* {p_name} | {p_age} yrs | {p_sex}\n"
|
||||||
@@ -434,7 +434,7 @@ class WhatsAppDeliveryService:
|
|||||||
f"📝 *Clinician Handover Note:*\n"
|
f"📝 *Clinician Handover Note:*\n"
|
||||||
f"{narrative}{pdf_block}\n\n"
|
f"{narrative}{pdf_block}\n\n"
|
||||||
f"━━━━━━━━━━━━━━━━━━━━━━━━\n"
|
f"━━━━━━━━━━━━━━━━━━━━━━━━\n"
|
||||||
f"⚕️ *Chellaram Hospital Clinical Triage Desk: 020-66839777*\n"
|
f"⚕️ *Dinanath Mangeshkar Hospital Clinical Triage Desk: 020-66023000*\n"
|
||||||
f"🔗 Full EHR Record available in Hospital Admin Portal"
|
f"🔗 Full EHR Record available in Hospital Admin Portal"
|
||||||
)
|
)
|
||||||
return msg
|
return msg
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 30 KiB |
@@ -112,7 +112,7 @@ class SummaryGenerator:
|
|||||||
try:
|
try:
|
||||||
with open(txt_rel_path, "w", encoding="utf-8") as f:
|
with open(txt_rel_path, "w", encoding="utf-8") as f:
|
||||||
f.write("======================================================================\n")
|
f.write("======================================================================\n")
|
||||||
f.write(" CHELLARAM HOSPITAL — CLINICAL TRIAGE REPORT\n")
|
f.write(" DINANATH MANGESHKAR HOSPITAL — CLINICAL TRIAGE REPORT\n")
|
||||||
f.write("======================================================================\n\n")
|
f.write("======================================================================\n\n")
|
||||||
f.write(f"Session ID: {session_state.session_id}\n")
|
f.write(f"Session ID: {session_state.session_id}\n")
|
||||||
f.write(f"Generated At: {structured_summary['generated_at']}\n")
|
f.write(f"Generated At: {structured_summary['generated_at']}\n")
|
||||||
@@ -265,8 +265,8 @@ class SummaryGenerator:
|
|||||||
f"पारिवारिक इतिहास (Family History): {'हाँ (पॉजिटिव)' if s.family_history is True else ('नहीं (नेगेटिव)' if s.family_history is False else 'अनिर्दिष्ट (Unspecified)')}",
|
f"पारिवारिक इतिहास (Family History): {'हाँ (पॉजिटिव)' if s.family_history is True else ('नहीं (नेगेटिव)' if s.family_history is False else 'अनिर्दिष्ट (Unspecified)')}",
|
||||||
f"गर्भावस्था इतिहास (Pregnancy History): {'हाँ (पॉजिटिव)' if preg is True else ('नहीं (नेगेटिव)' if preg is False else 'लागू नहीं / अनिर्दिष्ट')}{', जेस्टेशनल डायबिटीज: हाँ (पॉजिटिव)' if gest is True else (', जेस्टेशनल डायबिटीज: नहीं (नेगेटिव)' if gest is False else '')}",
|
f"गर्भावस्था इतिहास (Pregnancy History): {'हाँ (पॉजिटिव)' if preg is True else ('नहीं (नेगेटिव)' if preg is False else 'लागू नहीं / अनिर्दिष्ट')}{', जेस्टेशनल डायबिटीज: हाँ (पॉजिटिव)' if gest is True else (', जेस्टेशनल डायबिटीज: नहीं (नेगेटिव)' if gest is False else '')}",
|
||||||
f"पहचाने गए जोखिम संकेत (Risk Signals): {', '.join(s.risk_signals) if s.risk_signals else 'कोई गंभीर जोखिम संकेत नहीं मिला'}",
|
f"पहचाने गए जोखिम संकेत (Risk Signals): {', '.join(s.risk_signals) if s.risk_signals else 'कोई गंभीर जोखिम संकेत नहीं मिला'}",
|
||||||
f"क्लिनिकल अर्जेंसी (Chellaram Hospital Triage): {s.recommended_urgency.upper()}{idrs_info} ({', '.join(s.urgency_reasons)})",
|
f"क्लिनिकल अर्जेंसी (Dinanath Mangeshkar Hospital Triage): {s.recommended_urgency.upper()}{idrs_info} ({', '.join(s.urgency_reasons)})",
|
||||||
"क्लीनिकल राय व मार्गदर्शन: नियमित फास्टिंग/PP शुगर जांच एवं त्रैमासिक HbA1c टेस्ट कराने की सलाह। Chellaram Hospital विशेषज्ञ डॉक्टर से परामर्श अनुशंसित।",
|
"क्लीनिकल राय व मार्गदर्शन: नियमित फास्टिंग/PP शुगर जांच एवं त्रैमासिक HbA1c टेस्ट कराने की सलाह। Dinanath Mangeshkar Hospital विशेषज्ञ डॉक्टर से परामर्श अनुशंसित।",
|
||||||
"नोट: यह केवल AI प्री-स्क्रीनिंग सारांश है, यह कोई मेडिकल डायग्नोसिस नहीं है। चिकित्सक द्वारा जांच आवश्यक है।"
|
"नोट: यह केवल AI प्री-स्क्रीनिंग सारांश है, यह कोई मेडिकल डायग्नोसिस नहीं है। चिकित्सक द्वारा जांच आवश्यक है।"
|
||||||
]
|
]
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
@@ -296,7 +296,7 @@ class SummaryGenerator:
|
|||||||
f"गरोदरपणाचा इतिहास: {'होय (Positive)' if preg is True else ('नाही (Negative)' if preg is False else 'लागू नाही')}{', गरोदरपणातील मधुमेह: होय' if gest is True else ''}",
|
f"गरोदरपणाचा इतिहास: {'होय (Positive)' if preg is True else ('नाही (Negative)' if preg is False else 'लागू नाही')}{', गरोदरपणातील मधुमेह: होय' if gest is True else ''}",
|
||||||
f"संभाव्य जोखीम घटक: {', '.join(s.risk_signals) if s.risk_signals else 'कोणतेही गंभीर धोक्याचे संकेत नाहीत'}",
|
f"संभाव्य जोखीम घटक: {', '.join(s.risk_signals) if s.risk_signals else 'कोणतेही गंभीर धोक्याचे संकेत नाहीत'}",
|
||||||
f"क्लिनिकल वर्गवारी / प्राधान्य (Triage): {s.recommended_urgency.upper()} ({', '.join(s.urgency_reasons)})",
|
f"क्लिनिकल वर्गवारी / प्राधान्य (Triage): {s.recommended_urgency.upper()} ({', '.join(s.urgency_reasons)})",
|
||||||
"वैद्यकीय सल्ला: नियमित फास्टिंग/PPBS व तीन महिन्यांची HbA1c तपासणी करून घेणे. चेलाराम हॉस्पिटल (Chellaram Hospital) तज्ज्ञ डॉक्टरांचा सल्ला घेणे.",
|
"वैद्यकीय सल्ला: नियमित फास्टिंग/PPBS व तीन महिन्यांची HbA1c तपासणी करून घेणे. दीनानाथ मंगेशकर हॉस्पिटल (Dinanath Mangeshkar Hospital) तज्ज्ञ डॉक्टरांचा सल्ला घेणे.",
|
||||||
"टीप: हा केवळ AI पूर्व-तपासणी सारांश आहे. प्रत्यक्ष वैद्यकीय तपासणी आवश्यक आहे."
|
"टीप: हा केवळ AI पूर्व-तपासणी सारांश आहे. प्रत्यक्ष वैद्यकीय तपासणी आवश्यक आहे."
|
||||||
]
|
]
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
@@ -327,7 +327,7 @@ class SummaryGenerator:
|
|||||||
f"Risk Signals Identified: {', '.join(s.risk_signals) if s.risk_signals else 'None'}",
|
f"Risk Signals Identified: {', '.join(s.risk_signals) if s.risk_signals else 'None'}",
|
||||||
f"Emergency Escalation: {'YES - IMMEDIATE CARE REQUIRED' if s.emergency_escalation else 'NO'}",
|
f"Emergency Escalation: {'YES - IMMEDIATE CARE REQUIRED' if s.emergency_escalation else 'NO'}",
|
||||||
f"Recommended Clinician Urgency: {s.recommended_urgency.upper()} (Rationale: {', '.join(s.urgency_reasons)})",
|
f"Recommended Clinician Urgency: {s.recommended_urgency.upper()} (Rationale: {', '.join(s.urgency_reasons)})",
|
||||||
"Clinical Impression: Pre-screening completed. Recommend comprehensive metabolic panel (FBS/PPBS, HbA1c) and clinician consultation at Chellaram Hospital.",
|
"Clinical Impression: Pre-screening completed. Recommend comprehensive metabolic panel (FBS/PPBS, HbA1c) and clinician consultation at Dinanath Mangeshkar Hospital.",
|
||||||
"Disclaimer: AI-generated pre-screening summary for human physician review. Not a diagnostic decision."
|
"Disclaimer: AI-generated pre-screening summary for human physician review. Not a diagnostic decision."
|
||||||
]
|
]
|
||||||
return "\n".join(lines)
|
return "\n".join(lines)
|
||||||
|
|||||||
@@ -4,16 +4,16 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Chellaram Hospital — Admin Consultations Portal</title>
|
<title>Dinanath Mangeshkar Hospital — Admin Consultations Portal</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap"
|
href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Outfit:wght@500;600;700;800&display=swap"
|
||||||
rel="stylesheet">
|
rel="stylesheet">
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
<link rel="icon" type="image/png" sizes="32x32" href="/static/dmh_logo.png?v=dmh">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
<link rel="icon" type="image/png" sizes="16x16" href="/static/dmh_logo.png?v=dmh">
|
||||||
<link rel="shortcut icon" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
<link rel="shortcut icon" href="/static/dmh_logo.png?v=dmh">
|
||||||
<link rel="apple-touch-icon" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
<link rel="apple-touch-icon" href="/static/dmh_logo.png?v=dmh">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
:root {
|
:root {
|
||||||
@@ -807,9 +807,9 @@
|
|||||||
LOGIN VIEW
|
LOGIN VIEW
|
||||||
========================================== -->
|
========================================== -->
|
||||||
<div id="login-view" class="login-container" style="display: none;">
|
<div id="login-view" class="login-container" style="display: none;">
|
||||||
<img src="/static/chellaram_hospital_logo.png?v=chellaram" alt="Chellaram Hospital"
|
<img src="/static/dmh_logo.png?v=dmh" alt="Dinanath Mangeshkar Hospital"
|
||||||
style="height: 60px; width: auto; max-width: 230px; border-radius: 12px; object-fit: contain; margin: 0 auto 14px auto; display: block; box-shadow: 0 4px 14px rgba(14, 165, 168, 0.2); border: 1px solid rgba(14, 165, 168, 0.2); background: #ffffff; padding: 4px 12px;">
|
style="height: 60px; width: auto; max-width: 230px; border-radius: 12px; object-fit: contain; margin: 0 auto 14px auto; display: block; box-shadow: 0 4px 14px rgba(14, 165, 168, 0.2); border: 1px solid rgba(14, 165, 168, 0.2); background: #ffffff; padding: 4px 12px;">
|
||||||
<h2>Chellaram Hospital Admin</h2>
|
<h2>Dinanath Mangeshkar Hospital Admin</h2>
|
||||||
<p>Sign in to review clinical voice consultations & patient triage reports</p>
|
<p>Sign in to review clinical voice consultations & patient triage reports</p>
|
||||||
|
|
||||||
<div id="login-error" class="login-error-msg"></div>
|
<div id="login-error" class="login-error-msg"></div>
|
||||||
@@ -841,10 +841,10 @@
|
|||||||
<!-- Top Header -->
|
<!-- Top Header -->
|
||||||
<header class="admin-header">
|
<header class="admin-header">
|
||||||
<a href="/" class="brand-wrap">
|
<a href="/" class="brand-wrap">
|
||||||
<img src="/static/chellaram_hospital_logo.png?v=chellaram" alt="Chellaram Hospital"
|
<img src="/static/dmh_logo.png?v=dmh" alt="Dinanath Mangeshkar Hospital"
|
||||||
style="height: 42px; width: auto; max-width: 170px; border-radius: 8px; object-fit: contain; box-shadow: 0 2px 8px rgba(14, 165, 168, 0.2); background: #ffffff; padding: 2px 6px;">
|
style="height: 42px; width: auto; max-width: 170px; border-radius: 8px; object-fit: contain; box-shadow: 0 2px 8px rgba(14, 165, 168, 0.2); background: #ffffff; padding: 2px 6px;">
|
||||||
<div class="brand-text">
|
<div class="brand-text">
|
||||||
<h1>Chellaram Hospital — Admin Portal</h1>
|
<h1>Dinanath Mangeshkar Hospital — Admin Portal</h1>
|
||||||
<p>Consultation Records & Clinical Triage Database</p>
|
<p>Consultation Records & Clinical Triage Database</p>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Chellaram Hospital — Diabetes Dost 🩺</title>
|
<title>Dinanath Mangeshkar Hospital — Diabetes Dost 🩺</title>
|
||||||
<link rel="icon" type="image/png" sizes="32x32" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
<link rel="icon" type="image/png" sizes="32x32" href="/static/dmh_logo.png?v=dmh">
|
||||||
<link rel="icon" type="image/png" sizes="16x16" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
<link rel="icon" type="image/png" sizes="16x16" href="/static/dmh_logo.png?v=dmh">
|
||||||
<link rel="shortcut icon" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
<link rel="shortcut icon" href="/static/dmh_logo.png?v=dmh">
|
||||||
<link rel="apple-touch-icon" href="/static/chellaram_hospital_logo.png?v=chellaram">
|
<link rel="apple-touch-icon" href="/static/dmh_logo.png?v=dmh">
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
<link
|
<link
|
||||||
@@ -1114,6 +1114,28 @@
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-pill-action.send-speech-active {
|
||||||
|
background: #10b981;
|
||||||
|
border-color: #059669;
|
||||||
|
color: #ffffff;
|
||||||
|
font-weight: 700;
|
||||||
|
box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
|
||||||
|
transition: all 0.2s ease;
|
||||||
|
animation: pulseGreen 1.8s infinite ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn-pill-action.send-speech-active:hover {
|
||||||
|
background: #059669;
|
||||||
|
color: #ffffff;
|
||||||
|
transform: translateY(-1px);
|
||||||
|
box-shadow: 0 4px 14px rgba(5, 150, 105, 0.45);
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes pulseGreen {
|
||||||
|
0%, 100% { box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35); }
|
||||||
|
50% { box-shadow: 0 4px 18px rgba(16, 185, 129, 0.6); }
|
||||||
|
}
|
||||||
|
|
||||||
/* Bottom 3 Feature Cards & Tagline */
|
/* Bottom 3 Feature Cards & Tagline */
|
||||||
.bottom-features-section {
|
.bottom-features-section {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -2242,9 +2264,9 @@
|
|||||||
======================================================== -->
|
======================================================== -->
|
||||||
<header class="main-header">
|
<header class="main-header">
|
||||||
<div class="header-left">
|
<div class="header-left">
|
||||||
<img src="/static/chellaram_hospital_logo.png?v=chellaram" alt="Chellaram Hospital Logo" class="brand-logo-img">
|
<img src="/static/dmh_logo.png?v=dmh" alt="Dinanath Mangeshkar Hospital Logo" class="brand-logo-img">
|
||||||
<div class="brand-titles">
|
<div class="brand-titles">
|
||||||
<h1>Chellaram Hospital</h1>
|
<h1>Dinanath Mangeshkar Hospital</h1>
|
||||||
<p>Diabetes Dost — Care Companion</p>
|
<p>Diabetes Dost — Care Companion</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2491,6 +2513,10 @@
|
|||||||
<button class="btn-pill-action pause-active" id="btn-pause-resume" onclick="togglePauseMic()">
|
<button class="btn-pill-action pause-active" id="btn-pause-resume" onclick="togglePauseMic()">
|
||||||
<span>⏸️</span> Pause
|
<span>⏸️</span> Pause
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<button class="btn-pill-action send-speech-active" id="btn-send-speech" onclick="manualSubmitSpeech()" style="display: none;" title="पूर्ण झाले? उत्तर पाठवा / Send Answer">
|
||||||
|
<span>✅</span> उत्तर पाठवा (Send)
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Chat Messages Scroll Container -->
|
<!-- Chat Messages Scroll Container -->
|
||||||
@@ -2687,9 +2713,13 @@
|
|||||||
let recognition = null;
|
let recognition = null;
|
||||||
let currentSttLang = 'hi-IN';
|
let currentSttLang = 'hi-IN';
|
||||||
let silenceTimer = null;
|
let silenceTimer = null;
|
||||||
|
let pauseFeedbackTimer = null;
|
||||||
let speechWatchdogInterval = null;
|
let speechWatchdogInterval = null;
|
||||||
let speechSafetyTimeout = null;
|
let speechSafetyTimeout = null;
|
||||||
let currentAccumulatedSpeech = '';
|
let currentAccumulatedSpeech = '';
|
||||||
|
let confirmedSpeechHistory = '';
|
||||||
|
let currentSessionTranscript = '';
|
||||||
|
let naturalPauseWaitMs = 4500; // 4.5 seconds generous pause tolerance for natural speech
|
||||||
let currentLivePatientRow = null;
|
let currentLivePatientRow = null;
|
||||||
let lastBotPromptText = 'ही तहान तुम्हाला किती दिवसांपासून जाणवते?';
|
let lastBotPromptText = 'ही तहान तुम्हाला किती दिवसांपासून जाणवते?';
|
||||||
let lastBotAudioUrl = null;
|
let lastBotAudioUrl = null;
|
||||||
@@ -2739,6 +2769,10 @@
|
|||||||
if (recognition) {
|
if (recognition) {
|
||||||
recognition.lang = currentSttLang;
|
recognition.lang = currentSttLang;
|
||||||
}
|
}
|
||||||
|
const sendBtn = document.getElementById('btn-send-speech');
|
||||||
|
if (sendBtn) {
|
||||||
|
sendBtn.innerHTML = currentSttLang === 'mr-IN' ? '<span>✅</span> उत्तर पाठवा' : '<span>✅</span> भेजें (Send)';
|
||||||
|
}
|
||||||
setupVoices();
|
setupVoices();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2854,6 +2888,26 @@
|
|||||||
.trim();
|
.trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function resetSpeechAccumulator() {
|
||||||
|
if (silenceTimer) { clearTimeout(silenceTimer); silenceTimer = null; }
|
||||||
|
if (pauseFeedbackTimer) { clearTimeout(pauseFeedbackTimer); pauseFeedbackTimer = null; }
|
||||||
|
confirmedSpeechHistory = '';
|
||||||
|
currentSessionTranscript = '';
|
||||||
|
currentAccumulatedSpeech = '';
|
||||||
|
const sendBtn = document.getElementById('btn-send-speech');
|
||||||
|
if (sendBtn) sendBtn.style.display = 'none';
|
||||||
|
}
|
||||||
|
|
||||||
|
function manualSubmitSpeech() {
|
||||||
|
if (isBotSpeaking || isConversationStopped) return;
|
||||||
|
const textToSend = (currentAccumulatedSpeech || '').trim();
|
||||||
|
if (textToSend) {
|
||||||
|
resetSpeechAccumulator();
|
||||||
|
stopListening();
|
||||||
|
sendVoiceTurn(textToSend);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function initSpeechRecognition() {
|
function initSpeechRecognition() {
|
||||||
if (!('webkitSpeechRecognition' in window) && !('SpeechRecognition' in window)) return;
|
if (!('webkitSpeechRecognition' in window) && !('SpeechRecognition' in window)) return;
|
||||||
const SpeechRec = window.SpeechRecognition || window.webkitSpeechRecognition;
|
const SpeechRec = window.SpeechRecognition || window.webkitSpeechRecognition;
|
||||||
@@ -2883,37 +2937,72 @@
|
|||||||
stopAnyBotSpeech();
|
stopAnyBotSpeech();
|
||||||
}
|
}
|
||||||
|
|
||||||
let sessionTranscript = '';
|
// Reset pause timers because the patient is actively speaking
|
||||||
|
if (silenceTimer) { clearTimeout(silenceTimer); silenceTimer = null; }
|
||||||
|
if (pauseFeedbackTimer) { clearTimeout(pauseFeedbackTimer); pauseFeedbackTimer = null; }
|
||||||
|
|
||||||
|
let sessionFinal = '';
|
||||||
|
let sessionInterim = '';
|
||||||
for (let i = 0; i < event.results.length; ++i) {
|
for (let i = 0; i < event.results.length; ++i) {
|
||||||
if (event.results[i] && event.results[i][0]) {
|
const res = event.results[i];
|
||||||
sessionTranscript += event.results[i][0].transcript + ' ';
|
if (res && res[0]) {
|
||||||
|
if (res.isFinal) {
|
||||||
|
sessionFinal += res[0].transcript + ' ';
|
||||||
|
} else {
|
||||||
|
sessionInterim += res[0].transcript + ' ';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const rawCombined = (currentAccumulatedSpeech + ' ' + sessionTranscript).trim();
|
currentSessionTranscript = (sessionFinal + ' ' + sessionInterim).trim();
|
||||||
const cleanDisplay = cleanSpokenTranscript(rawCombined);
|
|
||||||
|
// Overall speech integrates previously accumulated sentences across pauses + current segment
|
||||||
|
const combinedSpeech = cleanSpokenTranscript((confirmedSpeechHistory + ' ' + currentSessionTranscript).trim());
|
||||||
|
|
||||||
|
if (combinedSpeech) {
|
||||||
|
currentAccumulatedSpeech = combinedSpeech;
|
||||||
|
updatePatientLiveBubble(combinedSpeech);
|
||||||
|
|
||||||
if (cleanDisplay) {
|
|
||||||
updatePatientLiveBubble(cleanDisplay);
|
|
||||||
const lbl = document.getElementById('orb-dock-status');
|
const lbl = document.getElementById('orb-dock-status');
|
||||||
const sub = document.getElementById('orb-dock-subtext');
|
const sub = document.getElementById('orb-dock-subtext');
|
||||||
if (lbl) lbl.textContent = '👂 Listening carefully...';
|
const sendBtn = document.getElementById('btn-send-speech');
|
||||||
|
|
||||||
|
if (lbl) {
|
||||||
|
lbl.textContent = currentSttLang === 'mr-IN'
|
||||||
|
? '👂 ऐकतोय... (बोलत राहा)'
|
||||||
|
: '👂 सुन रहे हैं... (बोलते रहिए)';
|
||||||
|
}
|
||||||
if (sub) {
|
if (sub) {
|
||||||
sub.textContent = '🗣️ "' + cleanDisplay + '" (Speak at your own pace...)';
|
sub.textContent = '🗣️ "' + combinedSpeech + '"';
|
||||||
sub.style.color = '#38bdf8';
|
sub.style.color = '#38bdf8';
|
||||||
sub.style.fontWeight = '600';
|
sub.style.fontWeight = '600';
|
||||||
}
|
}
|
||||||
if (silenceTimer) clearTimeout(silenceTimer);
|
if (sendBtn) {
|
||||||
|
sendBtn.style.display = 'inline-flex';
|
||||||
|
sendBtn.title = currentSttLang === 'mr-IN' ? 'पूर्ण झाले? उत्तर पाठवा' : 'हो गया? उत्तर भेजें';
|
||||||
|
sendBtn.innerHTML = currentSttLang === 'mr-IN' ? '<span>✅</span> उत्तर पाठवा' : '<span>✅</span> भेजें (Send)';
|
||||||
|
}
|
||||||
|
|
||||||
// Generous natural pause (2500ms): ensures patient finishes full multi-phrase sentence without punctuation truncation
|
// Gentle pause indicator: after 1.5s of natural pause, reassure user they have plenty of time
|
||||||
|
pauseFeedbackTimer = setTimeout(() => {
|
||||||
|
if (isBotSpeaking || isMicPaused || isConversationStopped) return;
|
||||||
|
if (lbl) {
|
||||||
|
lbl.textContent = currentSttLang === 'mr-IN'
|
||||||
|
? '⏳ वेळ घ्या, ऐकतोय... (किंवा Send दाबा)'
|
||||||
|
: '⏳ समय लीजिए, सुन रहे हैं... (या Send दबाएं)';
|
||||||
|
}
|
||||||
|
}, 1500);
|
||||||
|
|
||||||
|
// Generous natural pause (4.5s): captures multi-phrase speech even if patient pauses to think or breathe
|
||||||
silenceTimer = setTimeout(() => {
|
silenceTimer = setTimeout(() => {
|
||||||
if (isBotSpeaking || isMicPaused || isConversationStopped) return;
|
if (isBotSpeaking || isMicPaused || isConversationStopped) return;
|
||||||
if (cleanDisplay) {
|
if (currentAccumulatedSpeech) {
|
||||||
currentAccumulatedSpeech = '';
|
const finalSpeech = currentAccumulatedSpeech;
|
||||||
|
resetSpeechAccumulator();
|
||||||
stopListening();
|
stopListening();
|
||||||
sendVoiceTurn(cleanDisplay);
|
sendVoiceTurn(finalSpeech);
|
||||||
}
|
}
|
||||||
}, 2500);
|
}, naturalPauseWaitMs);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -2925,10 +3014,19 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
recognition.onend = function () {
|
recognition.onend = function () {
|
||||||
|
// If recognition was ended by browser on silence/pause while listening is still active:
|
||||||
if (isListeningActive && !isMicPaused && !isConversationStopped && !isBotSpeaking) {
|
if (isListeningActive && !isMicPaused && !isConversationStopped && !isBotSpeaking) {
|
||||||
|
// Consolidate currentSessionTranscript into confirmedSpeechHistory so NOTHING is lost
|
||||||
|
if (currentSessionTranscript) {
|
||||||
|
confirmedSpeechHistory = cleanSpokenTranscript((confirmedSpeechHistory + ' ' + currentSessionTranscript).trim());
|
||||||
|
currentSessionTranscript = '';
|
||||||
|
}
|
||||||
|
// Seamlessly restart recognition so patient can resume speaking without losing earlier words
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
if (isListeningActive && !isMicPaused && !isConversationStopped && !isBotSpeaking) {
|
||||||
try { recognition.start(); } catch (e) { }
|
try { recognition.start(); } catch (e) { }
|
||||||
}, 100);
|
}
|
||||||
|
}, 50);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
@@ -2938,8 +3036,7 @@
|
|||||||
|
|
||||||
async function startListening() {
|
async function startListening() {
|
||||||
if (isBotSpeaking || isMicPaused || isConversationStopped) return;
|
if (isBotSpeaking || isMicPaused || isConversationStopped) return;
|
||||||
if (silenceTimer) clearTimeout(silenceTimer);
|
resetSpeechAccumulator();
|
||||||
currentAccumulatedSpeech = '';
|
|
||||||
currentLivePatientRow = null;
|
currentLivePatientRow = null;
|
||||||
|
|
||||||
await requestMicPermission();
|
await requestMicPermission();
|
||||||
@@ -2963,10 +3060,13 @@
|
|||||||
|
|
||||||
function stopListening() {
|
function stopListening() {
|
||||||
isListeningActive = false;
|
isListeningActive = false;
|
||||||
if (silenceTimer) clearTimeout(silenceTimer);
|
if (silenceTimer) { clearTimeout(silenceTimer); silenceTimer = null; }
|
||||||
|
if (pauseFeedbackTimer) { clearTimeout(pauseFeedbackTimer); pauseFeedbackTimer = null; }
|
||||||
if (recognition) {
|
if (recognition) {
|
||||||
try { recognition.abort(); } catch (e) { }
|
try { recognition.abort(); } catch (e) { }
|
||||||
}
|
}
|
||||||
|
const sendBtn = document.getElementById('btn-send-speech');
|
||||||
|
if (sendBtn) sendBtn.style.display = 'none';
|
||||||
updateOrbUI(isMicPaused ? 'paused' : 'idle');
|
updateOrbUI(isMicPaused ? 'paused' : 'idle');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2979,11 +3079,9 @@
|
|||||||
initiateVoiceSessionWithUserGesture();
|
initiateVoiceSessionWithUserGesture();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// If user has spoken something and clicks the orb, immediately send their full answer!
|
||||||
if (isListeningActive && currentAccumulatedSpeech.trim()) {
|
if (isListeningActive && currentAccumulatedSpeech.trim()) {
|
||||||
const fullText = currentAccumulatedSpeech.trim();
|
manualSubmitSpeech();
|
||||||
currentAccumulatedSpeech = '';
|
|
||||||
stopListening();
|
|
||||||
sendVoiceTurn(fullText);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
togglePauseMic();
|
togglePauseMic();
|
||||||
@@ -4321,7 +4419,7 @@
|
|||||||
<div>
|
<div>
|
||||||
<div
|
<div
|
||||||
style="font-size:0.68rem; font-weight:800; color:#0b8082; text-transform:uppercase; letter-spacing:0.5px;">
|
style="font-size:0.68rem; font-weight:800; color:#0b8082; text-transform:uppercase; letter-spacing:0.5px;">
|
||||||
🏥 Chellaram Hospital
|
🏥 Dinanath Mangeshkar Hospital
|
||||||
</div>
|
</div>
|
||||||
<h3
|
<h3
|
||||||
style="font-family:'Outfit',sans-serif; font-size:1.18rem; font-weight:800; color:#0f172a; margin:2px 0 0 0;">
|
style="font-family:'Outfit',sans-serif; font-size:1.18rem; font-weight:800; color:#0f172a; margin:2px 0 0 0;">
|
||||||
@@ -4426,10 +4524,10 @@
|
|||||||
onclick="if(event.target.id === 'admin-login-modal') closeAdminLoginModal()">
|
onclick="if(event.target.id === 'admin-login-modal') closeAdminLoginModal()">
|
||||||
<div
|
<div
|
||||||
style="background: #ffffff; border-radius: 16px; padding: 28px 24px; max-width: 400px; width: 100%; box-shadow: var(--shadow-lg); text-align: center; border: 1px solid var(--card-border);">
|
style="background: #ffffff; border-radius: 16px; padding: 28px 24px; max-width: 400px; width: 100%; box-shadow: var(--shadow-lg); text-align: center; border: 1px solid var(--card-border);">
|
||||||
<img src="/static/chellaram_hospital_logo.png?v=chellaram" alt="Chellaram Hospital"
|
<img src="/static/dmh_logo.png?v=dmh" alt="Dinanath Mangeshkar Hospital"
|
||||||
style="height: 54px; width: auto; max-width: 220px; border-radius: 12px; object-fit: contain; margin: 0 auto 12px auto; display: block; box-shadow: 0 4px 12px rgba(14, 165, 168, 0.2); border: 1px solid rgba(14, 165, 168, 0.2); background: #ffffff; padding: 4px 10px;">
|
style="height: 54px; width: auto; max-width: 220px; border-radius: 12px; object-fit: contain; margin: 0 auto 12px auto; display: block; box-shadow: 0 4px 12px rgba(14, 165, 168, 0.2); border: 1px solid rgba(14, 165, 168, 0.2); background: #ffffff; padding: 4px 10px;">
|
||||||
<h3 style="font-family: 'Outfit', sans-serif; font-size: 1.25rem; font-weight: 800; color: var(--blue-navy);">
|
<h3 style="font-family: 'Outfit', sans-serif; font-size: 1.25rem; font-weight: 800; color: var(--blue-navy);">
|
||||||
Chellaram Hospital Admin
|
Dinanath Mangeshkar Hospital Admin
|
||||||
</h3>
|
</h3>
|
||||||
<p style="font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; margin-bottom: 18px;">
|
<p style="font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; margin-bottom: 18px;">
|
||||||
Sign in to view all patient consultations & SQLite records
|
Sign in to view all patient consultations & SQLite records
|
||||||
|
|||||||
@@ -42,8 +42,8 @@ def clean_text_for_speech_audio(text: str) -> str:
|
|||||||
t = re.sub(r"\bFBS\b", " फास्टिंग ब्लड शुगर ", t, flags=re.IGNORECASE)
|
t = re.sub(r"\bFBS\b", " फास्टिंग ब्लड शुगर ", t, flags=re.IGNORECASE)
|
||||||
t = re.sub(r"\bPPBS\b", " पीपी ब्लड शुगर ", t, flags=re.IGNORECASE)
|
t = re.sub(r"\bPPBS\b", " पीपी ब्लड शुगर ", t, flags=re.IGNORECASE)
|
||||||
t = re.sub(r"\bBP\b", " ब्लड प्रेशर ", t, flags=re.IGNORECASE)
|
t = re.sub(r"\bBP\b", " ब्लड प्रेशर ", t, flags=re.IGNORECASE)
|
||||||
t = re.sub(r"\b(Chellaram Hospital Pune|Chellaram Hospital|Chellaram Pune|Chellaram)\b", " चेलाराम हॉस्पिटल ", t, flags=re.IGNORECASE)
|
t = re.sub(r"\b(Dinanath Mangeshkar Hospital Pune|Dinanath Mangeshkar Hospital|Deenanath Mangeshkar Hospital|Dinanath Hospital|DMH Hospital|DMH Pune|DMH|Chellaram Hospital Pune|Chellaram Hospital|Chellaram Pune|Chellaram)\b", " दीनानाथ मंगेशकर हॉस्पिटल ", t, flags=re.IGNORECASE)
|
||||||
t = re.sub(r"\b(KEM Hospital Pune|KEM Hospital|KEM Pune|KEM|Ruby Hospital|Ruby Hall Clinic|Ruby Hall|Deenanath Mangeshkar Hospital|Poona Hospital)\b", " चेलाराम हॉस्पिटल ", t, flags=re.IGNORECASE)
|
t = re.sub(r"\b(KEM Hospital Pune|KEM Hospital|KEM Pune|KEM|Ruby Hospital|Ruby Hall Clinic|Ruby Hall|Poona Hospital)\b", " दीनानाथ मंगेशकर हॉस्पिटल ", t, flags=re.IGNORECASE)
|
||||||
t = re.sub(r"\bMetformin\b", " मेटफॉर्मिन ", t, flags=re.IGNORECASE)
|
t = re.sub(r"\bMetformin\b", " मेटफॉर्मिन ", t, flags=re.IGNORECASE)
|
||||||
t = re.sub(r"\bInsulin\b", " इंसुलिन ", t, flags=re.IGNORECASE)
|
t = re.sub(r"\bInsulin\b", " इंसुलिन ", t, flags=re.IGNORECASE)
|
||||||
t = re.sub(r"\bParacetamol\b", " पैरासिटामोल ", t, flags=re.IGNORECASE)
|
t = re.sub(r"\bParacetamol\b", " पैरासिटामोल ", t, flags=re.IGNORECASE)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
"categories": {
|
"categories": {
|
||||||
"loss_of_consciousness": {
|
"loss_of_consciousness": {
|
||||||
"severity": "critical",
|
"severity": "critical",
|
||||||
"action_hi": "बेहोशी, चक्कर खाकर गिरना या चेतना खोना तुरंत चिकित्सकीय ध्यान की मांग करता है। कृपया तत्काल Chellaram Hospital इमरजेंसी या 112/108 एम्बुलेंस को कॉल करें।",
|
"action_hi": "बेहोशी, चक्कर खाकर गिरना या चेतना खोना तुरंत चिकित्सकीय ध्यान की मांग करता है। कृपया तत्काल Dinanath Mangeshkar Hospital इमरजेंसी या 112/108 एम्बुलेंस को कॉल करें।",
|
||||||
"keywords_devanagari": [
|
"keywords_devanagari": [
|
||||||
"बेहोश", "बेहोशी", "बेहोश हो गया", "चक्कर खाकर गिर गया", "होश खो बैठा", "आंखों के आगे अंधेरा छा गया", "अचेत", "मूर्छित", "होश में नहीं", "बेसुध"
|
"बेहोश", "बेहोशी", "बेहोश हो गया", "चक्कर खाकर गिर गया", "होश खो बैठा", "आंखों के आगे अंधेरा छा गया", "अचेत", "मूर्छित", "होश में नहीं", "बेसुध"
|
||||||
],
|
],
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
},
|
},
|
||||||
"chest_pain": {
|
"chest_pain": {
|
||||||
"severity": "critical",
|
"severity": "critical",
|
||||||
"action_hi": "सीने या दिल में तेज दर्द, दबाव या हार्ट अटैक के लक्षण एक अति-गंभीर मेडिकल इमरजेंसी हैं। कृपया तुरंत Chellaram Hospital के इमरजेंसी विभाग में जाएँ।",
|
"action_hi": "सीने या दिल में तेज दर्द, दबाव या हार्ट अटैक के लक्षण एक अति-गंभीर मेडिकल इमरजेंसी हैं। कृपया तुरंत Dinanath Mangeshkar Hospital के इमरजेंसी विभाग में जाएँ।",
|
||||||
"keywords_devanagari": [
|
"keywords_devanagari": [
|
||||||
"सीने में दर्द", "छाती में दर्द", "छाती में बहुत तेज दर्द", "दिल का दौरा", "हार्ट अटैक",
|
"सीने में दर्द", "छाती में दर्द", "छाती में बहुत तेज दर्द", "दिल का दौरा", "हार्ट अटैक",
|
||||||
"सीने में भारीपन", "सीने में दबाव", "दिल में दर्द", "छाती दब रही है", "छाती में जकड़न"
|
"सीने में भारीपन", "सीने में दबाव", "दिल में दर्द", "छाती दब रही है", "छाती में जकड़न"
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 30 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 30 KiB |