# nihalgk/parkguru-ai architecture

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

- Interactive diagram: https://gitdiagram.com/nihalgk/parkguru-ai
- Repository: https://github.com/nihalgk/parkguru-ai

## Overview

ParkGuru is a video-based parking-compliance system. Its primary user flow is dashboard video upload, API analysis, vehicle detection and tracking, stationary classification, compliance-state updates, and Gemini-enriched results returned to the dashboard. A separate compliance workflow resolves plate identities, looks up registry details, and builds warnings; OCR is an optional identity input. Edges reflect the shown API and orchestrator calls or README-documented behavior; unsampled integration details are omitted or marked unverified.

Main entry points: [`parkguru/api/main.py`](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/api/main.py) (Analysis API), [`parkguru/orchestrator/pipeline_orchestrator.py`](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/orchestrator/pipeline_orchestrator.py) (Pipeline orchestrator), [`parkguru/compliance/vahan_gateway.py`](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/compliance/vahan_gateway.py) (VAHAN registry gateway), [`frontend/src/App.tsx`](https://github.com/nihalgk/parkguru-ai/blob/main/frontend/src/App.tsx) (React dashboard)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_presentation["Dashboard and API"]
  node_dashboard["React dashboard<br/>[App.tsx]"]
  node_api["Analysis API<br/>[main.py]"]
end

subgraph group_vision["Video and Compliance Detection"]
  node_tracking["Vehicle tracking"]
  node_stationary["Stationary detection"]
end

subgraph group_decision["Compliance Decisions"]
  node_orchestrator["Pipeline orchestrator"]
  node_state["Compliance state engine<br/>[state_engine.py]"]
  node_profiler["Pipeline profiler<br/>[profiler.py]"]
end

subgraph group_enrichment["Identity and Enrichment"]
  node_gemini["Gemini enrichment<br/>[gemini.py]"]
  node_ocr["Plate OCR<br/>[ocr_pipeline.py]"]
  node_identity["Vehicle identity"]
  node_vahan["VAHAN registry gateway<br/>[vahan_gateway.py]"]
  node_warnings["Warning generator"]
end

node_driver(("Video uploader"))
node_gemini_service{{"Google Gemini"}}
node_registry[("VAHAN registry")]

node_driver -->|"uploads video"| node_dashboard
node_dashboard -->|"submits analysis"| node_api
node_api -->|"processes video"| node_tracking
node_api -->|"feeds tracking stream"| node_orchestrator
node_orchestrator -->|"classifies motion"| node_stationary
node_orchestrator -->|"updates state"| node_state
node_tracking -->|"records timings"| node_profiler
node_orchestrator -->|"records timings"| node_profiler
node_api -->|"enriches results"| node_gemini
node_gemini -.->|"requests generation"| node_gemini_service
node_api -->|"returns results"| node_dashboard
node_identity -.->|"may use provider"| node_ocr
node_identity -->|"provides plate lookup"| node_vahan
node_vahan -.->|"looks up plate"| node_registry
node_vahan -->|"supplies registry data"| node_warnings

click node_dashboard "https://github.com/nihalgk/parkguru-ai/blob/main/frontend/src/App.tsx"
click node_api "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/api/main.py"
click node_tracking "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/core/tracking_pipeline.py"
click node_stationary "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/core/stationary_detector.py"
click node_orchestrator "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/orchestrator/pipeline_orchestrator.py"
click node_state "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/core/state_engine.py"
click node_profiler "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/core/profiler.py"
click node_gemini "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/backend/gemini.py"
click node_ocr "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/compliance/ocr_pipeline.py"
click node_identity "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/compliance/identity_manager.py"
click node_vahan "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/compliance/vahan_gateway.py"
click node_warnings "https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/compliance/warning_generator.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_dashboard,node_api toneBlue
class node_tracking,node_stationary,node_registry toneAmber
class node_orchestrator,node_state,node_profiler toneMint
class node_gemini,node_ocr,node_identity,node_vahan,node_warnings toneRose
class node_driver,node_gemini_service toneIndigo
```

## Components

### Dashboard and API

- [React dashboard](https://github.com/nihalgk/parkguru-ai/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Analysis API](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/api/main.py): `parkguru/api/main.py`

### Video and Compliance Detection

- [Vehicle tracking](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/core/tracking_pipeline.py): `parkguru/core/tracking_pipeline.py`
- [Stationary detection](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/core/stationary_detector.py): `parkguru/core/stationary_detector.py`

### Compliance Decisions

- [Pipeline orchestrator](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/orchestrator/pipeline_orchestrator.py): `parkguru/orchestrator/pipeline_orchestrator.py`
- [Compliance state engine](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/core/state_engine.py): `parkguru/core/state_engine.py`
- [Pipeline profiler](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/core/profiler.py): `parkguru/core/profiler.py`

### Identity and Enrichment

- [Gemini enrichment](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/backend/gemini.py): `parkguru/backend/gemini.py`
- [Plate OCR](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/compliance/ocr_pipeline.py): `parkguru/compliance/ocr_pipeline.py`
- [Vehicle identity](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/compliance/identity_manager.py): `parkguru/compliance/identity_manager.py`
- [VAHAN registry gateway](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/compliance/vahan_gateway.py): `parkguru/compliance/vahan_gateway.py`
- [Warning generator](https://github.com/nihalgk/parkguru-ai/blob/main/parkguru/compliance/warning_generator.py): `parkguru/compliance/warning_generator.py`

### Other components

- **Video uploader**
- **Google Gemini**
- **VAHAN registry**

## Connections

- Video uploader → React dashboard: uploads video (evidence: `README.md`)
- React dashboard → Analysis API: submits analysis (evidence: `README.md`)
- Analysis API → Vehicle tracking: processes video (evidence: `parkguru/api/main.py`)
- Analysis API → Pipeline orchestrator: feeds tracking stream (evidence: `parkguru/api/main.py`)
- Pipeline orchestrator → Stationary detection: classifies motion (evidence: `parkguru/orchestrator/pipeline_orchestrator.py`)
- Pipeline orchestrator → Compliance state engine: updates state (evidence: `parkguru/orchestrator/pipeline_orchestrator.py`)
- Vehicle tracking → Pipeline profiler: records timings (evidence: `parkguru/core/tracking_pipeline.py`)
- Pipeline orchestrator → Pipeline profiler: records timings (evidence: `parkguru/orchestrator/pipeline_orchestrator.py`)
- Analysis API → Gemini enrichment: enriches results (evidence: `parkguru/api/main.py`)
- Gemini enrichment → Google Gemini: requests generation
- Analysis API → React dashboard: returns results (evidence: `README.md`)
- Vehicle identity → Plate OCR: may use provider
- Vehicle identity → VAHAN registry gateway: provides plate lookup (evidence: `full_pipeline_runner.py`)
- VAHAN registry gateway → VAHAN registry: looks up plate
- VAHAN registry gateway → Warning generator: supplies registry data (evidence: `full_pipeline_runner.py`)
