File size: 2,260 Bytes
d4abe4b 0c00ee2 d4abe4b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | export interface Location {
lat: number;
lng: number;
}
export interface HealthCheckRequest {
text?: string;
image_url?: string;
user_id: string;
session_id?: string; // For tracking conversation history
location?: Location;
}
export interface ConversationMessage {
id: string;
session_id: string;
user_id: string;
role: 'user' | 'assistant';
content: string;
image_url?: string;
triage_result?: any;
created_at: string;
}
export type TriageLevel = "emergency" | "urgent" | "routine" | "self-care";
export type ConditionSource = "cv_model" | "guideline" | "user_report" | "reasoning";
export type ConditionConfidence = "low" | "medium" | "high";
export interface SuspectedCondition {
name: string;
source: ConditionSource;
confidence: ConditionConfidence;
}
export interface CVFindings {
model_used: "derm_cv" | "eye_cv" | "wound_cv" | "none";
raw_output: Record<string, any>;
}
export interface Recommendation {
action: string;
timeframe: string;
home_care_advice: string;
warning_signs: string;
}
export interface TriageResult {
triage_level: TriageLevel;
symptom_summary: string;
red_flags: string[];
suspected_conditions: SuspectedCondition[];
cv_findings: CVFindings;
recommendation: Recommendation;
message?: string; // Markdown response from LLM (natural language, not constrained by JSON structure)
}
export interface NearestClinic {
name: string;
distance_km: number;
address: string;
rating?: number;
}
export interface HealthCheckResponse extends TriageResult {
nearest_clinic?: NearestClinic;
}
export interface TriageInput {
symptoms: {
main_complaint: string;
duration?: string;
pain_severity?: "nhẹ" | "vừa" | "nặng";
fever?: boolean;
vision_changes?: boolean;
bleeding?: boolean;
breathing_difficulty?: boolean;
chest_pain?: boolean;
severe_headache?: boolean;
confusion?: boolean;
};
cv_results?: any;
}
export interface CVResult {
top_conditions: Array<{ name: string; prob: number }>;
status?: 'success' | 'out_of_domain' | 'error';
max_confidence?: number;
threshold?: number;
}
export interface GuidelineQuery {
symptoms: string;
suspected_conditions: string[];
triage_level: string;
}
|