# quocquang/ph-n_t-ch_sales architecture

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

- Interactive diagram: https://gitdiagram.com/quocquang/ph-n_t-ch_sales
- Repository: https://github.com/quocquang/ph-n_t-ch_sales

## Overview

This is a Streamlit tool for turning monthly raw revenue-dashboard files and a payroll file into a KTV-TVV sheet, with branch/month revenue and payroll summaries, KPI checks, and downloadable detail. The excerpt shows revenue mapping and aggregation, payroll totals, warning calculations, and CSV table output. The upload and workbook-generation wiring is only partly sampled, so those links reflect the app’s stated purpose; unsampled implementation details are omitted.

Main entry points: [`app.py`](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py) (Streamlit app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Input processing"]
  node_app["Streamlit app<br/>[app.py]"]
  node_revenue_mapping["Revenue mapping<br/>[app.py]"]
  node_payroll_summary["Payroll summary<br/>[app.py]"]
end

subgraph group_analysis["Business analysis"]
  node_revenue_aggregation["Revenue aggregation<br/>[app.py]"]
  node_kpi_checks["KPI checks<br/>[app.py]"]
  node_performance_warnings["Performance warnings<br/>[app.py]"]
end

subgraph group_outputs["Reporting"]
  node_ktv_tvv_sheet["KTV-TVV sheet<br/>[app.py]"]
  node_detail_table["Branch detail table<br/>[app.py]"]
  node_csv_download["CSV download<br/>[app.py]"]
end

node_user(("Operator"))
node_revenue_files["Monthly revenue files"]
node_payroll_file["Payroll file"]

node_user -->|"uses"| node_app
node_revenue_files -->|"provides"| node_app
node_payroll_file -->|"provides"| node_app
node_app -->|"processes"| node_revenue_mapping
node_app -->|"processes"| node_payroll_summary
node_revenue_mapping -->|"maps data"| node_revenue_aggregation
node_app -->|"aggregates"| node_revenue_aggregation
node_app -->|"checks KPIs"| node_kpi_checks
node_app -->|"computes warnings"| node_performance_warnings
node_app -->|"generates"| node_ktv_tvv_sheet
node_app -->|"displays"| node_detail_table
node_detail_table -->|"exports"| node_csv_download

click node_app "https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py"
click node_revenue_mapping "https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py"
click node_payroll_summary "https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py"
click node_revenue_aggregation "https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py"
click node_kpi_checks "https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py"
click node_performance_warnings "https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py"
click node_ktv_tvv_sheet "https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py"
click node_detail_table "https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py"
click node_csv_download "https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.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_app,node_revenue_mapping,node_payroll_summary toneBlue
class node_revenue_aggregation,node_kpi_checks,node_performance_warnings toneAmber
class node_ktv_tvv_sheet,node_detail_table,node_csv_download toneMint
class node_user,node_revenue_files,node_payroll_file toneIndigo
```

## Components

### Input processing

- [Streamlit app](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py): `app.py`
- [Revenue mapping](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py): `app.py`
- [Payroll summary](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py): `app.py`

### Business analysis

- [Revenue aggregation](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py): `app.py`
- [KPI checks](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py): `app.py`
- [Performance warnings](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py): `app.py`

### Reporting

- [KTV-TVV sheet](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py): `app.py`
- [Branch detail table](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py): `app.py`
- [CSV download](https://github.com/quocquang/ph-n_t-ch_sales/blob/main/app.py): `app.py`

### Other components

- **Operator**
- **Monthly revenue files**
- **Payroll file**

## Connections

- Operator → Streamlit app: uses
- Monthly revenue files → Streamlit app: provides
- Payroll file → Streamlit app: provides
- Streamlit app → Revenue mapping: processes
- Streamlit app → Payroll summary: processes
- Revenue mapping → Revenue aggregation: maps data
- Streamlit app → Revenue aggregation: aggregates
- Streamlit app → KPI checks: checks KPIs
- Streamlit app → Performance warnings: computes warnings
- Streamlit app → KTV-TVV sheet: generates
- Streamlit app → Branch detail table: displays
- Branch detail table → CSV download: exports
