File size: 2,094 Bytes
98b2898
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
graph TD
    subgraph User_Interface[User Interface - Gradio]
        UI_AppPy["app.py (Gradio UI)"]
        UI_Uploads["Image/Form Uploads (Receipts, Child Fee, Medical)"]
        UI_Inputs["User Inputs (Employee Details, etc.)"]
        UI_Outputs["Processed Info / Filled PDFs"]
    end

    subgraph Processing_Pipeline[Processing Pipeline]
        P_PipelinePy["pipeline.py"]
        P_OpenAI["OpenAI GPT-4o (Image to Text & Structured Data Extraction)"]
        P_ModelsPy["models.py (Pydantic Data Models)"]
        P_FormFillPy["form_fill.py (PDF Population)"]
        P_FraudPy["fraud.py (Fraud Detection)"]
        P_DataJson["data.json (Storage for Processed Receipts)"]
        P_TemplatesDir["templates/ (PDF Templates)"]
        P_OutputsDir["outputs/ (Generated PDFs)"]
    end

    UI_AppPy --> P_PipelinePy;

    UI_Uploads --> P_PipelinePy;
    UI_Inputs -- Employee Data etc. --> P_PipelinePy;
    P_PipelinePy -- Extracted Info / PDF Paths --> UI_Outputs;

    P_PipelinePy -- Sends Image Data --> P_OpenAI;
    P_OpenAI -- Returns Structured JSON --> P_PipelinePy;
    P_PipelinePy -- Validates/Uses --> P_ModelsPy;
    P_PipelinePy -- Sends Data for PDF --> P_FormFillPy;
    P_FormFillPy -- Uses PDF Templates from --> P_TemplatesDir;
    P_FormFillPy -- Saves Filled PDF to --> P_OutputsDir;
    P_PipelinePy -- Sends Receipt Data for Fraud Check --> P_FraudPy;
    P_FraudPy -- Loads/Saves Receipt Data --> P_DataJson;
    P_FraudPy -- Returns Fraud Status --> P_PipelinePy;

    P_TemplatesDir -.-> P_FormFillPy;
    P_OutputsDir <-.- P_FormFillPy;
    P_DataJson -.-> P_FraudPy;

    %% Styling
    classDef ui fill:#D6EAF8,stroke:#3498DB,stroke-width:2px;
    classDef process fill:#D5F5E3,stroke:#2ECC71,stroke-width:2px;
    classDef external fill:#FCF3CF,stroke:#F1C40F,stroke-width:2px;
    classDef storage fill:#EBDEF0,stroke:#8E44AD,stroke-width:2px;

    class UI_AppPy,UI_Uploads,UI_Inputs,UI_Outputs ui;
    class P_PipelinePy,P_ModelsPy,P_FormFillPy,P_FraudPy process;
    class P_OpenAI external;
    class P_DataJson,P_TemplatesDir,P_OutputsDir storage;