File size: 1,728 Bytes
1441b40
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from pydantic import BaseModel, Field
from typing import List

class ICDCode(BaseModel):
    code: str = Field(..., description="ICD-10 diagnosis code")
    description: str = Field(..., description="Description of the diagnosis")
    explanation: str = Field(..., description="Explanation for why this code was selected")

class CPTCode(BaseModel):
    code: str = Field(..., description="CPT procedure code")
    description: str = Field(..., description="Description of the procedure/service")
    explanation: str = Field(..., description="Explanation for why this code was selected")

class CodingResponse(BaseModel):
    icd_codes: List[ICDCode] = Field(default_factory=list, description="List of ICD-10 codes")
    cpt_codes: List[CPTCode] = Field(default_factory=list, description="List of CPT codes")
    overall_summary: str = Field(..., description="Overall summary of coding decisions")
    
    class Config:
        json_schema_extra = {
            "example": {
                "icd_codes": [
                    {
                        "code": "J20.9",
                        "description": "Acute bronchitis, unspecified",
                        "explanation": "Patient presents with acute bronchitis as documented in provider notes"
                    }
                ],
                "cpt_codes": [
                    {
                        "code": "99213",
                        "description": "Office visit, established patient",
                        "explanation": "Comprehensive examination performed as documented"
                    }
                ],
                "overall_summary": "Patient encounter for acute bronchitis with examination and treatment"
            }
        }