# nihalswe/attendance_system architecture

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

- Interactive diagram: https://gitdiagram.com/nihalswe/attendance_system
- Repository: https://github.com/nihalswe/attendance_system

## Overview

The tree contains a substantial Django attendance and workforce-management application, while the README describes planning material for a separate future project and explicitly says it is not connected to the current project. The graph therefore reflects the runtime modules indicated by the source index, not the README’s proposed design. Core attendance, device ingestion, scheduling, leave, payroll, tenant access, and webhook capabilities are represented; some subsystem links remain unverified because the relevant call sites were not excerpted.

Main entry points: [`attendance/services.py`](https://github.com/nihalswe/attendance_system/blob/main/attendance/services.py) (Attendance calculation), [`payroll/services.py`](https://github.com/nihalswe/attendance_system/blob/main/payroll/services.py) (Payroll calculations), [`access_control/branch_access.py`](https://github.com/nihalswe/attendance_system/blob/main/access_control/branch_access.py) (Branch permissions), [`leaves/services.py`](https://github.com/nihalswe/attendance_system/blob/main/leaves/services.py) (Leave workflows)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_tenant["Tenant and access"]
  node_company[("Company and features<br/>[models.py]")]
  node_accounts[("Accounts and memberships<br/>[models.py]")]
  node_branch_access["Branch permissions<br/>[branch_access.py]"]
  node_audit["Audit events<br/>[services.py]"]
  node_api_domains["Versioned API domains"]
end

subgraph group_workforce["Workforce and organization"]
  node_employees[("Employee records<br/>[models.py]")]
  node_organization["Organization services<br/>[services.py]"]
  node_organization_data[("Branches and departments<br/>[models.py]")]
end

subgraph group_time["Time and devices"]
  node_device_ingestion["Device ingestion<br/>[ingestion.py]"]
  node_device_data[("Device records<br/>[models.py]")]
  node_attendance["Attendance calculation<br/>[services.py]"]
  node_attendance_data[("Attendance records<br/>[models.py]")]
end

subgraph group_people_ops["Leave and scheduling"]
  node_scheduling[("Shifts and calendar<br/>[models.py]")]
  node_calendar["Calendar lookup<br/>[calendar.py]"]
  node_leave["Leave workflows<br/>[services.py]"]
end

subgraph group_payroll_integrations["Payroll and integrations"]
  node_payroll["Payroll calculations<br/>[services.py]"]
  node_payroll_data[("Payroll records<br/>[models.py]")]
  node_webhooks["Attendance webhooks<br/>[services.py]"]
  node_reports["Reports<br/>[builders.py]"]
end

node_operator(("Company user"))

node_device_ingestion -->|"uses device records"| node_device_data
node_device_ingestion -->|"submits attendance"| node_attendance
node_attendance -->|"writes calculations"| node_attendance_data
node_attendance -->|"uses device data"| node_device_data
node_attendance -->|"uses shift rules"| node_scheduling
node_attendance -->|"uses calendar"| node_calendar
node_attendance -.->|"reads leave data"| node_leave
node_attendance -.->|"references payroll data"| node_payroll_data
node_attendance -.->|"notifies attendance"| node_webhooks
node_payroll -->|"uses attendance"| node_attendance
node_payroll -->|"uses payroll records"| node_payroll_data
node_payroll -->|"uses schedule data"| node_scheduling
node_organization -->|"writes organization"| node_organization_data
node_organization -->|"records changes"| node_audit
node_leave -.->|"references attendance"| node_attendance
node_leave -->|"checks branch access"| node_branch_access
node_operator -.->|"uses API"| node_api_domains
node_branch_access -->|"checks membership"| node_accounts
node_branch_access -->|"scopes branches"| node_organization_data
node_employees -->|"references placements"| node_organization_data

click node_company "https://github.com/nihalswe/attendance_system/blob/main/tenants/models.py"
click node_accounts "https://github.com/nihalswe/attendance_system/blob/main/accounts/models.py"
click node_branch_access "https://github.com/nihalswe/attendance_system/blob/main/access_control/branch_access.py"
click node_employees "https://github.com/nihalswe/attendance_system/blob/main/employees/models.py"
click node_organization "https://github.com/nihalswe/attendance_system/blob/main/organization/services.py"
click node_organization_data "https://github.com/nihalswe/attendance_system/blob/main/organization/models.py"
click node_device_ingestion "https://github.com/nihalswe/attendance_system/blob/main/devices/services/ingestion.py"
click node_device_data "https://github.com/nihalswe/attendance_system/blob/main/devices/models.py"
click node_attendance "https://github.com/nihalswe/attendance_system/blob/main/attendance/services.py"
click node_attendance_data "https://github.com/nihalswe/attendance_system/blob/main/attendance/models.py"
click node_scheduling "https://github.com/nihalswe/attendance_system/blob/main/scheduling/models.py"
click node_calendar "https://github.com/nihalswe/attendance_system/blob/main/scheduling/calendar.py"
click node_leave "https://github.com/nihalswe/attendance_system/blob/main/leaves/services.py"
click node_payroll "https://github.com/nihalswe/attendance_system/blob/main/payroll/services.py"
click node_payroll_data "https://github.com/nihalswe/attendance_system/blob/main/payroll/models.py"
click node_audit "https://github.com/nihalswe/attendance_system/blob/main/auditlog/services.py"
click node_webhooks "https://github.com/nihalswe/attendance_system/blob/main/webhooks/services.py"
click node_reports "https://github.com/nihalswe/attendance_system/blob/main/reports/builders.py"
click node_api_domains "https://github.com/nihalswe/attendance_system/tree/main/api/v1"

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_company,node_accounts,node_branch_access,node_audit,node_api_domains,node_operator toneBlue
class node_employees,node_organization,node_organization_data toneAmber
class node_device_ingestion,node_device_data,node_attendance,node_attendance_data toneMint
class node_scheduling,node_calendar,node_leave toneRose
class node_payroll,node_payroll_data,node_webhooks,node_reports toneIndigo
```

## Components

### Tenant and access

- [Company and features](https://github.com/nihalswe/attendance_system/blob/main/tenants/models.py): `tenants/models.py`
- [Accounts and memberships](https://github.com/nihalswe/attendance_system/blob/main/accounts/models.py): `accounts/models.py`
- [Branch permissions](https://github.com/nihalswe/attendance_system/blob/main/access_control/branch_access.py): `access_control/branch_access.py`
- [Audit events](https://github.com/nihalswe/attendance_system/blob/main/auditlog/services.py): `auditlog/services.py`
- [Versioned API domains](https://github.com/nihalswe/attendance_system/tree/main/api/v1): `api/v1`

### Workforce and organization

- [Employee records](https://github.com/nihalswe/attendance_system/blob/main/employees/models.py): `employees/models.py`
- [Organization services](https://github.com/nihalswe/attendance_system/blob/main/organization/services.py): `organization/services.py`
- [Branches and departments](https://github.com/nihalswe/attendance_system/blob/main/organization/models.py): `organization/models.py`

### Time and devices

- [Device ingestion](https://github.com/nihalswe/attendance_system/blob/main/devices/services/ingestion.py): `devices/services/ingestion.py`
- [Device records](https://github.com/nihalswe/attendance_system/blob/main/devices/models.py): `devices/models.py`
- [Attendance calculation](https://github.com/nihalswe/attendance_system/blob/main/attendance/services.py): `attendance/services.py`
- [Attendance records](https://github.com/nihalswe/attendance_system/blob/main/attendance/models.py): `attendance/models.py`

### Leave and scheduling

- [Shifts and calendar](https://github.com/nihalswe/attendance_system/blob/main/scheduling/models.py): `scheduling/models.py`
- [Calendar lookup](https://github.com/nihalswe/attendance_system/blob/main/scheduling/calendar.py): `scheduling/calendar.py`
- [Leave workflows](https://github.com/nihalswe/attendance_system/blob/main/leaves/services.py): `leaves/services.py`

### Payroll and integrations

- [Payroll calculations](https://github.com/nihalswe/attendance_system/blob/main/payroll/services.py): `payroll/services.py`
- [Payroll records](https://github.com/nihalswe/attendance_system/blob/main/payroll/models.py): `payroll/models.py`
- [Attendance webhooks](https://github.com/nihalswe/attendance_system/blob/main/webhooks/services.py): `webhooks/services.py`
- [Reports](https://github.com/nihalswe/attendance_system/blob/main/reports/builders.py): `reports/builders.py`

### Other components

- **Company user**

## Connections

- Device ingestion → Device records: uses device records (evidence: `devices/services/ingestion.py`)
- Device ingestion → Attendance calculation: submits attendance (evidence: `devices/services/ingestion.py`)
- Attendance calculation → Attendance records: writes calculations (evidence: `attendance/services.py`)
- Attendance calculation → Device records: uses device data (evidence: `attendance/services.py`)
- Attendance calculation → Shifts and calendar: uses shift rules (evidence: `attendance/services.py`)
- Attendance calculation → Calendar lookup: uses calendar (evidence: `attendance/services.py`)
- Attendance calculation → Leave workflows: reads leave data (evidence: `leaves/services.py`)
- Attendance calculation → Payroll records: references payroll data (evidence: `attendance/services.py`)
- Attendance calculation → Attendance webhooks: notifies attendance (evidence: `attendance/services.py`)
- Payroll calculations → Attendance calculation: uses attendance (evidence: `payroll/services.py`)
- Payroll calculations → Payroll records: uses payroll records (evidence: `payroll/services.py`)
- Payroll calculations → Shifts and calendar: uses schedule data (evidence: `payroll/services.py`)
- Organization services → Branches and departments: writes organization (evidence: `organization/services.py`)
- Organization services → Audit events: records changes (evidence: `organization/services.py`)
- Leave workflows → Attendance calculation: references attendance (evidence: `leaves/services.py`)
- Leave workflows → Branch permissions: checks branch access (evidence: `leaves/services.py`)
- Company user → Versioned API domains: uses API
- Branch permissions → Accounts and memberships: checks membership (evidence: `access_control/branch_access.py`)
- Branch permissions → Branches and departments: scopes branches (evidence: `access_control/branch_access.py`)
- Employee records → Branches and departments: references placements (evidence: `employees/models.py`)
