# lucasmichalikdev/invoice_automation architecture

> Architecture diagram of the GitHub repository lucasmichalikdev/invoice_automation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-24). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/lucasmichalikdev/invoice_automation
- Repository: https://github.com/lucasmichalikdev/invoice_automation

## Overview

Invoice Automation API accepts PDF invoice uploads, extracts text and invoice fields, categorizes and validates the extracted data, then stores invoice details in SQLite. The same REST API supports listing, retrieving, and deleting invoices. The graph separates the API boundary, processing stages, and persistence. Relationships are based on the shown calls in app/main.py and app/processor.py; the README documents the REST endpoints. The Docker and test setup is not part of the runtime workflow.

Main entry points: [`app/main.py`](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/main.py) (Invoice routes), [`app/databaseSQLite.py`](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/databaseSQLite.py) (Invoice storage operations), [`app/processor.py`](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/processor.py) (Field extraction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_api_routes["Invoice routes<br/>[main.py]"]
end

subgraph group_processing["Invoice Processing"]
  node_pdf_text["PDF text extraction<br/>[processor.py]"]
  node_field_extraction["Field extraction<br/>[processor.py]"]
  node_categorization["Categorization<br/>[processor.py]"]
  node_validation["Validation<br/>[processor.py]"]
end

subgraph group_persistence["Persistence"]
  node_sqlite_ops["Invoice storage operations<br/>[databaseSQLite.py]"]
  node_sqlite_db[("SQLite invoice database<br/>[databaseSQLite.py]")]
end

node_client(("API client"))

node_client -->|"calls endpoints"| node_api_routes
node_api_routes -->|"extracts text"| node_pdf_text
node_api_routes -->|"extracts fields"| node_field_extraction
node_field_extraction -->|"categorizes amount"| node_categorization
node_field_extraction -->|"validates fields"| node_validation
node_api_routes -->|"saves invoice"| node_sqlite_ops
node_api_routes -->|"lists invoices"| node_sqlite_ops
node_api_routes -->|"gets invoice"| node_sqlite_ops
node_api_routes -->|"deletes invoice"| node_sqlite_ops
node_api_routes -->|"initializes storage"| node_sqlite_ops
node_sqlite_ops -->|"reads and writes"| node_sqlite_db

click node_api_routes "https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/main.py"
click node_pdf_text "https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/processor.py"
click node_field_extraction "https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/processor.py"
click node_categorization "https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/processor.py"
click node_validation "https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/processor.py"
click node_sqlite_ops "https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/databaseSQLite.py"
click node_sqlite_db "https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/databaseSQLite.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api_routes,node_client toneBlue
class node_pdf_text,node_field_extraction,node_categorization,node_validation toneAmber
class node_sqlite_ops,node_sqlite_db toneMint
```

## Components

### REST API

- [Invoice routes](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/main.py): `app/main.py`

### Invoice Processing

- [PDF text extraction](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/processor.py): `app/processor.py`
- [Field extraction](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/processor.py): `app/processor.py`
- [Categorization](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/processor.py): `app/processor.py`
- [Validation](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/processor.py): `app/processor.py`

### Persistence

- [Invoice storage operations](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/databaseSQLite.py): `app/databaseSQLite.py`
- [SQLite invoice database](https://github.com/lucasmichalikdev/invoice_automation/blob/main/app/databaseSQLite.py): `app/databaseSQLite.py`

### Other components

- **API client**

## Connections

- API client → Invoice routes: calls endpoints (evidence: `README.md`)
- Invoice routes → PDF text extraction: extracts text (evidence: `app/main.py`)
- Invoice routes → Field extraction: extracts fields (evidence: `app/main.py`)
- Field extraction → Categorization: categorizes amount (evidence: `app/processor.py`)
- Field extraction → Validation: validates fields (evidence: `app/processor.py`)
- Invoice routes → Invoice storage operations: saves invoice (evidence: `app/main.py`)
- Invoice routes → Invoice storage operations: lists invoices (evidence: `app/main.py`)
- Invoice routes → Invoice storage operations: gets invoice (evidence: `app/main.py`)
- Invoice routes → Invoice storage operations: deletes invoice (evidence: `app/main.py`)
- Invoice routes → Invoice storage operations: initializes storage (evidence: `app/main.py`)
- Invoice storage operations → SQLite invoice database: reads and writes (evidence: `app/databaseSQLite.py`)
