# harushhh/grid_tools architecture

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

- Interactive diagram: https://gitdiagram.com/harushhh/grid_tools
- Repository: https://github.com/harushhh/grid_tools

## Overview

Grid tools converts insurer rate grids and commission documents into portal upload CSVs, with insurer-specific rules; the README describes the input formats and output behavior. The web app provides a job-running interface, while preflight, insurer review, edge-case capture, and feedback tools support checking and improving uploads. The graph includes all listed converter scripts and the SOURCE INDEX core modules. Some tool internals and app routes were not sampled, so uncertain connections are omitted.

Main entry points: [`webapp/src/agent.js`](https://github.com/harushhh/grid_tools/blob/main/webapp/src/agent.js) (Job agent), [`webapp/src/app.js`](https://github.com/harushhh/grid_tools/blob/main/webapp/src/app.js) (HTTP routes), [`liberty_grid_to_config.py`](https://github.com/harushhh/grid_tools/blob/main/liberty_grid_to_config.py) (Liberty converter), [`magma_grid_to_config.py`](https://github.com/harushhh/grid_tools/blob/main/magma_grid_to_config.py) (Magma converter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_conversion["Grid conversion"]
  node_liberty["Liberty converter"]
  node_magma["Magma converter"]
  node_rsa_gcv["RSA GCV converter"]
  node_rsa_car["RSA car converter"]
  node_united["United converter"]
  node_shriram_broker["Shriram broker converter"]
  node_shriram_tw["Shriram 2W converter"]
  node_godigit["Go Digit converter"]
  node_sbi["SBI converter"]
  node_icici["ICICI converter"]
  node_indusind["IndusInd converter"]
end

subgraph group_webapp["Job web app"]
  node_web_ui["Browser interface<br/>[app.js]"]
  node_http_app["HTTP routes<br/>[app.js]"]
  node_script_registry["Converter registry<br/>[registry.js]"]
  node_agent["Job agent<br/>[agent.js]"]
  node_runner["Converter runner<br/>[runner.js]"]
  node_memory["Rule memory<br/>[memory.js]"]
  node_db[("SQLite database<br/>[db.js]")]
  node_job_store["Job store<br/>[store.js]"]
end

subgraph group_quality["Upload quality"]
  node_preflight["Upload preflight<br/>[preflight_check.py]"]
  node_month_diff["Month comparison<br/>[mom_diff.py]"]
  node_grid_doctor["Grid diagnostics<br/>[grid_doctor.py]"]
end

subgraph group_improvement["Review and learning"]
  node_feedback["Correction feedback<br/>[loop.py]"]
  node_review_lib["CSV comparison<br/>[review_lib.py]"]
  node_edge_capture["Flag capture<br/>[capture.py]"]
  node_wording["Wording proposals<br/>[llm_proposer.py]"]
end

node_operator(("Operator"))
node_grid_input["Insurer grid"]
node_upload_csv["Upload CSV"]
node_web_user(("Web user"))

node_operator -->|"runs with grid"| node_liberty
node_operator -->|"runs with grids"| node_magma
node_operator -->|"runs with grid"| node_rsa_gcv
node_operator -->|"runs with grid"| node_rsa_car
node_operator -->|"runs with circular"| node_united
node_operator -->|"runs with grid"| node_shriram_broker
node_operator -->|"runs with grid"| node_shriram_tw
node_operator -->|"runs with grid"| node_godigit
node_operator -->|"runs with grid"| node_sbi
node_operator -->|"runs with grids"| node_icici
node_operator -->|"runs with grid"| node_indusind
node_grid_input -->|"provides workbook"| node_liberty
node_grid_input -->|"provides grids"| node_magma
node_grid_input -->|"provides workbook"| node_rsa_gcv
node_grid_input -->|"provides workbook"| node_rsa_car
node_grid_input -->|"provides PDF"| node_united
node_grid_input -->|"provides workbook"| node_shriram_broker
node_grid_input -->|"provides grids"| node_shriram_tw
node_grid_input -->|"provides workbook"| node_godigit
node_grid_input -->|"provides workbook"| node_sbi
node_grid_input -->|"provides workbooks"| node_icici
node_grid_input -->|"provides workbook"| node_indusind
node_liberty -->|"writes CSV"| node_upload_csv
node_magma -->|"writes CSV"| node_upload_csv
node_rsa_gcv -->|"writes CSV"| node_upload_csv
node_rsa_car -->|"writes CSV"| node_upload_csv
node_united -->|"writes CSV"| node_upload_csv
node_shriram_broker -->|"writes CSV"| node_upload_csv
node_shriram_tw -->|"writes CSV"| node_upload_csv
node_godigit -->|"writes CSV"| node_upload_csv
node_sbi -->|"writes CSV"| node_upload_csv
node_icici -->|"writes CSV"| node_upload_csv
node_indusind -->|"writes CSV"| node_upload_csv
node_web_user -->|"uses"| node_web_ui
node_web_ui -.->|"requests jobs"| node_http_app
node_http_app -->|"lists scripts"| node_script_registry
node_http_app -.->|"creates jobs"| node_agent
node_agent -->|"selects converter"| node_script_registry
node_agent -->|"runs converter"| node_runner
node_agent -->|"matches rules"| node_memory
node_memory -->|"reads and writes"| node_db
node_job_store -.->|"stores jobs"| node_db
node_operator -->|"checks upload"| node_preflight
node_upload_csv -->|"validates"| node_preflight
node_operator -->|"compares grids"| node_month_diff
node_operator -.->|"diagnoses grid"| node_grid_doctor
node_operator -->|"reviews corrections"| node_feedback
node_feedback -->|"compares CSVs"| node_review_lib

click node_liberty "https://github.com/harushhh/grid_tools/blob/main/liberty_grid_to_config.py"
click node_magma "https://github.com/harushhh/grid_tools/blob/main/magma_grid_to_config.py"
click node_rsa_gcv "https://github.com/harushhh/grid_tools/blob/main/rsa_gcv4w_comp_to_config.py"
click node_rsa_car "https://github.com/harushhh/grid_tools/blob/main/rsa_pvtcar_to_config.py"
click node_united "https://github.com/harushhh/grid_tools/blob/main/united_commission_to_config.py"
click node_shriram_broker "https://github.com/harushhh/grid_tools/blob/main/shriram_broker_grid_to_config.py"
click node_shriram_tw "https://github.com/harushhh/grid_tools/blob/main/shriram_2w_to_config.py"
click node_godigit "https://github.com/harushhh/grid_tools/blob/main/godigit_agency_to_config.py"
click node_sbi "https://github.com/harushhh/grid_tools/blob/main/sbi_grid_to_config.py"
click node_icici "https://github.com/harushhh/grid_tools/blob/main/icici_grid_to_config.py"
click node_indusind "https://github.com/harushhh/grid_tools/blob/main/indusind_grid_to_config.py"
click node_web_ui "https://github.com/harushhh/grid_tools/blob/main/webapp/public/app.js"
click node_http_app "https://github.com/harushhh/grid_tools/blob/main/webapp/src/app.js"
click node_script_registry "https://github.com/harushhh/grid_tools/blob/main/webapp/src/registry.js"
click node_agent "https://github.com/harushhh/grid_tools/blob/main/webapp/src/agent.js"
click node_runner "https://github.com/harushhh/grid_tools/blob/main/webapp/src/runner.js"
click node_memory "https://github.com/harushhh/grid_tools/blob/main/webapp/src/memory.js"
click node_db "https://github.com/harushhh/grid_tools/blob/main/webapp/src/db.js"
click node_job_store "https://github.com/harushhh/grid_tools/blob/main/webapp/src/store.js"
click node_preflight "https://github.com/harushhh/grid_tools/blob/main/tools/preflight/preflight_check.py"
click node_month_diff "https://github.com/harushhh/grid_tools/blob/main/tools/preflight/mom_diff.py"
click node_grid_doctor "https://github.com/harushhh/grid_tools/blob/main/grid_doctor.py"
click node_feedback "https://github.com/harushhh/grid_tools/blob/main/tools/feedback/loop.py"
click node_review_lib "https://github.com/harushhh/grid_tools/blob/main/tools/insurer_review/review_lib.py"
click node_edge_capture "https://github.com/harushhh/grid_tools/blob/main/tools/edge_cases/capture.py"
click node_wording "https://github.com/harushhh/grid_tools/blob/main/tools/wording_proposer/llm_proposer.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_liberty,node_magma,node_rsa_gcv,node_rsa_car,node_united,node_shriram_broker,node_shriram_tw,node_godigit,node_sbi,node_icici,node_indusind,node_web_user toneBlue
class node_web_ui,node_http_app,node_script_registry,node_agent,node_runner,node_memory,node_db,node_job_store toneAmber
class node_preflight,node_month_diff,node_grid_doctor toneMint
class node_feedback,node_review_lib,node_edge_capture,node_wording toneRose
class node_operator,node_grid_input,node_upload_csv toneIndigo
```

## Components

### Grid conversion

- [Liberty converter](https://github.com/harushhh/grid_tools/blob/main/liberty_grid_to_config.py): `liberty_grid_to_config.py`
- [Magma converter](https://github.com/harushhh/grid_tools/blob/main/magma_grid_to_config.py): `magma_grid_to_config.py`
- [RSA GCV converter](https://github.com/harushhh/grid_tools/blob/main/rsa_gcv4w_comp_to_config.py): `rsa_gcv4w_comp_to_config.py`
- [RSA car converter](https://github.com/harushhh/grid_tools/blob/main/rsa_pvtcar_to_config.py): `rsa_pvtcar_to_config.py`
- [United converter](https://github.com/harushhh/grid_tools/blob/main/united_commission_to_config.py): `united_commission_to_config.py`
- [Shriram broker converter](https://github.com/harushhh/grid_tools/blob/main/shriram_broker_grid_to_config.py): `shriram_broker_grid_to_config.py`
- [Shriram 2W converter](https://github.com/harushhh/grid_tools/blob/main/shriram_2w_to_config.py): `shriram_2w_to_config.py`
- [Go Digit converter](https://github.com/harushhh/grid_tools/blob/main/godigit_agency_to_config.py): `godigit_agency_to_config.py`
- [SBI converter](https://github.com/harushhh/grid_tools/blob/main/sbi_grid_to_config.py): `sbi_grid_to_config.py`
- [ICICI converter](https://github.com/harushhh/grid_tools/blob/main/icici_grid_to_config.py): `icici_grid_to_config.py`
- [IndusInd converter](https://github.com/harushhh/grid_tools/blob/main/indusind_grid_to_config.py): `indusind_grid_to_config.py`

### Job web app

- [Browser interface](https://github.com/harushhh/grid_tools/blob/main/webapp/public/app.js): `webapp/public/app.js`
- [HTTP routes](https://github.com/harushhh/grid_tools/blob/main/webapp/src/app.js): `webapp/src/app.js`
- [Converter registry](https://github.com/harushhh/grid_tools/blob/main/webapp/src/registry.js): `webapp/src/registry.js`
- [Job agent](https://github.com/harushhh/grid_tools/blob/main/webapp/src/agent.js): `webapp/src/agent.js`
- [Converter runner](https://github.com/harushhh/grid_tools/blob/main/webapp/src/runner.js): `webapp/src/runner.js`
- [Rule memory](https://github.com/harushhh/grid_tools/blob/main/webapp/src/memory.js): `webapp/src/memory.js`
- [SQLite database](https://github.com/harushhh/grid_tools/blob/main/webapp/src/db.js): `webapp/src/db.js`
- [Job store](https://github.com/harushhh/grid_tools/blob/main/webapp/src/store.js): `webapp/src/store.js`

### Upload quality

- [Upload preflight](https://github.com/harushhh/grid_tools/blob/main/tools/preflight/preflight_check.py): `tools/preflight/preflight_check.py`
- [Month comparison](https://github.com/harushhh/grid_tools/blob/main/tools/preflight/mom_diff.py): `tools/preflight/mom_diff.py`
- [Grid diagnostics](https://github.com/harushhh/grid_tools/blob/main/grid_doctor.py): `grid_doctor.py`

### Review and learning

- [Correction feedback](https://github.com/harushhh/grid_tools/blob/main/tools/feedback/loop.py): `tools/feedback/loop.py`
- [CSV comparison](https://github.com/harushhh/grid_tools/blob/main/tools/insurer_review/review_lib.py): `tools/insurer_review/review_lib.py`
- [Flag capture](https://github.com/harushhh/grid_tools/blob/main/tools/edge_cases/capture.py): `tools/edge_cases/capture.py`
- [Wording proposals](https://github.com/harushhh/grid_tools/blob/main/tools/wording_proposer/llm_proposer.py): `tools/wording_proposer/llm_proposer.py`

### Other components

- **Operator**
- **Insurer grid**
- **Upload CSV**
- **Web user**

## Connections

- Operator → Liberty converter: runs with grid (evidence: `README.md`)
- Operator → Magma converter: runs with grids (evidence: `README.md`)
- Operator → RSA GCV converter: runs with grid (evidence: `README.md`)
- Operator → RSA car converter: runs with grid (evidence: `README.md`)
- Operator → United converter: runs with circular (evidence: `README.md`)
- Operator → Shriram broker converter: runs with grid (evidence: `README.md`)
- Operator → Shriram 2W converter: runs with grid (evidence: `README.md`)
- Operator → Go Digit converter: runs with grid (evidence: `README.md`)
- Operator → SBI converter: runs with grid (evidence: `README.md`)
- Operator → ICICI converter: runs with grids (evidence: `README.md`)
- Operator → IndusInd converter: runs with grid (evidence: `README.md`)
- Insurer grid → Liberty converter: provides workbook (evidence: `README.md`)
- Insurer grid → Magma converter: provides grids (evidence: `README.md`)
- Insurer grid → RSA GCV converter: provides workbook (evidence: `README.md`)
- Insurer grid → RSA car converter: provides workbook (evidence: `README.md`)
- Insurer grid → United converter: provides PDF (evidence: `README.md`)
- Insurer grid → Shriram broker converter: provides workbook (evidence: `README.md`)
- Insurer grid → Shriram 2W converter: provides grids (evidence: `README.md`)
- Insurer grid → Go Digit converter: provides workbook (evidence: `README.md`)
- Insurer grid → SBI converter: provides workbook (evidence: `README.md`)
- Insurer grid → ICICI converter: provides workbooks (evidence: `README.md`)
- Insurer grid → IndusInd converter: provides workbook (evidence: `README.md`)
- Liberty converter → Upload CSV: writes CSV (evidence: `README.md`)
- Magma converter → Upload CSV: writes CSV (evidence: `README.md`)
- RSA GCV converter → Upload CSV: writes CSV (evidence: `README.md`)
- RSA car converter → Upload CSV: writes CSV (evidence: `README.md`)
- United converter → Upload CSV: writes CSV (evidence: `README.md`)
- Shriram broker converter → Upload CSV: writes CSV (evidence: `README.md`)
- Shriram 2W converter → Upload CSV: writes CSV (evidence: `README.md`)
- Go Digit converter → Upload CSV: writes CSV (evidence: `README.md`)
- SBI converter → Upload CSV: writes CSV (evidence: `README.md`)
- ICICI converter → Upload CSV: writes CSV (evidence: `README.md`)
- IndusInd converter → Upload CSV: writes CSV (evidence: `README.md`)
- Web user → Browser interface: uses
- Browser interface → HTTP routes: requests jobs
- HTTP routes → Converter registry: lists scripts (evidence: `webapp/src/app.js`)
- HTTP routes → Job agent: creates jobs (evidence: `webapp/src/app.js`)
- Job agent → Converter registry: selects converter (evidence: `webapp/src/agent.js`)
- Job agent → Converter runner: runs converter (evidence: `webapp/src/agent.js`)
- Job agent → Rule memory: matches rules (evidence: `webapp/src/agent.js`)
- Rule memory → SQLite database: reads and writes (evidence: `webapp/src/memory.js`)
- Job store → SQLite database: stores jobs (evidence: `webapp/src/store.js`)
- Operator → Upload preflight: checks upload (evidence: `tools/preflight/preflight_check.py`)
- Upload CSV → Upload preflight: validates (evidence: `tools/preflight/preflight_check.py`)
- Operator → Month comparison: compares grids (evidence: `tools/preflight/mom_diff.py`)
- Operator → Grid diagnostics: diagnoses grid
- Operator → Correction feedback: reviews corrections (evidence: `tools/feedback/loop.py`)
- Correction feedback → CSV comparison: compares CSVs (evidence: `tools/feedback/loop.py`)
