File size: 2,566 Bytes
480f467
fd20bd2
56edde7
480f467
 
 
 
 
 
 
 
 
 
fd20bd2
 
 
 
 
 
 
 
 
 
 
 
 
 
56edde7
fd20bd2
 
56edde7
 
480f467
 
 
fd20bd2
480f467
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
fd20bd2
 
480f467
 
 
 
 
 
 
 
56edde7
 
 
 
fd20bd2
 
 
 
 
 
 
 
 
56edde7
 
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
from pydantic import BaseModel
from typing import List, Optional

class ICDCode(BaseModel):
    code: str
    description: str
    explanation: str

class CPTCode(BaseModel):
    code: str
    description: str
    explanation: str

class ProviderNotesRequest(BaseModel):
    provider_notes: str = Field(
        ..., 
        description="The medical provider notes to analyze",
        min_length=10,
        example="Patient presents with acute bronchitis. Performed comprehensive examination and prescribed antibiotics."
    )
    
    class Config:
        json_schema_extra = {
            "example": {
                "provider_notes": "Patient presents with acute bronchitis. Cough for 5 days, productive with yellow sputum. Lung exam reveals diffuse wheezing. Prescribed azithromycin 500mg."
            }
        }

class ProviderNote(BaseModel):
    note: str

class CodingResponse(BaseModel):
    icd_codes: List[ICDCode]
    cpt_codes: List[CPTCode]
    overall_summary: str

    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"
            }
        }

class FileUploadResponse(BaseModel):
    success: bool
    filename: str
    extracted_text_length: int
    pii_removed: bool
    pii_count: int
    icd_codes: List[ICDCode]
    cpt_codes: List[CPTCode]
    overall_summary: str
    
    class Config:
        json_schema_extra = {
            "example": {
                "success": True,
                "filename": "provider_notes.txt",
                "extracted_text_length": 450,
                "pii_removed": True,
                "pii_count": 3,
                "cpt_codes": ["99213", "93000"],
                "cpt_explanation": "Office visit and EKG",
                "icd_codes": ["I20.0", "R07.9"],
                "icd_explanation": "Unstable angina and chest pain"
            }
        }