# infominergroup-develops/pd-automation architecture

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

- Interactive diagram: https://gitdiagram.com/infominergroup-develops/pd-automation
- Repository: https://github.com/infominergroup-develops/pd-automation

## Overview

Infominer PD Automator supports credit and field staff through login, company/client selection, applicant assessment, field evidence capture, and report printing. Its main product is the PD underwriting workflow, with separate authentication, credit-bureau extraction, and client-specific reporting capabilities. The README documents AI summaries and QnA autofill, but the sampled source does not show their implementation or wiring. The README describes MongoDB, while the sampled backend imports Firestore; the graph avoids asserting a specific database relationship.

Main entry points: [`src/components/PDToolView.tsx`](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/PDToolView.tsx) (PD assessment), [`src/App.tsx`](https://github.com/infominergroup-develops/pd-automation/blob/main/src/App.tsx) (App workflow), [`api/index.ts`](https://github.com/infominergroup-develops/pd-automation/blob/main/api/index.ts) (API routes), [`src/services/api.ts`](https://github.com/infominergroup-develops/pd-automation/blob/main/src/services/api.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and setup"]
  node_app["App workflow<br/>[App.tsx]"]
  node_login["Authentication view<br/>[AuthView.tsx]"]
  node_company["Company selection"]
  node_client["Client selection"]
  node_banks["Client configuration<br/>[clientBanksData.ts]"]
  node_employee["Employee management"]
end

subgraph group_underwriting["PD underwriting"]
  node_pd["PD assessment<br/>[PDToolView.tsx]"]
  node_field["Field investigation"]
  node_photo["Photo evidence"]
  node_saved["Saved PD values<br/>[savedValues.ts]"]
  node_business["Business details"]
  node_supplier["Customer supplier details"]
  node_decision["Credit decision"]
  node_ai["AI summary"]
  node_qna["QnA autofill"]
end

subgraph group_credit["Credit reports"]
  node_extract["Credit report extraction"]
  node_factory["Parser selection<br/>[ParserFactory.ts]"]
  node_cibil["CIBIL parsing<br/>[CibilParser.ts]"]
  node_crif["CRIF parsing<br/>[CrifParser.ts]"]
  node_normalize["Report normalization<br/>[normalizeReport.ts]"]
  node_formatters["Value formatting<br/>[formatters.ts]"]
end

subgraph group_reporting["Report output"]
  node_printer["PD report printer<br/>[pdReportPrinter.ts]"]
  node_templates["Client report templates"]
  node_excel["Excel template parsing"]
end

subgraph group_backend["Backend services"]
  node_api["API client<br/>[api.ts]"]
  node_server["API routes<br/>[index.ts]"]
  node_auth["Auth services<br/>[auth.ts]"]
  node_db[("Application database")]
end

node_staff(("Credit staff"))
node_gemini{{"Google Gemini"}}
node_drive{{"Google Drive"}}

node_staff -->|"starts session"| node_login
node_login -->|"submits login"| node_api
node_api -->|"sends requests"| node_server
node_server -->|"uses auth"| node_auth
node_app -->|"renders"| node_login
node_app -->|"renders"| node_company
node_app -->|"routes to"| node_client
node_staff -->|"selects company"| node_company
node_staff -->|"selects client"| node_client
node_client -->|"uses choices"| node_banks
node_app -->|"opens assessment"| node_pd
node_app -->|"renders"| node_employee
node_pd -->|"supports investigation"| node_field
node_field -->|"manages evidence"| node_photo
node_photo -->|"uploads photos"| node_api
node_pd -->|"saves assessment"| node_api
node_pd -->|"uses saved values"| node_saved
node_pd -.->|"captures details"| node_business
node_pd -.->|"captures contacts"| node_supplier
node_pd -.->|"supports review"| node_decision
node_pd -->|"requests summary"| node_ai
node_ai -->|"synthesizes notes"| node_gemini
node_pd -->|"offers autofill"| node_qna
node_staff -.->|"submits report"| node_extract
node_extract -->|"requests extraction"| node_api
node_server -->|"uses parser"| node_factory
node_factory -->|"selects parser"| node_cibil
node_factory -->|"selects parser"| node_crif
node_cibil -->|"normalizes report"| node_normalize
node_crif -->|"normalizes report"| node_normalize
node_normalize -->|"parses values"| node_formatters
node_pd -->|"prints report"| node_printer
node_printer -->|"selects template"| node_templates
node_staff -->|"uploads template"| node_excel
node_server -->|"parses template"| node_excel
node_server -.->|"reads and writes"| node_db
node_pd -.->|"backs up reports"| node_drive

click node_app "https://github.com/infominergroup-develops/pd-automation/blob/main/src/App.tsx"
click node_login "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/AuthView.tsx"
click node_company "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/CompanySelectionView.tsx"
click node_client "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/ClientSelectionView.tsx"
click node_banks "https://github.com/infominergroup-develops/pd-automation/blob/main/src/data/clientBanksData.ts"
click node_employee "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/EmployeeManagementView.tsx"
click node_pd "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/PDToolView.tsx"
click node_field "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/fieldInvestigation/FieldInvestigationSection.tsx"
click node_photo "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/fieldInvestigation/usePhotoEvidence.ts"
click node_saved "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/savedValues.ts"
click node_business "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/coApplicantBusiness/CoApplicantBusinessSection.tsx"
click node_supplier "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/customerSupplier/CustomerSupplierSection.tsx"
click node_decision "https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/DecisionSection.tsx"
click node_api "https://github.com/infominergroup-develops/pd-automation/blob/main/src/services/api.ts"
click node_server "https://github.com/infominergroup-develops/pd-automation/blob/main/api/index.ts"
click node_auth "https://github.com/infominergroup-develops/pd-automation/blob/main/api/auth.ts"
click node_extract "https://github.com/infominergroup-develops/pd-automation/blob/main/src/services/clientPdfExtractor.ts"
click node_factory "https://github.com/infominergroup-develops/pd-automation/blob/main/api/parsers/ParserFactory.ts"
click node_cibil "https://github.com/infominergroup-develops/pd-automation/blob/main/api/parsers/cibil/CibilParser.ts"
click node_crif "https://github.com/infominergroup-develops/pd-automation/blob/main/api/parsers/crif/CrifParser.ts"
click node_normalize "https://github.com/infominergroup-develops/pd-automation/blob/main/api/parsers/normalization/normalizeReport.ts"
click node_formatters "https://github.com/infominergroup-develops/pd-automation/blob/main/api/utils/formatters.ts"
click node_printer "https://github.com/infominergroup-develops/pd-automation/blob/main/src/utils/pdReportPrinter.ts"
click node_templates "https://github.com/infominergroup-develops/pd-automation/blob/main/src/utils/templates/moneyboxxTemplate.ts"
click node_excel "https://github.com/infominergroup-develops/pd-automation/blob/main/api/excelTemplateService.ts"

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_login,node_company,node_client,node_banks,node_employee toneBlue
class node_pd,node_field,node_photo,node_saved,node_business,node_supplier,node_decision,node_ai,node_qna toneAmber
class node_extract,node_factory,node_cibil,node_crif,node_normalize,node_formatters toneMint
class node_printer,node_templates,node_excel toneRose
class node_api,node_server,node_auth,node_db,node_staff,node_gemini,node_drive toneIndigo
```

## Components

### Access and setup

- [App workflow](https://github.com/infominergroup-develops/pd-automation/blob/main/src/App.tsx): `src/App.tsx`
- [Authentication view](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/AuthView.tsx): `src/components/AuthView.tsx`
- [Company selection](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/CompanySelectionView.tsx): `src/components/CompanySelectionView.tsx`
- [Client selection](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/ClientSelectionView.tsx): `src/components/ClientSelectionView.tsx`
- [Client configuration](https://github.com/infominergroup-develops/pd-automation/blob/main/src/data/clientBanksData.ts): `src/data/clientBanksData.ts`
- [Employee management](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/EmployeeManagementView.tsx): `src/components/EmployeeManagementView.tsx`

### PD underwriting

- [PD assessment](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/PDToolView.tsx): `src/components/PDToolView.tsx`
- [Field investigation](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/fieldInvestigation/FieldInvestigationSection.tsx): `src/components/pd/fieldInvestigation/FieldInvestigationSection.tsx`
- [Photo evidence](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/fieldInvestigation/usePhotoEvidence.ts): `src/components/pd/fieldInvestigation/usePhotoEvidence.ts`
- [Saved PD values](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/savedValues.ts): `src/components/pd/savedValues.ts`
- [Business details](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/coApplicantBusiness/CoApplicantBusinessSection.tsx): `src/components/pd/coApplicantBusiness/CoApplicantBusinessSection.tsx`
- [Customer supplier details](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/customerSupplier/CustomerSupplierSection.tsx): `src/components/pd/customerSupplier/CustomerSupplierSection.tsx`
- [Credit decision](https://github.com/infominergroup-develops/pd-automation/blob/main/src/components/pd/DecisionSection.tsx): `src/components/pd/DecisionSection.tsx`
- **AI summary**
- **QnA autofill**

### Credit reports

- [Credit report extraction](https://github.com/infominergroup-develops/pd-automation/blob/main/src/services/clientPdfExtractor.ts): `src/services/clientPdfExtractor.ts`
- [Parser selection](https://github.com/infominergroup-develops/pd-automation/blob/main/api/parsers/ParserFactory.ts): `api/parsers/ParserFactory.ts`
- [CIBIL parsing](https://github.com/infominergroup-develops/pd-automation/blob/main/api/parsers/cibil/CibilParser.ts): `api/parsers/cibil/CibilParser.ts`
- [CRIF parsing](https://github.com/infominergroup-develops/pd-automation/blob/main/api/parsers/crif/CrifParser.ts): `api/parsers/crif/CrifParser.ts`
- [Report normalization](https://github.com/infominergroup-develops/pd-automation/blob/main/api/parsers/normalization/normalizeReport.ts): `api/parsers/normalization/normalizeReport.ts`
- [Value formatting](https://github.com/infominergroup-develops/pd-automation/blob/main/api/utils/formatters.ts): `api/utils/formatters.ts`

### Report output

- [PD report printer](https://github.com/infominergroup-develops/pd-automation/blob/main/src/utils/pdReportPrinter.ts): `src/utils/pdReportPrinter.ts`
- [Client report templates](https://github.com/infominergroup-develops/pd-automation/blob/main/src/utils/templates/moneyboxxTemplate.ts): `src/utils/templates/moneyboxxTemplate.ts`
- [Excel template parsing](https://github.com/infominergroup-develops/pd-automation/blob/main/api/excelTemplateService.ts): `api/excelTemplateService.ts`

### Backend services

- [API client](https://github.com/infominergroup-develops/pd-automation/blob/main/src/services/api.ts): `src/services/api.ts`
- [API routes](https://github.com/infominergroup-develops/pd-automation/blob/main/api/index.ts): `api/index.ts`
- [Auth services](https://github.com/infominergroup-develops/pd-automation/blob/main/api/auth.ts): `api/auth.ts`
- **Application database**

### Other components

- **Credit staff**
- **Google Gemini**
- **Google Drive**

## Connections

- Credit staff → Authentication view: starts session (evidence: `README.md`)
- Authentication view → API client: submits login (evidence: `README.md`)
- API client → API routes: sends requests (evidence: `src/services/api.ts`)
- API routes → Auth services: uses auth (evidence: `api/index.ts`)
- App workflow → Authentication view: renders (evidence: `src/App.tsx`)
- App workflow → Company selection: renders (evidence: `src/App.tsx`)
- App workflow → Client selection: routes to (evidence: `README.md`)
- Credit staff → Company selection: selects company (evidence: `README.md`)
- Credit staff → Client selection: selects client (evidence: `README.md`)
- Client selection → Client configuration: uses choices (evidence: `src/components/ClientSelectionView.tsx`)
- App workflow → PD assessment: opens assessment (evidence: `README.md`)
- App workflow → Employee management: renders (evidence: `src/App.tsx`)
- PD assessment → Field investigation: supports investigation (evidence: `README.md`)
- Field investigation → Photo evidence: manages evidence (evidence: `src/components/pd/fieldInvestigation/usePhotoEvidence.ts`)
- Photo evidence → API client: uploads photos (evidence: `src/components/pd/fieldInvestigation/usePhotoEvidence.ts`)
- PD assessment → API client: saves assessment (evidence: `README.md`)
- PD assessment → Saved PD values: uses saved values
- PD assessment → Business details: captures details
- PD assessment → Customer supplier details: captures contacts
- PD assessment → Credit decision: supports review
- PD assessment → AI summary: requests summary (evidence: `README.md`)
- AI summary → Google Gemini: synthesizes notes (evidence: `README.md`)
- PD assessment → QnA autofill: offers autofill (evidence: `README.md`)
- Credit staff → Credit report extraction: submits report
- Credit report extraction → API client: requests extraction (evidence: `src/services/clientPdfExtractor.ts`)
- API routes → Parser selection: uses parser (evidence: `api/index.ts`)
- Parser selection → CIBIL parsing: selects parser (evidence: `api/parsers/ParserFactory.ts`)
- Parser selection → CRIF parsing: selects parser (evidence: `api/parsers/ParserFactory.ts`)
- CIBIL parsing → Report normalization: normalizes report (evidence: `api/parsers/cibil/CibilParser.ts`)
- CRIF parsing → Report normalization: normalizes report (evidence: `api/parsers/crif/CrifParser.ts`)
- Report normalization → Value formatting: parses values (evidence: `api/parsers/normalization/normalizeReport.ts`)
- PD assessment → PD report printer: prints report (evidence: `README.md`)
- PD report printer → Client report templates: selects template (evidence: `src/utils/pdReportPrinter.ts`)
- Credit staff → Excel template parsing: uploads template
- API routes → Excel template parsing: parses template (evidence: `api/index.ts`)
- API routes → Application database: reads and writes
- PD assessment → Google Drive: backs up reports
