# dheeraj416/upi-merchant-analytics architecture

> Architecture diagram of the GitHub repository dheeraj416/upi-merchant-analytics, 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/dheeraj416/upi-merchant-analytics
- Repository: https://github.com/dheeraj416/upi-merchant-analytics

## Overview

This repository is a UPI merchant-onboarding analytics case study: it synthesizes a 50,000-lead funnel, analyzes KYC drop-off and unrealized GMV, prototypes document OCR and identity matching, and simulates projected activation uplift. The main user workflow runs the report assembler, which generates or loads leads and produces analysis, charts, and report content. The graph preserves the separate OCR-evaluation workflow; unsampled modules are included where the README or source index establishes their role, but only evidenced relationships are connected.

Main entry points: [`scripts/06_build_report.py`](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/scripts/06_build_report.py) (Report Assembler), [`scripts/04_kyc_ocr_pipeline_demo.py`](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/scripts/04_kyc_ocr_pipeline_demo.py) (OCR Evaluation Runner), [`src/upi_analytics/config.py`](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/config.py) (Calibrated Assumptions), [`src/upi_analytics/data_generation.py`](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/data_generation.py) (Synthetic Lead Data)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_dataset["Funnel Dataset"]
  node_config["Calibrated Assumptions<br/>[config.py]"]
  node_lead_data["Synthetic Lead Data<br/>[data_generation.py]"]
end

subgraph group_analysis["Business Analytics"]
  node_funnel["Funnel Analysis<br/>[funnel_analysis.py]"]
  node_gmv["GMV Quantification"]
end

subgraph group_verification["KYC Verification"]
  node_kyc_docs["Synthetic KYC Documents<br/>[kyc_documents.py]"]
  node_ocr["Document OCR<br/>[ocr_engine.py]"]
  node_identity["Identity Matching"]
end

subgraph group_simulation["Impact Simulation"]
  node_nudge["Nudge Simulation"]
end

node_analyst(("Analyst"))
node_report_runner["Report Assembler<br/>[06_build_report.py]"]
node_ocr_demo["OCR Evaluation Runner"]

node_analyst -->|"runs"| node_report_runner
node_report_runner -->|"generates or loads"| node_lead_data
node_lead_data -->|"uses assumptions"| node_config
node_report_runner -->|"computes and plots"| node_funnel
node_report_runner -->|"quantifies and plots"| node_gmv
node_gmv -->|"uses assumptions"| node_config
node_report_runner -.-> node_ocr_demo
node_ocr_demo -->|"generates cases"| node_kyc_docs
node_ocr_demo -->|"extracts fields"| node_ocr
node_ocr_demo -->|"evaluates matches"| node_identity
node_identity -->|"consumes extraction"| node_ocr
node_ocr_demo -.-> node_report_runner
node_report_runner -->|"simulates scenarios"| node_nudge
node_nudge -->|"uses assumptions"| node_config

click node_report_runner "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/scripts/06_build_report.py"
click node_config "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/config.py"
click node_lead_data "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/data_generation.py"
click node_funnel "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/funnel_analysis.py"
click node_gmv "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/gmv_quantification.py"
click node_kyc_docs "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/kyc_documents.py"
click node_ocr "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/ocr_engine.py"
click node_identity "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/identity_matcher.py"
click node_nudge "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/nudge_simulation.py"
click node_ocr_demo "https://github.com/dheeraj416/upi-merchant-analytics/blob/main/scripts/04_kyc_ocr_pipeline_demo.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_config,node_lead_data toneBlue
class node_funnel,node_gmv toneAmber
class node_kyc_docs,node_ocr,node_identity toneMint
class node_nudge toneRose
class node_analyst toneIndigo
class node_report_runner,node_ocr_demo toneTeal
```

## Components

### Funnel Dataset

- [Calibrated Assumptions](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/config.py): `src/upi_analytics/config.py`
- [Synthetic Lead Data](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/data_generation.py): `src/upi_analytics/data_generation.py`

### Business Analytics

- [Funnel Analysis](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/funnel_analysis.py): `src/upi_analytics/funnel_analysis.py`
- [GMV Quantification](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/gmv_quantification.py): `src/upi_analytics/gmv_quantification.py`

### KYC Verification

- [Synthetic KYC Documents](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/kyc_documents.py): `src/upi_analytics/kyc_documents.py`
- [Document OCR](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/ocr_engine.py): `src/upi_analytics/ocr_engine.py`
- [Identity Matching](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/identity_matcher.py): `src/upi_analytics/identity_matcher.py`

### Impact Simulation

- [Nudge Simulation](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/src/upi_analytics/nudge_simulation.py): `src/upi_analytics/nudge_simulation.py`

### Other components

- **Analyst**
- [Report Assembler](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/scripts/06_build_report.py): `scripts/06_build_report.py`
- [OCR Evaluation Runner](https://github.com/dheeraj416/upi-merchant-analytics/blob/main/scripts/04_kyc_ocr_pipeline_demo.py): `scripts/04_kyc_ocr_pipeline_demo.py`

## Connections

- Analyst → Report Assembler: runs (evidence: `README.md`)
- Report Assembler → Synthetic Lead Data: generates or loads (evidence: `scripts/06_build_report.py`)
- Synthetic Lead Data → Calibrated Assumptions: uses assumptions (evidence: `src/upi_analytics/data_generation.py`)
- Report Assembler → Funnel Analysis: computes and plots (evidence: `scripts/06_build_report.py`)
- Report Assembler → GMV Quantification: quantifies and plots (evidence: `scripts/06_build_report.py`)
- GMV Quantification → Calibrated Assumptions: uses assumptions (evidence: `src/upi_analytics/gmv_quantification.py`)
- Report Assembler → OCR Evaluation Runner
- OCR Evaluation Runner → Synthetic KYC Documents: generates cases (evidence: `scripts/04_kyc_ocr_pipeline_demo.py`)
- OCR Evaluation Runner → Document OCR: extracts fields (evidence: `scripts/04_kyc_ocr_pipeline_demo.py`)
- OCR Evaluation Runner → Identity Matching: evaluates matches (evidence: `scripts/04_kyc_ocr_pipeline_demo.py`)
- Identity Matching → Document OCR: consumes extraction (evidence: `src/upi_analytics/identity_matcher.py`)
- OCR Evaluation Runner → Report Assembler
- Report Assembler → Nudge Simulation: simulates scenarios (evidence: `scripts/06_build_report.py`)
- Nudge Simulation → Calibrated Assumptions: uses assumptions (evidence: `src/upi_analytics/nudge_simulation.py`)
