# amit1886/jaistechkhatabooksystem architecture

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

- Interactive diagram: https://gitdiagram.com/amit1886/jaistechkhatabooksystem
- Repository: https://github.com/amit1886/jaistechkhatabooksystem

## Overview

This repository appears to be a Django business-management platform spanning commerce, procurement, tax, analytics, messaging, and SaaS administration. Its clearest sampled transaction path is order placement: an initiating user submits an order, which the order engine prices items, updates order records and stock, then calculates commission and assigns delivery. Separate sampled workflows cover invoice extraction and purchase-draft approval, WhatsApp replies, and demand forecasting. The README provides no product detail, and unsampled modules are represented only where their paths and responsibilities are clear from the tree.

Main entry points: [`orders/services/order_engine.py`](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/orders/services/order_engine.py) (Order engine), [`ai_ocr/ocr_engine.py`](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_ocr/ocr_engine.py) (Invoice OCR), [`ai_engine/services/forecast_engine.py`](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_engine/services/forecast_engine.py) (Demand forecasting), [`whatsapp/services/bot_engine.py`](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/whatsapp/services/bot_engine.py) (WhatsApp bot)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_commerce["Commerce and procurement"]
  node_order_engine["Order engine<br/>[order_engine.py]"]
  node_order_records[("Order records<br/>[order_engine.py]")]
  node_commission["Commission calculator<br/>[calculator.py]"]
  node_delivery["Delivery assignment<br/>[assignment.py]"]
  node_procurement["Purchase automation"]
end

subgraph group_intelligence["AI and automation"]
  node_ocr["Invoice OCR<br/>[ocr_engine.py]"]
  node_ai_forecast["Demand forecasting<br/>[forecast_engine.py]"]
  node_forecast_records[("Forecast records<br/>[forecast_engine.py]")]
  node_ai_engine["AI services<br/>[runner.py]"]
end

subgraph group_platform["Platform services"]
  node_tax_engine["Tax compliance<br/>[tax_engine.py]"]
  node_accounts["Accounts<br/>[views.py]"]
  node_saas["SaaS administration"]
  node_reporting["Reporting"]
end

subgraph group_engagement["Messaging and integrations"]
  node_whatsapp_bot["WhatsApp bot<br/>[bot_engine.py]"]
  node_conversation["Order conversation"]
  node_chatbot_flow["Chatbot flows<br/>[flow_engine.py]"]
end

node_user(("Business user"))
node_openai["OpenAI"]
node_tesseract["Tesseract OCR"]
node_pymupdf["PyMuPDF"]

node_user -->|"places order"| node_order_engine
node_order_engine -->|"creates and updates"| node_order_records
node_order_engine -->|"calculates commission"| node_commission
node_order_engine -->|"assigns partner"| node_delivery
node_whatsapp_bot -->|"runs order action"| node_conversation
node_ai_forecast -->|"reads sales history"| node_order_records
node_ai_forecast -->|"writes forecasts"| node_forecast_records
node_ocr -.->|"requests extraction"| node_openai
node_ocr -.->|"falls back to"| node_tesseract
node_ocr -.->|"extracts PDF text"| node_pymupdf

click node_order_engine "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/orders/services/order_engine.py"
click node_order_records "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/orders/services/order_engine.py"
click node_commission "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/commission/services/calculator.py"
click node_delivery "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/delivery/services/assignment.py"
click node_procurement "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/procurement/automation_engine.py"
click node_ocr "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_ocr/ocr_engine.py"
click node_ai_forecast "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_engine/services/forecast_engine.py"
click node_forecast_records "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_engine/services/forecast_engine.py"
click node_ai_engine "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_engine/services/runner.py"
click node_tax_engine "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/superapp/services/tax_engine.py"
click node_accounts "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/accounts/views.py"
click node_saas "https://github.com/amit1886/jaistechkhatabooksystem/tree/main/apps/platform/saas_ecosystem"
click node_reporting "https://github.com/amit1886/jaistechkhatabooksystem/tree/main/apps/platform/reporting"
click node_whatsapp_bot "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/whatsapp/services/bot_engine.py"
click node_conversation "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/commerce/services/whatsapp_conversation.py"
click node_chatbot_flow "https://github.com/amit1886/jaistechkhatabooksystem/blob/main/chatbot/services/flow_engine.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_order_engine,node_order_records,node_commission,node_delivery,node_procurement,node_user toneBlue
class node_ocr,node_ai_forecast,node_forecast_records,node_ai_engine toneAmber
class node_tax_engine,node_accounts,node_saas,node_reporting toneMint
class node_whatsapp_bot,node_conversation,node_chatbot_flow toneRose
class node_openai,node_tesseract,node_pymupdf toneIndigo
```

## Components

### Commerce and procurement

- [Order engine](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/orders/services/order_engine.py): `orders/services/order_engine.py`
- [Order records](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/orders/services/order_engine.py): `orders/services/order_engine.py`
- [Commission calculator](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/commission/services/calculator.py): `commission/services/calculator.py`
- [Delivery assignment](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/delivery/services/assignment.py): `delivery/services/assignment.py`
- [Purchase automation](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/procurement/automation_engine.py): `procurement/automation_engine.py`

### AI and automation

- [Invoice OCR](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_ocr/ocr_engine.py): `ai_ocr/ocr_engine.py`
- [Demand forecasting](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_engine/services/forecast_engine.py): `ai_engine/services/forecast_engine.py`
- [Forecast records](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_engine/services/forecast_engine.py): `ai_engine/services/forecast_engine.py`
- [AI services](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/ai_engine/services/runner.py): `ai_engine/services/runner.py`

### Platform services

- [Tax compliance](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/superapp/services/tax_engine.py): `superapp/services/tax_engine.py`
- [Accounts](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/accounts/views.py): `accounts/views.py`
- [SaaS administration](https://github.com/amit1886/jaistechkhatabooksystem/tree/main/apps/platform/saas_ecosystem): `apps/platform/saas_ecosystem`
- [Reporting](https://github.com/amit1886/jaistechkhatabooksystem/tree/main/apps/platform/reporting): `apps/platform/reporting`

### Messaging and integrations

- [WhatsApp bot](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/whatsapp/services/bot_engine.py): `whatsapp/services/bot_engine.py`
- [Order conversation](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/commerce/services/whatsapp_conversation.py): `commerce/services/whatsapp_conversation.py`
- [Chatbot flows](https://github.com/amit1886/jaistechkhatabooksystem/blob/main/chatbot/services/flow_engine.py): `chatbot/services/flow_engine.py`

### Other components

- **Business user**
- **OpenAI**
- **Tesseract OCR**
- **PyMuPDF**

## Connections

- Business user → Order engine: places order
- Order engine → Order records: creates and updates
- Order engine → Commission calculator: calculates commission
- Order engine → Delivery assignment: assigns partner
- WhatsApp bot → Order conversation: runs order action
- Demand forecasting → Order records: reads sales history
- Demand forecasting → Forecast records: writes forecasts
- Invoice OCR → OpenAI: requests extraction
- Invoice OCR → Tesseract OCR: falls back to
- Invoice OCR → PyMuPDF: extracts PDF text
