29 lines
798 B
Python
29 lines
798 B
Python
"""
|
|
Extraction result and question intent domain models.
|
|
"""
|
|
|
|
from typing import Any, Dict, List, Optional
|
|
from pydantic import BaseModel, Field
|
|
|
|
|
|
class ExtractedFact(BaseModel):
|
|
category: str # 'symptom', 'medication', 'allergy', 'medical_history', 'family_history', etc.
|
|
data: Dict[str, Any]
|
|
|
|
|
|
class ExtractionResult(BaseModel):
|
|
raw_message: str
|
|
normalized_message: str
|
|
detected_language: str = "en"
|
|
updates: Dict[str, Any] = Field(default_factory=dict)
|
|
is_emergency: bool = False
|
|
is_crisis: bool = False
|
|
emergency_reason: Optional[str] = None
|
|
|
|
|
|
class QuestionIntent(BaseModel):
|
|
intent_code: str # e.g., 'reason_for_visit', 'symptom_duration', 'medical_history'
|
|
field: str
|
|
attribute: Optional[str] = None
|
|
target_symptom: Optional[str] = None
|