# kamaldheen20/finatesting architecture

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

- Interactive diagram: https://gitdiagram.com/kamaldheen20/finatesting
- Repository: https://github.com/kamaldheen20/finatesting

## Overview

KARA Collection Manager is a finance and loan-collection application. Staff use its web interface to manage customers and loans, record or bulk-validate dated collections, and review or export reports; missing customers from bulk validation can be tracked as pending. The Flask application owns these workflows and persists domain records through SQLAlchemy models. The repository also includes a local handwritten-sheet OCR service and an Android WebView client. The excerpts show the main application’s model usage, but not its route-to-template or OCR wiring, so those relationships are omitted.

Main entry points: [`app.py`](https://github.com/kamaldheen20/finatesting/blob/main/app.py) (Finance web app), [`bulk_csv_patch.py`](https://github.com/kamaldheen20/finatesting/blob/main/bulk_csv_patch.py) (CSV validation), [`android/app/src/main/java/com/finatesting/finance/MainActivity.java`](https://github.com/kamaldheen20/finatesting/blob/main/android/app/src/main/java/com/finatesting/finance/MainActivity.java) (Android client), [`models.py`](https://github.com/kamaldheen20/finatesting/blob/main/models.py) (Finance models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client Interfaces"]
  node_views["Web views"]
  node_android_client["Android client<br/>[MainActivity.java]"]
end

subgraph group_workflows["Finance Workflows"]
  node_web_app["Finance web app<br/>[app.py]"]
  node_auth["Account access<br/>[app.py]"]
  node_customer_mgmt["Customer loans<br/>[app.py]"]
  node_collections["Payment collection<br/>[app.py]"]
  node_csv_validation["CSV validation<br/>[bulk_csv_patch.py]"]
  node_pending["Pending customers<br/>[models.py]"]
  node_reports["Reports and exports<br/>[app.py]"]
  node_backup_restore["Backup restore<br/>[app.py]"]
  node_company_settings["Company settings<br/>[app.py]"]
end

subgraph group_persistence["Persistence"]
  node_domain_models["Finance models<br/>[models.py]"]
  node_finance_db[("Finance database<br/>[finance.db]")]
end

subgraph group_capture["Collection Capture"]
  node_ocr["Handwriting OCR<br/>[ocr_service.py]"]
  node_bulk_sheet["Bulk collection sheet"]
end

node_staff(("Staff user"))

node_staff -->|"uses"| node_web_app
node_android_client -->|"loads hosted app"| node_web_app
node_web_app -->|"handles"| node_auth
node_web_app -->|"handles"| node_customer_mgmt
node_web_app -->|"handles"| node_collections
node_web_app -->|"generates"| node_reports
node_web_app -->|"restores"| node_backup_restore
node_web_app -->|"defines"| node_company_settings
node_web_app -->|"imports"| node_domain_models
node_csv_validation -->|"queries and updates"| node_domain_models
node_csv_validation -->|"upserts"| node_pending
node_web_app -->|"queries and persists"| node_finance_db
node_csv_validation -->|"queries and persists"| node_finance_db
node_staff -->|"uses"| node_android_client

click node_web_app "https://github.com/kamaldheen20/finatesting/blob/main/app.py"
click node_auth "https://github.com/kamaldheen20/finatesting/blob/main/app.py"
click node_customer_mgmt "https://github.com/kamaldheen20/finatesting/blob/main/app.py"
click node_collections "https://github.com/kamaldheen20/finatesting/blob/main/app.py"
click node_csv_validation "https://github.com/kamaldheen20/finatesting/blob/main/bulk_csv_patch.py"
click node_pending "https://github.com/kamaldheen20/finatesting/blob/main/models.py"
click node_reports "https://github.com/kamaldheen20/finatesting/blob/main/app.py"
click node_backup_restore "https://github.com/kamaldheen20/finatesting/blob/main/app.py"
click node_company_settings "https://github.com/kamaldheen20/finatesting/blob/main/app.py"
click node_views "https://github.com/kamaldheen20/finatesting/tree/main/templates"
click node_android_client "https://github.com/kamaldheen20/finatesting/blob/main/android/app/src/main/java/com/finatesting/finance/MainActivity.java"
click node_domain_models "https://github.com/kamaldheen20/finatesting/blob/main/models.py"
click node_finance_db "https://github.com/kamaldheen20/finatesting/blob/main/database/finance.db"
click node_ocr "https://github.com/kamaldheen20/finatesting/blob/main/ocr_service.py"
click node_bulk_sheet "https://github.com/kamaldheen20/finatesting/blob/main/templates/bulk_collection_ocr.html"

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_views,node_android_client,node_staff toneBlue
class node_web_app,node_auth,node_customer_mgmt,node_collections,node_csv_validation,node_pending,node_reports,node_backup_restore,node_company_settings toneAmber
class node_domain_models,node_finance_db toneMint
class node_ocr,node_bulk_sheet toneRose
```

## Components

### Client Interfaces

- [Web views](https://github.com/kamaldheen20/finatesting/tree/main/templates): `templates`
- [Android client](https://github.com/kamaldheen20/finatesting/blob/main/android/app/src/main/java/com/finatesting/finance/MainActivity.java): `android/app/src/main/java/com/finatesting/finance/MainActivity.java`

### Finance Workflows

- [Finance web app](https://github.com/kamaldheen20/finatesting/blob/main/app.py): `app.py`
- [Account access](https://github.com/kamaldheen20/finatesting/blob/main/app.py): `app.py`
- [Customer loans](https://github.com/kamaldheen20/finatesting/blob/main/app.py): `app.py`
- [Payment collection](https://github.com/kamaldheen20/finatesting/blob/main/app.py): `app.py`
- [CSV validation](https://github.com/kamaldheen20/finatesting/blob/main/bulk_csv_patch.py): `bulk_csv_patch.py`
- [Pending customers](https://github.com/kamaldheen20/finatesting/blob/main/models.py): `models.py`
- [Reports and exports](https://github.com/kamaldheen20/finatesting/blob/main/app.py): `app.py`
- [Backup restore](https://github.com/kamaldheen20/finatesting/blob/main/app.py): `app.py`
- [Company settings](https://github.com/kamaldheen20/finatesting/blob/main/app.py): `app.py`

### Persistence

- [Finance models](https://github.com/kamaldheen20/finatesting/blob/main/models.py): `models.py`
- [Finance database](https://github.com/kamaldheen20/finatesting/blob/main/database/finance.db): `database/finance.db`

### Collection Capture

- [Handwriting OCR](https://github.com/kamaldheen20/finatesting/blob/main/ocr_service.py): `ocr_service.py`
- [Bulk collection sheet](https://github.com/kamaldheen20/finatesting/blob/main/templates/bulk_collection_ocr.html): `templates/bulk_collection_ocr.html`

### Other components

- **Staff user**

## Connections

- Staff user → Finance web app: uses
- Android client → Finance web app: loads hosted app (evidence: `android/app/src/main/java/com/finatesting/finance/MainActivity.java`)
- Finance web app → Account access: handles (evidence: `app.py`)
- Finance web app → Customer loans: handles (evidence: `app.py`)
- Finance web app → Payment collection: handles (evidence: `app.py`)
- Finance web app → Reports and exports: generates (evidence: `app.py`)
- Finance web app → Backup restore: restores (evidence: `app.py`)
- Finance web app → Company settings: defines (evidence: `app.py`)
- Finance web app → Finance models: imports (evidence: `app.py`)
- CSV validation → Finance models: queries and updates (evidence: `bulk_csv_patch.py`)
- CSV validation → Pending customers: upserts (evidence: `bulk_csv_patch.py`)
- Finance web app → Finance database: queries and persists (evidence: `app.py`)
- CSV validation → Finance database: queries and persists (evidence: `bulk_csv_patch.py`)
- Staff user → Android client: uses
