Update app.py
Browse files
app.py
CHANGED
|
@@ -657,71 +657,249 @@ Please consult a dermatologist for accurate diagnosis and treatment.</em>
|
|
| 657 |
top_class = next(iter(class_probs))
|
| 658 |
top_confidence = class_probs[top_class]
|
| 659 |
|
| 660 |
-
# Get disease information from database
|
| 661 |
-
disease_info =
|
| 662 |
|
| 663 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 664 |
if disease_info is None:
|
| 665 |
-
|
| 666 |
-
|
| 667 |
-
"severity": self._estimate_severity(top_class),
|
| 668 |
-
"description_ko": f"{top_class}λ νΌλΆ μ§νμ ν μ’
λ₯λ‘, μ λ¬Έμ μ§λ¨μ΄ νμν©λλ€.",
|
| 669 |
-
"treatment_ko": "μ νν μ§λ¨μ μν΄ νΌλΆκ³Ό μ λ¬Έμμ μλ΄νμκΈ° λ°λλλ€."
|
| 670 |
-
}
|
| 671 |
|
| 672 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 673 |
analysis = f"""
|
| 674 |
<div class="diagnosis-card">
|
| 675 |
<h3>π€ GPT-OSS μμΈ λΆμ / GPT-OSS Detailed Analysis</h3>
|
| 676 |
|
| 677 |
<div class="info-box">
|
| 678 |
-
<h4
|
| 679 |
-
<p><strong>μ§νλͺ
/ Disease:</strong> {top_class.title()} ({disease_info
|
| 680 |
<p><strong>μ λ’°λ / Confidence:</strong> {top_confidence:.1%}</p>
|
| 681 |
-
<p><strong
|
| 682 |
</div>
|
| 683 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
<div class="result-container">
|
| 685 |
<h4>π κΆμ₯ μΉλ£λ² / Recommended Treatment</h4>
|
| 686 |
-
<p
|
|
|
|
| 687 |
</div>
|
| 688 |
|
| 689 |
<div class="result-container">
|
| 690 |
<h4>π μν κ΄λ¦¬ μ§μΉ¨ / Lifestyle Management Guidelines</h4>
|
| 691 |
-
|
| 692 |
-
<li>μΆ©λΆν μλΆ μμ·¨μ λ³΄μ΅ μ μ§ / Maintain adequate hydration and moisturization</li>
|
| 693 |
-
<li>μκ·Ήμ μΈ νμ₯ν μ¬μ© μμ / Avoid irritating cosmetics</li>
|
| 694 |
-
<li>κ·μΉμ μΈ μλ©΄κ³Ό μ€νΈλ μ€ κ΄λ¦¬ / Regular sleep and stress management</li>
|
| 695 |
-
<li>κ· ν μ‘ν μλ¨ μ μ§ / Maintain a balanced diet</li>
|
| 696 |
-
<li>μ μ ν μμΈμ μ°¨λ¨ / Adequate sun protection</li>
|
| 697 |
-
</ul>
|
| 698 |
</div>
|
| 699 |
|
| 700 |
<div class="result-container">
|
| 701 |
<h4>π₯ μλ£μ§ μλ΄ νμ μμ / When to Consult Healthcare Provider</h4>
|
| 702 |
-
|
| 703 |
-
<li>μ¦μμ΄ 2μ£Ό μ΄μ μ§μλ κ²½μ° / If symptoms persist for more than 2 weeks</li>
|
| 704 |
-
<li>ν΅μ¦μ΄λ κ°λ €μμ΄ μ¬ν κ²½μ° / Severe pain or itching</li>
|
| 705 |
-
<li>λ³λ³μ΄ κΈμν νμ°λλ κ²½μ° / Rapid spread of lesions</li>
|
| 706 |
-
<li>λ°μ΄ λ± μ μ μ¦μμ΄ λλ°λλ κ²½μ° / Accompanied by systemic symptoms like fever</li>
|
| 707 |
-
<li>μΌμμνμ μ§μ₯μ μ€ μ λλ‘ μ¬ν κ²½μ° / Severe enough to interfere with daily life</li>
|
| 708 |
-
</ul>
|
| 709 |
</div>
|
| 710 |
|
| 711 |
<div class="result-container">
|
| 712 |
<h4>π¬ μΆκ° κ²μ¬ κΆμ₯μ¬ν / Recommended Additional Tests</h4>
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
<
|
| 717 |
-
<
|
| 718 |
-
|
| 719 |
</div>
|
| 720 |
</div>
|
| 721 |
"""
|
| 722 |
|
| 723 |
return analysis
|
| 724 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 725 |
def _translate_disease_name(self, disease_name: str) -> str:
|
| 726 |
"""Translate disease name to Korean if not in database."""
|
| 727 |
# Common translations for diseases not in main database
|
|
|
|
| 657 |
top_class = next(iter(class_probs))
|
| 658 |
top_confidence = class_probs[top_class]
|
| 659 |
|
| 660 |
+
# Get disease information from database - check multiple variations
|
| 661 |
+
disease_info = None
|
| 662 |
|
| 663 |
+
# Try different case variations to find the disease
|
| 664 |
+
search_keys = [
|
| 665 |
+
top_class.lower(),
|
| 666 |
+
top_class.lower().replace('_', ' '),
|
| 667 |
+
top_class.lower().replace('-', ' '),
|
| 668 |
+
top_class.replace('_', ' ').lower(),
|
| 669 |
+
top_class.replace('-', ' ').lower()
|
| 670 |
+
]
|
| 671 |
+
|
| 672 |
+
for key in search_keys:
|
| 673 |
+
if key in self.disease_info_db:
|
| 674 |
+
disease_info = self.disease_info_db[key]
|
| 675 |
+
logger.info(f"Found disease info for: {key}")
|
| 676 |
+
break
|
| 677 |
+
|
| 678 |
+
# If still not found, create comprehensive default information
|
| 679 |
if disease_info is None:
|
| 680 |
+
logger.warning(f"No database entry for: {top_class}")
|
| 681 |
+
disease_info = self._create_default_disease_info(top_class)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 682 |
|
| 683 |
+
# Get detailed symptoms if available
|
| 684 |
+
symptoms_text = disease_info.get('symptoms_ko', '')
|
| 685 |
+
if symptoms_text:
|
| 686 |
+
symptoms_html = f"""
|
| 687 |
+
<div class="result-container">
|
| 688 |
+
<h4>π μ£Όμ μ¦μ / Key Symptoms</h4>
|
| 689 |
+
<p>{symptoms_text}</p>
|
| 690 |
+
</div>
|
| 691 |
+
"""
|
| 692 |
+
else:
|
| 693 |
+
symptoms_html = ""
|
| 694 |
+
|
| 695 |
+
# Create comprehensive GPT analysis with all available information
|
| 696 |
analysis = f"""
|
| 697 |
<div class="diagnosis-card">
|
| 698 |
<h3>π€ GPT-OSS μμΈ λΆμ / GPT-OSS Detailed Analysis</h3>
|
| 699 |
|
| 700 |
<div class="info-box">
|
| 701 |
+
<h4>π μ§λ¨λ μ§ν μ 보 / Diagnosed Condition Information</h4>
|
| 702 |
+
<p><strong>μ§νλͺ
/ Disease:</strong> {top_class.title()} ({disease_info['name_ko']})</p>
|
| 703 |
<p><strong>μ λ’°λ / Confidence:</strong> {top_confidence:.1%}</p>
|
| 704 |
+
<p><strong>μ€μ¦λ / Severity:</strong> {self._get_severity_badge(disease_info.get('severity', 'unknown'))}</p>
|
| 705 |
</div>
|
| 706 |
|
| 707 |
+
<div class="result-container">
|
| 708 |
+
<h4>π μ§ν μ€λͺ
/ Disease Description</h4>
|
| 709 |
+
<p><strong>{disease_info['name_ko']} ({top_class.title()})</strong></p>
|
| 710 |
+
<p>{disease_info['description_ko']}</p>
|
| 711 |
+
</div>
|
| 712 |
+
|
| 713 |
+
{symptoms_html}
|
| 714 |
+
|
| 715 |
<div class="result-container">
|
| 716 |
<h4>π κΆμ₯ μΉλ£λ² / Recommended Treatment</h4>
|
| 717 |
+
<p><strong>μΉλ£ λ°©λ²:</strong></p>
|
| 718 |
+
<p>{disease_info['treatment_ko']}</p>
|
| 719 |
</div>
|
| 720 |
|
| 721 |
<div class="result-container">
|
| 722 |
<h4>π μν κ΄λ¦¬ μ§μΉ¨ / Lifestyle Management Guidelines</h4>
|
| 723 |
+
{self._get_lifestyle_guidelines(top_class, disease_info.get('severity', 'low'))}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 724 |
</div>
|
| 725 |
|
| 726 |
<div class="result-container">
|
| 727 |
<h4>π₯ μλ£μ§ μλ΄ νμ μμ / When to Consult Healthcare Provider</h4>
|
| 728 |
+
{self._get_consultation_guidelines(disease_info.get('severity', 'low'))}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 729 |
</div>
|
| 730 |
|
| 731 |
<div class="result-container">
|
| 732 |
<h4>π¬ μΆκ° κ²μ¬ κΆμ₯μ¬ν / Recommended Additional Tests</h4>
|
| 733 |
+
{self._get_test_recommendations(top_class, disease_info.get('severity', 'low'))}
|
| 734 |
+
</div>
|
| 735 |
+
|
| 736 |
+
<div class="result-container">
|
| 737 |
+
<h4>β οΈ μ£Όμμ¬ν / Precautions</h4>
|
| 738 |
+
{self._get_precautions(top_class, disease_info.get('severity', 'low'))}
|
| 739 |
</div>
|
| 740 |
</div>
|
| 741 |
"""
|
| 742 |
|
| 743 |
return analysis
|
| 744 |
|
| 745 |
+
def _create_default_disease_info(self, disease_name: str) -> Dict:
|
| 746 |
+
"""Create default disease information when not in database."""
|
| 747 |
+
# Try to infer information from the disease name
|
| 748 |
+
name_lower = disease_name.lower()
|
| 749 |
+
|
| 750 |
+
# Determine Korean name
|
| 751 |
+
name_ko = self._translate_disease_name(disease_name)
|
| 752 |
+
|
| 753 |
+
# Determine severity
|
| 754 |
+
severity = self._estimate_severity(disease_name)
|
| 755 |
+
|
| 756 |
+
# Create appropriate description based on keywords
|
| 757 |
+
if 'cancer' in name_lower or 'carcinoma' in name_lower or 'melanoma' in name_lower:
|
| 758 |
+
description = f"μ
μ± μ’
μμ κ°λ₯μ±μ΄ μλ νΌλΆ λ³λ³μ
λλ€. μ¦μ μ λ¬Έμ μ§λ¨μ΄ νμν©λλ€."
|
| 759 |
+
treatment = "μ¦μ νΌλΆκ³Ό λλ μ’
μ μ λ¬Έμ μλ΄, μ‘°μ§κ²μ¬ νμ, μ‘°κΈ° μ§λ¨κ³Ό μΉλ£κ° μ€μ"
|
| 760 |
+
elif 'infection' in name_lower or 'bacterial' in name_lower:
|
| 761 |
+
description = f"μΈκ· κ°μΌμ΄ μμ¬λλ νΌλΆ μ§νμ
λλ€. μ μ ν νμμ μΉλ£κ° νμν μ μμ΅λλ€."
|
| 762 |
+
treatment = "νμμ μΉλ£(κ΅μ λλ 경ꡬ), μμ² μλ
, μμ κ΄λ¦¬"
|
| 763 |
+
elif 'fungal' in name_lower:
|
| 764 |
+
description = f"μ§κ· κ°μΌμ΄ μμ¬λλ νΌλΆ μ§νμ
λλ€."
|
| 765 |
+
treatment = "νμ§κ· μ μΉλ£, νλΆ κ±΄μ‘° μ μ§, ν΅ν κ°μ "
|
| 766 |
+
elif 'dermatitis' in name_lower or 'eczema' in name_lower:
|
| 767 |
+
description = f"νΌλΆμ μΌμ¦μ± μ§νμΌλ‘, κ°λ €μκ³Ό λ°μ μ΄ λλ°λ μ μμ΅λλ€."
|
| 768 |
+
treatment = "보μ΅μ μ¬μ©, κ΅μ μ€ν
λ‘μ΄λ, ννμ€νλ―Όμ , μκ·Ή λ¬Όμ§ ννΌ"
|
| 769 |
+
elif 'acne' in name_lower or 'pimple' in name_lower:
|
| 770 |
+
description = f"λͺ¨λκ³Ό νΌμ§μ μ μΌμ¦μ± μ§νμ
λλ€."
|
| 771 |
+
treatment = "μ μ ν ν΄λ μ§, κ΅μ μΉλ£μ (λ ν°λ
Έμ΄λ, λ²€μ‘°μΌ νΌμ₯μ¬μ΄λ), νμμ "
|
| 772 |
+
else:
|
| 773 |
+
description = f"νΌλΆ μ§νμΌλ‘ μ νν μ§λ¨μ μν΄ μ λ¬Έμ μλ΄μ΄ κΆμ₯λ©λλ€."
|
| 774 |
+
treatment = "νΌλΆκ³Ό μ λ¬Έμ μλ΄μ ν΅ν μ νν μ§λ¨ ν μ μ ν μΉλ£"
|
| 775 |
+
|
| 776 |
+
return {
|
| 777 |
+
"name_ko": name_ko,
|
| 778 |
+
"severity": severity,
|
| 779 |
+
"description_ko": description,
|
| 780 |
+
"treatment_ko": treatment,
|
| 781 |
+
"symptoms_ko": "μ‘μ κ²μ¬μ μΆκ° κ²μ¬λ₯Ό ν΅ν΄ μ νν μ¦μ νμ
νμ"
|
| 782 |
+
}
|
| 783 |
+
|
| 784 |
+
def _get_severity_badge(self, severity: str) -> str:
|
| 785 |
+
"""Get HTML badge for severity level."""
|
| 786 |
+
badges = {
|
| 787 |
+
"none": '<span class="diagnosis-severity">μ μ / Normal</span>',
|
| 788 |
+
"low": '<span class="diagnosis-severity severity-low">κ²½μ¦ / Mild</span>',
|
| 789 |
+
"medium": '<span class="diagnosis-severity severity-medium">μ€λ±λ / Moderate</span>',
|
| 790 |
+
"high": '<span class="diagnosis-severity severity-high">μ€μ¦ / Severe</span>',
|
| 791 |
+
"unknown": '<span class="diagnosis-severity">λ―ΈλΆλ₯ / Unclassified</span>'
|
| 792 |
+
}
|
| 793 |
+
return badges.get(severity, badges["unknown"])
|
| 794 |
+
|
| 795 |
+
def _get_lifestyle_guidelines(self, disease: str, severity: str) -> str:
|
| 796 |
+
"""Get lifestyle management guidelines based on disease and severity."""
|
| 797 |
+
guidelines = "<ul>"
|
| 798 |
+
|
| 799 |
+
# General guidelines for all conditions
|
| 800 |
+
guidelines += "<li>μΆ©λΆν μλΆ μμ·¨ (ν루 8μ μ΄μ) / Drink plenty of water (8+ glasses daily)</li>"
|
| 801 |
+
guidelines += "<li>κ· ν μ‘ν μλ¨ μ μ§ / Maintain a balanced diet</li>"
|
| 802 |
+
guidelines += "<li>μΆ©λΆν μλ©΄ (7-8μκ°) / Get adequate sleep (7-8 hours)</li>"
|
| 803 |
+
|
| 804 |
+
# Specific guidelines based on disease type
|
| 805 |
+
disease_lower = disease.lower()
|
| 806 |
+
|
| 807 |
+
if 'acne' in disease_lower or 'pimple' in disease_lower:
|
| 808 |
+
guidelines += "<li>μ μκ·Ήμ± ν΄λ μ μ¬μ© / Use gentle, non-comedogenic cleanser</li>"
|
| 809 |
+
guidelines += "<li>μμΌλ‘ μΌκ΅΄ λ§μ§μ§ μκΈ° / Avoid touching face with hands</li>"
|
| 810 |
+
guidelines += "<li>μ μ νκ³Ό κ³ λΉλΆ μν μ ν / Limit dairy and high-sugar foods</li>"
|
| 811 |
+
|
| 812 |
+
if 'eczema' in disease_lower or 'dermatitis' in disease_lower:
|
| 813 |
+
guidelines += "<li>ν루 2ν μ΄μ 보μ΅μ μ¬μ© / Apply moisturizer at least twice daily</li>"
|
| 814 |
+
guidelines += "<li>λ¨κ±°μ΄ λ¬Ό μ€μ νΌνκΈ° / Avoid hot water showers</li>"
|
| 815 |
+
guidelines += "<li>λ©΄ μμ¬ μλ₯ μ°©μ© / Wear cotton clothing</li>"
|
| 816 |
+
|
| 817 |
+
if 'psoriasis' in disease_lower:
|
| 818 |
+
guidelines += "<li>μ€νΈλ μ€ κ΄λ¦¬ (μκ°, λͺ
μ) / Manage stress (yoga, meditation)</li>"
|
| 819 |
+
guidelines += "<li>μμ½μ¬ μμ·¨ μ ν / Limit alcohol consumption</li>"
|
| 820 |
+
guidelines += "<li>μ μ ν νλΉ λ
ΈμΆ / Moderate sun exposure</li>"
|
| 821 |
+
|
| 822 |
+
if severity == "high":
|
| 823 |
+
guidelines += "<li>μ¦μ μ λ¬Έμ μλ΄ μμ½ / Schedule immediate specialist consultation</li>"
|
| 824 |
+
guidelines += "<li>μ²λ°©λ μ½λ¬Ό κ·μΉμ λ³΅μ© / Take prescribed medications regularly</li>"
|
| 825 |
+
|
| 826 |
+
guidelines += "<li>μμΈμ μ°¨λ¨μ λ§€μΌ μ¬μ© (SPF 30+) / Apply sunscreen daily (SPF 30+)</li>"
|
| 827 |
+
guidelines += "</ul>"
|
| 828 |
+
|
| 829 |
+
return guidelines
|
| 830 |
+
|
| 831 |
+
def _get_consultation_guidelines(self, severity: str) -> str:
|
| 832 |
+
"""Get consultation guidelines based on severity."""
|
| 833 |
+
guidelines = "<ul>"
|
| 834 |
+
|
| 835 |
+
if severity == "high":
|
| 836 |
+
guidelines += "<li><strong style='color: red;'>μ¦μ μλ£μ§ μλ΄ νμ / Immediate medical consultation required</strong></li>"
|
| 837 |
+
guidelines += "<li>24μκ° μ΄λ΄ νΌλΆκ³Ό λ°©λ¬Έ κΆμ₯ / Visit dermatologist within 24 hours</li>"
|
| 838 |
+
|
| 839 |
+
guidelines += "<li>μ¦μμ΄ 2μ£Ό μ΄μ μ§μλ κ²½μ° / If symptoms persist for more than 2 weeks</li>"
|
| 840 |
+
guidelines += "<li>ν΅μ¦, μΆν, λΆλΉλ¬Όμ΄ μμ κ²½μ° / If pain, bleeding, or discharge occurs</li>"
|
| 841 |
+
guidelines += "<li>λ³λ³μ΄ κΈμν νμ°λλ κ²½μ° / If lesions spread rapidly</li>"
|
| 842 |
+
guidelines += "<li>λ°μ΄, μ€ν λ± μ μ μ¦μ λλ° μ / If accompanied by fever or chills</li>"
|
| 843 |
+
guidelines += "<li>μΌμμνμ μ§μ₯μ μ€ μ λλ‘ μ¬ν κ²½μ° / If severe enough to affect daily life</li>"
|
| 844 |
+
guidelines += "<li>κΈ°μ‘΄ μΉλ£μ λ°μνμ§ μλ κ²½μ° / If not responding to current treatment</li>"
|
| 845 |
+
guidelines += "</ul>"
|
| 846 |
+
|
| 847 |
+
return guidelines
|
| 848 |
+
|
| 849 |
+
def _get_test_recommendations(self, disease: str, severity: str) -> str:
|
| 850 |
+
"""Get test recommendations based on disease type."""
|
| 851 |
+
tests = "<ul>"
|
| 852 |
+
|
| 853 |
+
disease_lower = disease.lower()
|
| 854 |
+
|
| 855 |
+
# Cancer-related tests
|
| 856 |
+
if 'cancer' in disease_lower or 'carcinoma' in disease_lower or 'melanoma' in disease_lower:
|
| 857 |
+
tests += "<li>νΌλΆ μ‘°μ§κ²μ¬ (Biopsy) - <strong>νμ</strong></li>"
|
| 858 |
+
tests += "<li>λλͺ¨μ€μ½νΌ κ²μ¬ / Dermoscopy examination</li>"
|
| 859 |
+
tests += "<li>μ μ νΌλΆ κ²μ§ / Full body skin examination</li>"
|
| 860 |
+
tests += "<li>λ¦Όνμ κ²μ¬ / Lymph node examination</li>"
|
| 861 |
+
|
| 862 |
+
# Infection tests
|
| 863 |
+
elif 'infection' in disease_lower or 'bacterial' in disease_lower or 'fungal' in disease_lower:
|
| 864 |
+
tests += "<li>μΈκ· λ°°μ κ²μ¬ / Bacterial culture</li>"
|
| 865 |
+
tests += "<li>μ§κ· κ²μ¬ (KOH test) / Fungal examination</li>"
|
| 866 |
+
tests += "<li>νμμ κ°μμ± κ²μ¬ / Antibiotic sensitivity test</li>"
|
| 867 |
+
|
| 868 |
+
# Allergy/Dermatitis tests
|
| 869 |
+
elif 'dermatitis' in disease_lower or 'eczema' in disease_lower:
|
| 870 |
+
tests += "<li>ν¨μΉ ν
μ€νΈ (μλ λ₯΄κΈ° κ²μ¬) / Patch testing</li>"
|
| 871 |
+
tests += "<li>νμ‘ IgE κ²μ¬ / Blood IgE test</li>"
|
| 872 |
+
tests += "<li>νΌλΆ λ¨μ κ²μ¬ / Skin prick test</li>"
|
| 873 |
+
|
| 874 |
+
# General tests
|
| 875 |
+
else:
|
| 876 |
+
tests += "<li>νΌλΆ νλκ²½ κ²μ¬ / Magnified skin examination</li>"
|
| 877 |
+
tests += "<li>Wood's lamp κ²μ¬ (νμμ) / Wood's lamp examination (if needed)</li>"
|
| 878 |
+
|
| 879 |
+
if severity == "high":
|
| 880 |
+
tests += "<li>νμ‘ κ²μ¬ (CBC, CRP) / Blood tests (CBC, CRP)</li>"
|
| 881 |
+
tests += "<li>μμ κ²μ¬ (νμμ) / Imaging studies (if needed)</li>"
|
| 882 |
+
|
| 883 |
+
tests += "</ul>"
|
| 884 |
+
|
| 885 |
+
return tests
|
| 886 |
+
|
| 887 |
+
def _get_precautions(self, disease: str, severity: str) -> str:
|
| 888 |
+
"""Get precautions based on disease type."""
|
| 889 |
+
precautions = "<ul>"
|
| 890 |
+
|
| 891 |
+
if severity == "high":
|
| 892 |
+
precautions += "<li><strong>μκ° μΉλ£ κΈμ§ - λ°λμ μ λ¬Έμ μλ΄</strong></li>"
|
| 893 |
+
|
| 894 |
+
precautions += "<li>μ²λ°© μμ΄ μ€ν
λ‘μ΄λ μ°κ³ μ₯κΈ° μ¬μ© κΈμ§ / Avoid long-term steroid use without prescription</li>"
|
| 895 |
+
precautions += "<li>λ³λ³ λΆμ κΈκ±°λ μκ·Ήνμ§ μκΈ° / Do not scratch or irritate affected areas</li>"
|
| 896 |
+
precautions += "<li>κ²μ¦λμ§ μμ λ―Όκ°μλ² νΌνκΈ° / Avoid unverified home remedies</li>"
|
| 897 |
+
precautions += "<li>νμΈκ³Ό μ건, μλ₯ 곡μ κΈμ§ / Do not share towels or clothing</li>"
|
| 898 |
+
precautions += "<li>μ¦μ μ
ν μ μ¦μ μλ£μ§ μλ΄ / Consult immediately if symptoms worsen</li>"
|
| 899 |
+
precautions += "</ul>"
|
| 900 |
+
|
| 901 |
+
return precautions
|
| 902 |
+
|
| 903 |
def _translate_disease_name(self, disease_name: str) -> str:
|
| 904 |
"""Translate disease name to Korean if not in database."""
|
| 905 |
# Common translations for diseases not in main database
|