# divyashreekm05/infocars architecture

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

- Interactive diagram: https://gitdiagram.com/divyashreekm05/infocars
- Repository: https://github.com/divyashreekm05/infocars

## Overview

DealSense is a car lease/loan contract assistant whose main workflow accepts a contract or vehicle VIN, extracts document text or vehicle details, estimates fair market value, and provides negotiation guidance. Its documented capabilities also include document cleanup, market insights, chat history, and login. The repository contains several overlapping API/server implementations; the graph shows their evidenced responsibilities without treating them as one proven runtime chain. Some frontend and API wiring is unsampled, so those connections are omitted or marked unverified.

Main entry points: [`backend/app/vin_decoder.py`](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/vin_decoder.py) (VIN Decoder), [`backend/app/valuation.py`](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/valuation.py) (Price Valuation), [`backend/app/api1.py`](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/api1.py) (FastAPI Variant), [`backend/app/api.py`](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/api.py) (Unified API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_webui["Web Interface<br/>[app.js]"]
end

subgraph group_api["API Entry Points"]
  node_flask["Unified Flask Server<br/>[server1.py]"]
  node_flask_legacy["Flask Server<br/>[server.py]"]
  node_api_main["Unified API<br/>[api.py]"]
  node_api_v1["FastAPI Variant<br/>[api1.py]"]
  node_api_v3["FastAPI Variant<br/>[api3.py]"]
  node_auth["Login Auth<br/>[auth.py]"]
end

subgraph group_vehicle["Vehicle Intelligence"]
  node_vin["VIN Decoder<br/>[vin_decoder.py]"]
  node_valuation["Price Valuation<br/>[valuation.py]"]
  node_negotiation["Negotiation Engine<br/>[negotiation.py]"]
end

subgraph group_documents["Document Processing"]
  node_ocr["Hybrid OCR<br/>[ocr.py]"]
  node_preprocess["Image Cleanup<br/>[preprocessing.py]"]
  node_analysis["Contract Analysis<br/>[negotiation.py]"]
  node_sqlite[("OCR Results<br/>[database.py]")]
end

node_buyer(("Buyer"))
node_nhtsa["NHTSA"]
node_marketcheck["MarketCheck"]
node_groq["Groq AI"]
node_gemini["Gemini AI"]
node_document["Contract File"]

node_buyer -.->|"uses"| node_webui
node_buyer -.->|"uploads"| node_document
node_webui -.->|"requests"| node_flask_legacy
node_flask_legacy -->|"serves"| node_webui
node_flask_legacy -->|"delegates"| node_api_main
node_flask -->|"decodes VIN"| node_vin
node_flask -->|"estimates price"| node_valuation
node_flask -->|"requests advice"| node_negotiation
node_api_main -->|"decodes VIN"| node_vin
node_api_main -->|"estimates price"| node_valuation
node_api_main -->|"requests advice"| node_negotiation
node_api_v1 -->|"decodes VIN"| node_vin
node_api_v1 -->|"estimates price"| node_valuation
node_api_v1 -->|"extracts text"| node_ocr
node_api_v1 -->|"analyzes text"| node_analysis
node_api_v3 -->|"decodes VIN"| node_vin
node_api_v3 -->|"estimates price"| node_valuation
node_vin -->|"queries"| node_nhtsa
node_valuation -->|"queries listings"| node_marketcheck
node_negotiation -->|"generates advice"| node_groq
node_document -.->|"provides pages"| node_ocr
node_ocr -.->|"cleans scans"| node_preprocess
node_ocr -->|"saves results"| node_sqlite
node_negotiation -.->|"may use"| node_gemini
node_auth -.->|"supports login"| node_flask

click node_webui "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/frontend/app.js"
click node_flask "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/server1.py"
click node_flask_legacy "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/server.py"
click node_api_main "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/api.py"
click node_api_v1 "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/api1.py"
click node_api_v3 "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/api3.py"
click node_auth "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/auth.py"
click node_vin "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/vin_decoder.py"
click node_valuation "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/valuation.py"
click node_negotiation "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/negotiation.py"
click node_ocr "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/ocr.py"
click node_preprocess "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/preprocessing.py"
click node_analysis "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/negotiation.py"
click node_sqlite "https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/database.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_webui toneBlue
class node_flask,node_flask_legacy,node_api_main,node_api_v1,node_api_v3,node_auth toneAmber
class node_vin,node_valuation,node_negotiation toneMint
class node_ocr,node_preprocess,node_analysis,node_sqlite toneRose
class node_buyer,node_nhtsa,node_marketcheck,node_groq,node_gemini,node_document toneIndigo
```

## Components

### User Experience

- [Web Interface](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/frontend/app.js): `frontend/app.js`

### API Entry Points

- [Unified Flask Server](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/server1.py): `server1.py`
- [Flask Server](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/server.py): `server.py`
- [Unified API](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/api.py): `backend/app/api.py`
- [FastAPI Variant](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/api1.py): `backend/app/api1.py`
- [FastAPI Variant](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/api3.py): `backend/app/api3.py`
- [Login Auth](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/auth.py): `auth.py`

### Vehicle Intelligence

- [VIN Decoder](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/vin_decoder.py): `backend/app/vin_decoder.py`
- [Price Valuation](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/valuation.py): `backend/app/valuation.py`
- [Negotiation Engine](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/negotiation.py): `backend/app/negotiation.py`

### Document Processing

- [Hybrid OCR](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/ocr.py): `backend/app/ocr.py`
- [Image Cleanup](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/preprocessing.py): `backend/app/preprocessing.py`
- [Contract Analysis](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/negotiation.py): `backend/app/negotiation.py`
- [OCR Results](https://github.com/divyashreekm05/infocars/blob/AI_CarAssistant-Divyashree/backend/app/database.py): `backend/app/database.py`

### Other components

- **Buyer**
- **NHTSA**
- **MarketCheck**
- **Groq AI**
- **Gemini AI**
- **Contract File**

## Connections

- Buyer → Web Interface: uses (evidence: `README.md`)
- Buyer → Contract File: uploads (evidence: `README.md`)
- Web Interface → Flask Server: requests (evidence: `README.md`)
- Flask Server → Web Interface: serves (evidence: `server.py`)
- Flask Server → Unified API: delegates (evidence: `server.py`)
- Unified Flask Server → VIN Decoder: decodes VIN (evidence: `server1.py`)
- Unified Flask Server → Price Valuation: estimates price (evidence: `server1.py`)
- Unified Flask Server → Negotiation Engine: requests advice (evidence: `server1.py`)
- Unified API → VIN Decoder: decodes VIN (evidence: `backend/app/api.py`)
- Unified API → Price Valuation: estimates price (evidence: `backend/app/api.py`)
- Unified API → Negotiation Engine: requests advice (evidence: `backend/app/api.py`)
- FastAPI Variant → VIN Decoder: decodes VIN (evidence: `backend/app/api1.py`)
- FastAPI Variant → Price Valuation: estimates price (evidence: `backend/app/api1.py`)
- FastAPI Variant → Hybrid OCR: extracts text (evidence: `backend/app/api1.py`)
- FastAPI Variant → Contract Analysis: analyzes text (evidence: `backend/app/api1.py`)
- FastAPI Variant → VIN Decoder: decodes VIN (evidence: `backend/app/api3.py`)
- FastAPI Variant → Price Valuation: estimates price (evidence: `backend/app/api3.py`)
- VIN Decoder → NHTSA: queries (evidence: `backend/app/vin_decoder.py`)
- Price Valuation → MarketCheck: queries listings (evidence: `backend/app/valuation.py`)
- Negotiation Engine → Groq AI: generates advice (evidence: `backend/app/negotiation.py`)
- Contract File → Hybrid OCR: provides pages (evidence: `README.md`)
- Hybrid OCR → Image Cleanup: cleans scans (evidence: `README.md`)
- Hybrid OCR → OCR Results: saves results (evidence: `backend/app/ocr.py`)
- Negotiation Engine → Gemini AI: may use (evidence: `README.md`)
- Login Auth → Unified Flask Server: supports login
