# bhumik1395/corob-crm architecture

> Architecture diagram of the GitHub repository bhumik1395/corob-crm, 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/bhumik1395/corob-crm
- Repository: https://github.com/bhumik1395/corob-crm

## Overview

This is a full-stack service-engineer operations and analytics application. Users authenticate, choose an operational dashboard or upload/manage data, and receive analytics, reports, or editable records. Distinct product areas include service calls, PM, installation, engineer performance, machine ownership, and point-table scoring. The backend exposes these domains through FastAPI and uses shared data-loading, database, and identity layers. The tree and excerpts support several workflows directly; other listed capabilities are represented without asserting unverified internal call chains.

Main entry points: [`backend/app/api/engineer.py`](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/api/engineer.py) (Engineer endpoints), [`frontend/src/App.tsx`](https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/App.tsx) (Dashboard application), [`backend/app/main.py`](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/main.py) (FastAPI application), [`backend/app/data/service_calls_repo.py`](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/data/service_calls_repo.py) (Service-call data loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Dashboard application<br/>[App.tsx]"]
  node_authui["Session context<br/>[AuthContext.tsx]"]
  node_engineerui["Engineer dashboard<br/>[EngineerPanel.tsx]"]
  node_visitsui["Engineer visits<br/>[EngineerVisits.tsx]"]
  node_engineerclient["Engineer API client<br/>[engineers.ts]"]
  node_pmui["PM dashboard and review<br/>[PmDashboard.tsx]"]
  node_pmclient["PM API client<br/>[pm.ts]"]
  node_uploadui["Upload interface<br/>[UploadPage.tsx]"]
end

subgraph group_api["API and access"]
  node_backend["FastAPI application<br/>[main.py]"]
  node_authapi["Authentication endpoints<br/>[login.py]"]
  node_engineerapi["Engineer endpoints<br/>[engineer.py]"]
end

subgraph group_analytics["Operational analytics"]
  node_service["Service-call analytics"]
  node_pm["PM workflows"]
  node_installation["Installation analytics"]
  node_engineeranalytics["Engineer analytics<br/>[analytics.py]"]
end

subgraph group_management["Data management"]
  node_ownershipapi["Machine ownership API<br/>[router.py]"]
  node_ownership["Ownership service and history<br/>[service.py]"]
  node_ownermodel["Ownership models<br/>[models.py]"]
  node_pointapi["Point-table API<br/>[router.py]"]
  node_pointanalytics["Point-table scoring<br/>[analytics.py]"]
  node_pointstorage["Point-table storage<br/>[storage.py]"]
end

subgraph group_shared["Shared data layer"]
  node_db[("Application database<br/>[db.py]")]
  node_config["Runtime configuration<br/>[config.py]"]
  node_sourcerepo["Source data repository<br/>[source_repo.py]"]
  node_sourcemap["Source definitions<br/>[source_map.py]"]
  node_svcdata["Service-call data loader"]
  node_serviceprocess["Service-call normalization<br/>[excel_service.py]"]
  node_employee_map["Employee mapping"]
  node_adapters["Domain access adapters<br/>[_adapters.py]"]
  node_common["Domain utilities<br/>[_common.py]"]
end

node_user(("Employee"))

node_user -.->|"uses"| node_app
node_app -.->|"provides session"| node_authui
node_app -.->|"renders"| node_engineerui
node_engineerui -->|"requests analytics"| node_engineerclient
node_visitsui -->|"requests visits"| node_engineerclient
node_engineerclient -->|"calls endpoints"| node_engineerapi
node_engineerapi -->|"computes results"| node_engineeranalytics
node_engineerapi -->|"loads service data"| node_service
node_engineerapi -->|"loads PM data"| node_pm
node_engineerapi -->|"loads installation data"| node_installation
node_app -.->|"renders"| node_pmui
node_pmui -->|"uses API"| node_pmclient
node_app -.->|"renders"| node_uploadui
node_backend -->|"registers routes"| node_engineerapi
node_backend -->|"registers routes"| node_authapi
node_backend -->|"registers routes"| node_ownershipapi
node_backend -->|"registers routes"| node_pointapi
node_ownershipapi -->|"delegates"| node_ownership
node_ownership -->|"uses records"| node_ownermodel
node_pointapi -->|"computes scores"| node_pointanalytics
node_pointapi -->|"reads and writes"| node_pointstorage
node_pointstorage -->|"queries database"| node_db
node_pointstorage -->|"reads ownership"| node_ownermodel
node_svcdata -->|"loads raw data"| node_sourcerepo
node_sourcerepo -->|"uses source definition"| node_sourcemap
node_svcdata -->|"normalizes rows"| node_serviceprocess
node_svcdata -->|"learns mappings"| node_employee_map

click node_app "https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/auth/AuthContext.tsx"
click node_engineerui "https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/components/engineers/EngineerPanel.tsx"
click node_visitsui "https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/components/engineers/EngineerVisits.tsx"
click node_engineerclient "https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/api/engineers.ts"
click node_pmui "https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/pages/customer/PmDashboard.tsx"
click node_pmclient "https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/api/pm.ts"
click node_uploadui "https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/pages/UploadPage.tsx"
click node_backend "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/main.py"
click node_authapi "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/api/login.py"
click node_engineerapi "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/api/engineer.py"
click node_service "https://github.com/bhumik1395/corob-crm/tree/main/backend/app/domains/service_calls"
click node_pm "https://github.com/bhumik1395/corob-crm/tree/main/backend/app/domains/pm"
click node_installation "https://github.com/bhumik1395/corob-crm/tree/main/backend/app/domains/installation"
click node_engineeranalytics "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/engineers/analytics.py"
click node_ownershipapi "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/machine_ownership/router.py"
click node_ownership "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/machine_ownership/service.py"
click node_ownermodel "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/machine_ownership/models.py"
click node_pointapi "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/point_table/router.py"
click node_pointanalytics "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/point_table/analytics.py"
click node_pointstorage "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/point_table/storage.py"
click node_db "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/core/db.py"
click node_config "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/core/config.py"
click node_sourcerepo "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/data/source_repo.py"
click node_sourcemap "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/data/source_map.py"
click node_svcdata "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/data/service_calls_repo.py"
click node_serviceprocess "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/service_calls/excel_service.py"
click node_employee_map "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/shared/employee_mapping_service.py"
click node_adapters "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/_adapters.py"
click node_common "https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/_common.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_app,node_authui,node_engineerui,node_visitsui,node_engineerclient,node_pmui,node_pmclient,node_uploadui toneBlue
class node_backend,node_authapi,node_engineerapi toneAmber
class node_service,node_pm,node_installation,node_engineeranalytics toneMint
class node_ownershipapi,node_ownership,node_ownermodel,node_pointapi,node_pointanalytics,node_pointstorage toneRose
class node_db,node_config,node_sourcerepo,node_sourcemap,node_svcdata,node_serviceprocess,node_employee_map,node_adapters,node_common,node_user toneIndigo
```

## Components

### Web application

- [Dashboard application](https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Session context](https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/auth/AuthContext.tsx): `frontend/src/auth/AuthContext.tsx`
- [Engineer dashboard](https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/components/engineers/EngineerPanel.tsx): `frontend/src/components/engineers/EngineerPanel.tsx`
- [Engineer visits](https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/components/engineers/EngineerVisits.tsx): `frontend/src/components/engineers/EngineerVisits.tsx`
- [Engineer API client](https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/api/engineers.ts): `frontend/src/api/engineers.ts`
- [PM dashboard and review](https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/pages/customer/PmDashboard.tsx): `frontend/src/pages/customer/PmDashboard.tsx`
- [PM API client](https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/api/pm.ts): `frontend/src/api/pm.ts`
- [Upload interface](https://github.com/bhumik1395/corob-crm/blob/main/frontend/src/pages/UploadPage.tsx): `frontend/src/pages/UploadPage.tsx`

### API and access

- [FastAPI application](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/main.py): `backend/app/main.py`
- [Authentication endpoints](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/api/login.py): `backend/app/api/login.py`
- [Engineer endpoints](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/api/engineer.py): `backend/app/api/engineer.py`

### Operational analytics

- [Service-call analytics](https://github.com/bhumik1395/corob-crm/tree/main/backend/app/domains/service_calls): `backend/app/domains/service_calls`
- [PM workflows](https://github.com/bhumik1395/corob-crm/tree/main/backend/app/domains/pm): `backend/app/domains/pm`
- [Installation analytics](https://github.com/bhumik1395/corob-crm/tree/main/backend/app/domains/installation): `backend/app/domains/installation`
- [Engineer analytics](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/engineers/analytics.py): `backend/app/domains/engineers/analytics.py`

### Data management

- [Machine ownership API](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/machine_ownership/router.py): `backend/app/domains/machine_ownership/router.py`
- [Ownership service and history](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/machine_ownership/service.py): `backend/app/domains/machine_ownership/service.py`
- [Ownership models](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/machine_ownership/models.py): `backend/app/domains/machine_ownership/models.py`
- [Point-table API](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/point_table/router.py): `backend/app/domains/point_table/router.py`
- [Point-table scoring](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/point_table/analytics.py): `backend/app/domains/point_table/analytics.py`
- [Point-table storage](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/point_table/storage.py): `backend/app/domains/point_table/storage.py`

### Shared data layer

- [Application database](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/core/db.py): `backend/app/core/db.py`
- [Runtime configuration](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/core/config.py): `backend/app/core/config.py`
- [Source data repository](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/data/source_repo.py): `backend/app/data/source_repo.py`
- [Source definitions](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/data/source_map.py): `backend/app/data/source_map.py`
- [Service-call data loader](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/data/service_calls_repo.py): `backend/app/data/service_calls_repo.py`
- [Service-call normalization](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/service_calls/excel_service.py): `backend/app/domains/service_calls/excel_service.py`
- [Employee mapping](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/shared/employee_mapping_service.py): `backend/app/shared/employee_mapping_service.py`
- [Domain access adapters](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/_adapters.py): `backend/app/domains/_adapters.py`
- [Domain utilities](https://github.com/bhumik1395/corob-crm/blob/main/backend/app/domains/_common.py): `backend/app/domains/_common.py`

### Other components

- **Employee**

## Connections

- Employee → Dashboard application: uses
- Dashboard application → Session context: provides session
- Dashboard application → Engineer dashboard: renders
- Engineer dashboard → Engineer API client: requests analytics (evidence: `frontend/src/components/engineers/EngineerPanel.tsx`)
- Engineer visits → Engineer API client: requests visits (evidence: `frontend/src/components/engineers/EngineerVisits.tsx`)
- Engineer API client → Engineer endpoints: calls endpoints (evidence: `frontend/src/api/engineers.ts`)
- Engineer endpoints → Engineer analytics: computes results (evidence: `backend/app/api/engineer.py`)
- Engineer endpoints → Service-call analytics: loads service data (evidence: `backend/app/api/engineer.py`)
- Engineer endpoints → PM workflows: loads PM data (evidence: `backend/app/api/engineer.py`)
- Engineer endpoints → Installation analytics: loads installation data (evidence: `backend/app/api/engineer.py`)
- Dashboard application → PM dashboard and review: renders
- PM dashboard and review → PM API client: uses API
- Dashboard application → Upload interface: renders
- FastAPI application → Engineer endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Authentication endpoints: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Machine ownership API: registers routes (evidence: `backend/app/main.py`)
- FastAPI application → Point-table API: registers routes (evidence: `backend/app/main.py`)
- Machine ownership API → Ownership service and history: delegates (evidence: `backend/app/domains/machine_ownership/router.py`)
- Ownership service and history → Ownership models: uses records (evidence: `backend/app/domains/machine_ownership/service.py`)
- Point-table API → Point-table scoring: computes scores (evidence: `backend/app/domains/point_table/router.py`)
- Point-table API → Point-table storage: reads and writes (evidence: `backend/app/domains/point_table/router.py`)
- Point-table storage → Application database: queries database (evidence: `backend/app/domains/point_table/storage.py`)
- Point-table storage → Ownership models: reads ownership (evidence: `backend/app/domains/point_table/storage.py`)
- Service-call data loader → Source data repository: loads raw data (evidence: `backend/app/data/service_calls_repo.py`)
- Source data repository → Source definitions: uses source definition (evidence: `backend/app/data/service_calls_repo.py`)
- Service-call data loader → Service-call normalization: normalizes rows (evidence: `backend/app/data/service_calls_repo.py`)
- Service-call data loader → Employee mapping: learns mappings (evidence: `backend/app/data/service_calls_repo.py`)
