# pavithrankumaravel/kv-reports architecture

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

- Interactive diagram: https://gitdiagram.com/pavithrankumaravel/kv-reports
- Repository: https://github.com/pavithrankumaravel/kv-reports

## Overview

This Django application provides stock and owner-hand inventory reports for GPC, GSN, and TKG, plus combined owner-hand reports. The workflow is a browser request routed to a division’s report view, which queries SQL Server, applies report-specific filtering and weight rounding, and renders a report. The excerpts show these report and calculation paths, but not the project-level URL wiring or templates; links from an external browser are therefore marked unverified.

Main entry points: [`kvGPCApp/views.py`](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGPCApp/views.py) (GPC stock reports), [`kvGSNApp/views.py`](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGSNApp/views.py) (GSN stock reports), [`kvTKGApp/views.py`](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvTKGApp/views.py) (TKG stock reports), [`kvReportsApp/views.py`](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvReportsApp/views.py) (Combined owner reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_routing["Request routing"]
  node_gpc_urls["GPC routes<br/>[urls.py]"]
  node_gsn_urls["GSN routes<br/>[urls.py]"]
  node_tkg_urls["TKG routes<br/>[urls.py]"]
end

subgraph group_divisional["Division reports"]
  node_gpc_views["GPC stock reports<br/>[views.py]"]
  node_gsn_views["GSN stock reports<br/>[views.py]"]
  node_tkg_views["TKG stock reports<br/>[views.py]"]
end

subgraph group_combined["Combined reports"]
  node_combined_views["Combined owner reports<br/>[views.py]"]
end

subgraph group_calculation["Report calculations"]
  node_gpc_calc["GPC weight rounding<br/>[getFunction.py]"]
  node_gsn_calc["GSN weight rounding<br/>[getFunction.py]"]
  node_tkg_calc["TKG weight rounding<br/>[getFunction.py]"]
  node_combined_calc["Shared report calculations<br/>[getFunction.py]"]
end

node_browser(("Browser user"))
node_sqlserver[("SQL Server stock data")]

node_browser -.->|"requests reports"| node_gpc_urls
node_browser -.->|"requests reports"| node_gsn_urls
node_browser -.->|"requests reports"| node_tkg_urls
node_gpc_urls -->|"routes to"| node_gpc_views
node_gsn_urls -->|"routes to"| node_gsn_views
node_tkg_urls -->|"routes to"| node_tkg_views
node_gpc_views -->|"rounds weights"| node_gpc_calc
node_gsn_views -->|"rounds weights"| node_gsn_calc
node_tkg_views -->|"rounds weights"| node_tkg_calc
node_combined_views -->|"rounds weights"| node_combined_calc
node_gpc_views -->|"queries stock"| node_sqlserver
node_gsn_views -->|"queries stock"| node_sqlserver
node_tkg_views -->|"queries stock"| node_sqlserver
node_combined_views -->|"queries GPC and TKG"| node_sqlserver

click node_gpc_urls "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGPCApp/urls.py"
click node_gsn_urls "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGSNApp/urls.py"
click node_tkg_urls "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvTKGApp/urls.py"
click node_gpc_views "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGPCApp/views.py"
click node_gsn_views "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGSNApp/views.py"
click node_tkg_views "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvTKGApp/views.py"
click node_combined_views "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvReportsApp/views.py"
click node_gpc_calc "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGPCApp/getFunction.py"
click node_gsn_calc "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGSNApp/getFunction.py"
click node_tkg_calc "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvTKGApp/getFunction.py"
click node_combined_calc "https://github.com/pavithrankumaravel/kv-reports/blob/main/kvReportsApp/getFunction.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_gpc_urls,node_gsn_urls,node_tkg_urls,node_browser toneBlue
class node_gpc_views,node_gsn_views,node_tkg_views,node_sqlserver toneAmber
class node_combined_views toneMint
class node_gpc_calc,node_gsn_calc,node_tkg_calc,node_combined_calc toneRose
```

## Components

### Request routing

- [GPC routes](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGPCApp/urls.py): `kvGPCApp/urls.py`
- [GSN routes](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGSNApp/urls.py): `kvGSNApp/urls.py`
- [TKG routes](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvTKGApp/urls.py): `kvTKGApp/urls.py`

### Division reports

- [GPC stock reports](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGPCApp/views.py): `kvGPCApp/views.py`
- [GSN stock reports](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGSNApp/views.py): `kvGSNApp/views.py`
- [TKG stock reports](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvTKGApp/views.py): `kvTKGApp/views.py`

### Combined reports

- [Combined owner reports](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvReportsApp/views.py): `kvReportsApp/views.py`

### Report calculations

- [GPC weight rounding](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGPCApp/getFunction.py): `kvGPCApp/getFunction.py`
- [GSN weight rounding](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvGSNApp/getFunction.py): `kvGSNApp/getFunction.py`
- [TKG weight rounding](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvTKGApp/getFunction.py): `kvTKGApp/getFunction.py`
- [Shared report calculations](https://github.com/pavithrankumaravel/kv-reports/blob/main/kvReportsApp/getFunction.py): `kvReportsApp/getFunction.py`

### Other components

- **Browser user**
- **SQL Server stock data**

## Connections

- Browser user → GPC routes: requests reports
- Browser user → GSN routes: requests reports
- Browser user → TKG routes: requests reports
- GPC routes → GPC stock reports: routes to (evidence: `kvGPCApp/urls.py`)
- GSN routes → GSN stock reports: routes to (evidence: `kvGSNApp/urls.py`)
- TKG routes → TKG stock reports: routes to (evidence: `kvTKGApp/urls.py`)
- GPC stock reports → GPC weight rounding: rounds weights (evidence: `kvGPCApp/views.py`)
- GSN stock reports → GSN weight rounding: rounds weights (evidence: `kvGSNApp/views.py`)
- TKG stock reports → TKG weight rounding: rounds weights (evidence: `kvTKGApp/views.py`)
- Combined owner reports → Shared report calculations: rounds weights (evidence: `kvReportsApp/views.py`)
- GPC stock reports → SQL Server stock data: queries stock (evidence: `kvGPCApp/views.py`)
- GSN stock reports → SQL Server stock data: queries stock (evidence: `kvGSNApp/views.py`)
- TKG stock reports → SQL Server stock data: queries stock (evidence: `kvTKGApp/views.py`)
- Combined owner reports → SQL Server stock data: queries GPC and TKG (evidence: `kvReportsApp/views.py`)
