# ajayreddy510/hrone-attendance-api architecture

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

- Interactive diagram: https://gitdiagram.com/ajayreddy510/hrone-attendance-api
- Repository: https://github.com/ajayreddy510/hrone-attendance-api

## Overview

This is a FastAPI employee attendance and analytics service backed by MongoDB. Its main workflow manages employees, records and corrects attendance, then exposes attendance and workforce analytics. The implementation is concentrated in app/main.py, so the graph separates its documented route and domain responsibilities while retaining that shared source path. README documentation supports the broader endpoint and analytics coverage; the excerpts show selected database operations and analytics pipeline details, not every route implementation.

Main entry points: [`app/main.py`](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py) (Punch-in)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and administration"]
  node_admin_explain["Query explain<br/>[main.py]"]
  node_health["Health check<br/>[main.py]"]
end

subgraph group_people["Employee management"]
  node_employee_routes["Employee routes<br/>[main.py]"]
  node_employee_store[("Employees collection")]
end

subgraph group_attendance["Attendance lifecycle"]
  node_punch_in["Punch-in<br/>[main.py]"]
  node_punch_out["Punch-out<br/>[main.py]"]
  node_attendance_list["Attendance listing<br/>[main.py]"]
  node_regularization["Manual regularization<br/>[main.py]"]
  node_attendance_store[("Attendance logs")]
end

subgraph group_analytics["Analytics"]
  node_monthly["Monthly summary<br/>[main.py]"]
  node_department_summary["Department summary<br/>[main.py]"]
  node_late_leaderboard["Late leaderboard<br/>[main.py]"]
  node_department_trend["Department trend<br/>[main.py]"]
end

node_client(("API client"))
node_mongodb[("MongoDB server")]

node_client -->|"creates or lists"| node_employee_routes
node_employee_routes -->|"reads and writes"| node_employee_store
node_client -->|"punches in"| node_punch_in
node_punch_in -->|"checks employee"| node_employee_store
node_punch_in -->|"creates record"| node_attendance_store
node_client -->|"punches out"| node_punch_out
node_punch_out -->|"loads employee"| node_employee_store
node_punch_out -->|"updates record"| node_attendance_store
node_client -->|"lists records"| node_attendance_list
node_attendance_list -->|"reads records"| node_attendance_store
node_client -->|"corrects record"| node_regularization
node_regularization -->|"updates with history"| node_attendance_store
node_client -->|"requests summary"| node_monthly
node_monthly -->|"uses employee data"| node_employee_store
node_monthly -->|"aggregates attendance"| node_attendance_store
node_client -->|"requests metrics"| node_department_summary
node_department_summary -->|"includes headcount"| node_employee_store
node_department_summary -->|"aggregates logs"| node_attendance_store
node_client -->|"requests ranking"| node_late_leaderboard
node_late_leaderboard -->|"ranks late records"| node_attendance_store
node_late_leaderboard -->|"adds employee details"| node_employee_store
node_client -->|"requests trend"| node_department_trend
node_department_trend -->|"checks department"| node_employee_store
node_department_trend -->|"fills daily series"| node_attendance_store
node_client -->|"requests plan"| node_admin_explain
node_admin_explain -->|"explains query"| node_mongodb
node_client -->|"checks readiness"| node_health
node_health -->|"pings server"| node_mongodb
node_employee_store -->|"stored in"| node_mongodb
node_attendance_store -->|"stored in"| node_mongodb

click node_employee_routes "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_punch_in "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_punch_out "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_attendance_list "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_regularization "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_monthly "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_department_summary "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_late_leaderboard "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_department_trend "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_admin_explain "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py"
click node_health "https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.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_admin_explain,node_health,node_client toneBlue
class node_employee_routes,node_employee_store,node_mongodb toneAmber
class node_punch_in,node_punch_out,node_attendance_list,node_regularization,node_attendance_store toneMint
class node_monthly,node_department_summary,node_late_leaderboard,node_department_trend toneRose
```

## Components

### API and administration

- [Query explain](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`
- [Health check](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`

### Employee management

- [Employee routes](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`
- **Employees collection**

### Attendance lifecycle

- [Punch-in](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`
- [Punch-out](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`
- [Attendance listing](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`
- [Manual regularization](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`
- **Attendance logs**

### Analytics

- [Monthly summary](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`
- [Department summary](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`
- [Late leaderboard](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`
- [Department trend](https://github.com/ajayreddy510/hrone-attendance-api/blob/main/app/main.py): `app/main.py`

### Other components

- **API client**
- **MongoDB server**

## Connections

- API client → Employee routes: creates or lists (evidence: `README.md`)
- Employee routes → Employees collection: reads and writes (evidence: `app/main.py`)
- API client → Punch-in: punches in (evidence: `README.md`)
- Punch-in → Employees collection: checks employee (evidence: `README.md`)
- Punch-in → Attendance logs: creates record (evidence: `README.md`)
- API client → Punch-out: punches out (evidence: `README.md`)
- Punch-out → Employees collection: loads employee (evidence: `app/main.py`)
- Punch-out → Attendance logs: updates record (evidence: `app/main.py`)
- API client → Attendance listing: lists records (evidence: `README.md`)
- Attendance listing → Attendance logs: reads records (evidence: `README.md`)
- API client → Manual regularization: corrects record (evidence: `README.md`)
- Manual regularization → Attendance logs: updates with history (evidence: `README.md`)
- API client → Monthly summary: requests summary (evidence: `README.md`)
- Monthly summary → Employees collection: uses employee data (evidence: `README.md`)
- Monthly summary → Attendance logs: aggregates attendance (evidence: `README.md`)
- API client → Department summary: requests metrics (evidence: `README.md`)
- Department summary → Employees collection: includes headcount (evidence: `README.md`)
- Department summary → Attendance logs: aggregates logs (evidence: `README.md`)
- API client → Late leaderboard: requests ranking (evidence: `README.md`)
- Late leaderboard → Attendance logs: ranks late records (evidence: `README.md`)
- Late leaderboard → Employees collection: adds employee details (evidence: `README.md`)
- API client → Department trend: requests trend (evidence: `README.md`)
- Department trend → Employees collection: checks department (evidence: `app/main.py`)
- Department trend → Attendance logs: fills daily series (evidence: `README.md`)
- API client → Query explain: requests plan (evidence: `README.md`)
- Query explain → MongoDB server: explains query (evidence: `README.md`)
- API client → Health check: checks readiness (evidence: `README.md`)
- Health check → MongoDB server: pings server (evidence: `app/main.py`)
- Employees collection → MongoDB server: stored in (evidence: `README.md`)
- Attendance logs → MongoDB server: stored in (evidence: `README.md`)
