CoolFace
Apppublic

Distopia22/icd-cpt-coding-api-backend

sourceHugging Facemitupdated 10mo agoView on Hugging Face
0likes
request_models.py50 linesDownload Raw Back to models
1from pydantic import BaseModel, Field2 3class ProviderNotesRequest(BaseModel):4    provider_notes: str = Field(5        ..., 6        min_length=10,7        description="Clinical provider notes for analysis",8        examples=["Patient presents with acute bronchitis. Cough for 5 days..."]9    )10    11    class Config:12        json_schema_extra = {13            "example": {14                "provider_notes": "Patient presents with acute bronchitis. Cough for 5 days, productive with yellow sputum. Lung exam reveals diffuse wheezing. Prescribed azithromycin 500mg."15            }16        }17 18class ProviderNote(BaseModel):19    note: str20 21class CodingResponse(BaseModel):22    cpt_codes: list23    cpt_explanation: str24    icd_codes: list25    icd_explanation: str26 27 28# NEW: File upload response model29class FileUploadResponse(BaseModel):30    """Response model for file upload endpoint"""31    success: bool = Field(description="Whether file processing was successful")32    filename: str = Field(description="Name of uploaded file")33    extracted_text_length: int = Field(description="Length of extracted text")34    cpt_codes: list = Field(description="List of CPT codes")35    cpt_explanation: str = Field(description="Explanation of CPT codes")36    icd_codes: list = Field(description="List of ICD codes")37    icd_explanation: str = Field(description="Explanation of ICD codes")38    39    class Config:40        json_schema_extra = {41            "example": {42                "success": True,43                "filename": "provider_notes.txt",44                "extracted_text_length": 450,45                "cpt_codes": ["99213", "93000"],46                "cpt_explanation": "Office visit and EKG",47                "icd_codes": ["I20.0", "R07.9"],48                "icd_explanation": "Unstable angina and chest pain"49            }50        }