File size: 1,371 Bytes
b96d38b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from pydantic import BaseModel, Field
from typing import List, Optional, Any

class AnalysisRequest(BaseModel):
    """Request model for base64 image analysis"""
    image: str = Field(..., description="Base64 encoded image string")

class AnalysisResponse(BaseModel):
    """Response model for lab report analysis"""
    success: bool = Field(..., description="Whether the analysis was successful")
    filename: Optional[str] = Field(None, description="Original filename if uploaded via file")
    analysis: dict = Field(..., description="Analysis results")

class ParsedAnalysis(BaseModel):
    """Structured analysis result"""
    error: bool = Field(False, description="Whether an error occurred")
    summary: str = Field("", description="Summary of the lab report")
    key_findings: List[str] = Field(default_factory=list, description="Key findings from the report")
    interpretation: str = Field("", description="Medical interpretation")
    note: str = Field("", description="Disclaimer note")
    raw_response: str = Field("", description="Raw response from the AI model")
    message: Optional[str] = Field(None, description="Error message if any")

class HealthResponse(BaseModel):
    """Health check response"""
    status: str = Field(..., description="Service status")
    service: str = Field(..., description="Service name")