# santyx-afk/avtoxisobchidimed architecture

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

- Interactive diagram: https://gitdiagram.com/santyx-afk/avtoxisobchidimed
- Repository: https://github.com/santyx-afk/avtoxisobchidimed

## Overview

Dimed Salary is an HR payroll application for managing staff and calculating monthly pay from Hikvision IVMS attendance reports. The main workflow is to sign in, maintain employee terms, import an attendance report, calculate and save a month, then inspect results or history; advances and settings affect payroll calculations. Supabase is the production backend, with browser-local DEMO storage and a separate desktop mode. The README documents additional dashboard, rankings, export, and scheduled agent-upload capabilities; edges for unsampled relationships are limited to those documented or visible in indexed references.

Main entry points: [`src/lib/db.js`](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/db.js) (Data access layer), [`src/App.jsx`](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/App.jsx) (Application routes), [`src/lib/runCalculation.js`](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/runCalculation.js) (Calculation orchestration), [`src/pages/Calculate.jsx`](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Calculate.jsx) (IVMS report import)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and workspace"]
  node_app["Application routes<br/>[App.jsx]"]
  node_login["Sign-in<br/>[Login.jsx]"]
  node_auth["Authentication<br/>[auth.jsx]"]
end

subgraph group_workforce["Workforce management"]
  node_employees["Employee records<br/>[Employees.jsx]"]
  node_rategroups["Rate groups<br/>[RateGroups.jsx]"]
end

subgraph group_payroll["Payroll workflow"]
  node_attendance["IVMS report import<br/>[Calculate.jsx]"]
  node_filedecode["Report file decoding<br/>[readReportFile.js]"]
  node_calculation["Calculation orchestration<br/>[runCalculation.js]"]
  node_parser["IVMS parsing<br/>[ivmsParser.js]"]
  node_salary["Salary calculation<br/>[salaryCalc.js]"]
  node_advances["Advances<br/>[Advances.jsx]"]
  node_results["Salary details<br/>[SalaryDetail.jsx]"]
  node_monthlock["Month locking<br/>[monthLock.js]"]
end

subgraph group_storage["Data and integrations"]
  node_data["Data access layer<br/>[db.js]"]
  node_supabase[("Supabase database<br/>[realDb.js]")]
  node_localdb[("Local demo data<br/>[mockDb.js]")]
  node_agent["IVMS upload agent<br/>[ivms_agent.py]"]
  node_agentstorage["Agent report sync<br/>[agentStorage.js]"]
  node_bucket[("Supabase report storage")]
end

subgraph group_insights["Reporting and insights"]
  node_dashboard["Dashboard<br/>[Dashboard.jsx]"]
  node_history["Monthly history<br/>[History.jsx]"]
  node_ratings["Staff rankings<br/>[Ratings.jsx]"]
  node_settings["Payroll settings<br/>[Settings.jsx]"]
  node_excel["Excel export<br/>[excel.js]"]
end

node_staff(("HR staff"))

node_staff -.->|"uses"| node_app
node_app -->|"routes to"| node_login
node_app -->|"routes to"| node_dashboard
node_app -->|"routes to"| node_employees
node_app -->|"routes to"| node_attendance
node_app -->|"routes to"| node_advances
node_app -->|"routes to"| node_history
node_app -->|"routes to"| node_ratings
node_app -->|"routes to"| node_settings
node_login -.->|"authenticates with"| node_auth
node_auth -->|"uses auth"| node_supabase
node_employees -->|"manages records"| node_data
node_employees -->|"opens"| node_rategroups
node_rategroups -->|"reads settings"| node_data
node_attendance -->|"decodes report"| node_filedecode
node_attendance -->|"processes report"| node_calculation
node_calculation -->|"parses attendance"| node_parser
node_calculation -->|"calculates pay"| node_salary
node_calculation -->|"loads and saves"| node_data
node_attendance -->|"shows details"| node_results
node_results -.->|"edits attendance"| node_data
node_advances -->|"recalculates month"| node_calculation
node_attendance -->|"locks month"| node_monthlock
node_monthlock -->|"reads settings"| node_data
node_dashboard -->|"reads statistics"| node_data
node_dashboard -->|"checks agent reports"| node_agentstorage
node_history -->|"reads reports"| node_data
node_history -->|"exports workbook"| node_excel
node_ratings -.->|"reads payroll data"| node_data
node_settings -->|"updates settings"| node_data
node_data -->|"selects backend"| node_supabase
node_data -->|"selects backend"| node_localdb
node_agent -.->|"uploads reports"| node_bucket
node_agentstorage -->|"lists and downloads"| node_bucket
node_agentstorage -->|"processes new reports"| node_calculation
node_agentstorage -->|"checks and updates"| node_data

click node_app "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/App.jsx"
click node_login "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Login.jsx"
click node_auth "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/auth.jsx"
click node_employees "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Employees.jsx"
click node_rategroups "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/components/RateGroups.jsx"
click node_attendance "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Calculate.jsx"
click node_filedecode "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/readReportFile.js"
click node_calculation "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/runCalculation.js"
click node_parser "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/ivmsParser.js"
click node_salary "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/salaryCalc.js"
click node_advances "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Advances.jsx"
click node_results "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/components/SalaryDetail.jsx"
click node_monthlock "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/monthLock.js"
click node_dashboard "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Dashboard.jsx"
click node_history "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/History.jsx"
click node_ratings "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Ratings.jsx"
click node_settings "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Settings.jsx"
click node_data "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/db.js"
click node_supabase "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/realDb.js"
click node_localdb "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/mockDb.js"
click node_agent "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/agent/ivms_agent.py"
click node_agentstorage "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/agentStorage.js"
click node_excel "https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/excel.js"

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_auth toneBlue
class node_employees,node_rategroups toneAmber
class node_attendance,node_filedecode,node_calculation,node_parser,node_salary,node_advances,node_results,node_monthlock toneMint
class node_data,node_supabase,node_localdb,node_agent,node_agentstorage,node_bucket toneRose
class node_dashboard,node_history,node_ratings,node_settings,node_excel,node_staff toneIndigo
```

## Components

### Access and workspace

- [Application routes](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/App.jsx): `src/App.jsx`
- [Sign-in](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Login.jsx): `src/pages/Login.jsx`
- [Authentication](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/auth.jsx): `src/lib/auth.jsx`

### Workforce management

- [Employee records](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Employees.jsx): `src/pages/Employees.jsx`
- [Rate groups](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/components/RateGroups.jsx): `src/components/RateGroups.jsx`

### Payroll workflow

- [IVMS report import](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Calculate.jsx): `src/pages/Calculate.jsx`
- [Report file decoding](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/readReportFile.js): `src/lib/readReportFile.js`
- [Calculation orchestration](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/runCalculation.js): `src/lib/runCalculation.js`
- [IVMS parsing](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/ivmsParser.js): `src/lib/ivmsParser.js`
- [Salary calculation](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/salaryCalc.js): `src/lib/salaryCalc.js`
- [Advances](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Advances.jsx): `src/pages/Advances.jsx`
- [Salary details](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/components/SalaryDetail.jsx): `src/components/SalaryDetail.jsx`
- [Month locking](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/monthLock.js): `src/lib/monthLock.js`

### Data and integrations

- [Data access layer](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/db.js): `src/lib/db.js`
- [Supabase database](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/realDb.js): `src/lib/realDb.js`
- [Local demo data](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/mockDb.js): `src/lib/mockDb.js`
- [IVMS upload agent](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/agent/ivms_agent.py): `agent/ivms_agent.py`
- [Agent report sync](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/agentStorage.js): `src/lib/agentStorage.js`
- **Supabase report storage**

### Reporting and insights

- [Dashboard](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Dashboard.jsx): `src/pages/Dashboard.jsx`
- [Monthly history](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/History.jsx): `src/pages/History.jsx`
- [Staff rankings](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Ratings.jsx): `src/pages/Ratings.jsx`
- [Payroll settings](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/pages/Settings.jsx): `src/pages/Settings.jsx`
- [Excel export](https://github.com/santyx-afk/avtoxisobchidimed/blob/main/src/lib/excel.js): `src/lib/excel.js`

### Other components

- **HR staff**

## Connections

- HR staff → Application routes: uses
- Application routes → Sign-in: routes to (evidence: `src/App.jsx`)
- Application routes → Dashboard: routes to (evidence: `src/App.jsx`)
- Application routes → Employee records: routes to (evidence: `src/App.jsx`)
- Application routes → IVMS report import: routes to (evidence: `src/App.jsx`)
- Application routes → Advances: routes to (evidence: `src/App.jsx`)
- Application routes → Monthly history: routes to (evidence: `src/App.jsx`)
- Application routes → Staff rankings: routes to (evidence: `src/App.jsx`)
- Application routes → Payroll settings: routes to (evidence: `src/App.jsx`)
- Sign-in → Authentication: authenticates with
- Authentication → Supabase database: uses auth (evidence: `src/lib/auth.jsx`)
- Employee records → Data access layer: manages records (evidence: `src/pages/Employees.jsx`)
- Employee records → Rate groups: opens (evidence: `src/pages/Employees.jsx`)
- Rate groups → Data access layer: reads settings (evidence: `src/components/RateGroups.jsx`)
- IVMS report import → Report file decoding: decodes report (evidence: `src/pages/Calculate.jsx`)
- IVMS report import → Calculation orchestration: processes report (evidence: `src/pages/Calculate.jsx`)
- Calculation orchestration → IVMS parsing: parses attendance (evidence: `src/lib/runCalculation.js`)
- Calculation orchestration → Salary calculation: calculates pay (evidence: `src/lib/runCalculation.js`)
- Calculation orchestration → Data access layer: loads and saves (evidence: `src/lib/runCalculation.js`)
- IVMS report import → Salary details: shows details (evidence: `src/pages/Calculate.jsx`)
- Salary details → Data access layer: edits attendance
- Advances → Calculation orchestration: recalculates month (evidence: `src/pages/Advances.jsx`)
- IVMS report import → Month locking: locks month (evidence: `src/pages/Calculate.jsx`)
- Month locking → Data access layer: reads settings (evidence: `src/lib/monthLock.js`)
- Dashboard → Data access layer: reads statistics (evidence: `src/pages/Dashboard.jsx`)
- Dashboard → Agent report sync: checks agent reports (evidence: `src/pages/Dashboard.jsx`)
- Monthly history → Data access layer: reads reports (evidence: `src/pages/History.jsx`)
- Monthly history → Excel export: exports workbook (evidence: `src/pages/History.jsx`)
- Staff rankings → Data access layer: reads payroll data
- Payroll settings → Data access layer: updates settings (evidence: `src/pages/Settings.jsx`)
- Data access layer → Supabase database: selects backend (evidence: `src/lib/db.js`)
- Data access layer → Local demo data: selects backend (evidence: `src/lib/db.js`)
- IVMS upload agent → Supabase report storage: uploads reports (evidence: `README.md`)
- Agent report sync → Supabase report storage: lists and downloads (evidence: `src/lib/agentStorage.js`)
- Agent report sync → Calculation orchestration: processes new reports (evidence: `src/lib/agentStorage.js`)
- Agent report sync → Data access layer: checks and updates (evidence: `src/lib/agentStorage.js`)
