# ajayreddy510/employee-attendance-analytics-api architecture

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

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

## Overview

This repository is an Employee Attendance & Analytics REST API. An HTTP client submits employee and attendance requests to the FastAPI application in app/main.py, where request validation and attendance rules are applied before MongoDB reads or writes. The same application serves regularization, listing, analytics, health, and explain-plan endpoints. The README documents these capabilities; the supplied source excerpts show selected handlers and aggregation pipeline builders, but not every route implementation, so undocumented internal call links are omitted.

Main entry points: [`app/main.py`](https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py) (FastAPI service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and rules"]
  node_app["FastAPI service<br/>[main.py]"]
  node_validation["Request validation<br/>[main.py]"]
  node_attendance["Attendance operations<br/>[main.py]"]
  node_employees["Employee management<br/>[main.py]"]
  node_regularization["Attendance regularization<br/>[main.py]"]
  node_health["Health check<br/>[main.py]"]
  node_explain["Explain plans<br/>[main.py]"]
end

subgraph group_analytics["Analytics"]
  node_monthly["Employee monthly summary<br/>[main.py]"]
  node_department_summary["Department summary<br/>[main.py]"]
  node_leaderboard["Late leaderboard<br/>[main.py]"]
  node_trend["Department trend<br/>[main.py]"]
end

subgraph group_storage["MongoDB data"]
  node_mongo[("MongoDB")]
  node_employee_records[("Employee records")]
  node_attendance_records[("Attendance records")]
end

node_client(("HTTP client"))

node_client -->|"sends requests"| node_app
node_app -->|"validates input"| node_validation
node_app -->|"routes requests"| node_attendance
node_app -->|"routes requests"| node_employees
node_app -->|"routes requests"| node_regularization
node_app -->|"routes requests"| node_health
node_app -->|"routes requests"| node_explain
node_app -->|"routes requests"| node_monthly
node_app -->|"routes requests"| node_department_summary
node_app -->|"routes requests"| node_leaderboard
node_app -->|"routes requests"| node_trend
node_health -->|"pings"| node_mongo
node_employees -.->|"reads and writes"| node_employee_records
node_attendance -->|"reads"| node_employee_records
node_attendance -->|"reads and writes"| node_attendance_records
node_regularization -.->|"updates"| node_attendance_records
node_monthly -.->|"aggregates"| node_employee_records
node_monthly -.->|"aggregates"| node_attendance_records
node_department_summary -->|"runs pipeline"| node_mongo
node_leaderboard -->|"runs pipeline"| node_mongo
node_trend -->|"checks department"| node_employee_records
node_trend -.->|"aggregates"| node_attendance_records
node_explain -.->|"requests plans"| node_mongo
node_mongo -->|"stores"| node_employee_records
node_mongo -->|"stores"| node_attendance_records

click node_app "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_validation "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_attendance "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_employees "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_regularization "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_health "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_explain "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_monthly "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_department_summary "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_leaderboard "https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py"
click node_trend "https://github.com/ajayreddy510/employee-attendance-analytics-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_app,node_validation,node_attendance,node_employees,node_regularization,node_health,node_explain,node_client toneBlue
class node_monthly,node_department_summary,node_leaderboard,node_trend toneAmber
class node_mongo,node_employee_records,node_attendance_records toneMint
```

## Components

### API and rules

- [FastAPI service](https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py): `app/main.py`
- [Request validation](https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py): `app/main.py`
- [Attendance operations](https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py): `app/main.py`
- [Employee management](https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py): `app/main.py`
- [Attendance regularization](https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py): `app/main.py`
- [Health check](https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py): `app/main.py`
- [Explain plans](https://github.com/ajayreddy510/employee-attendance-analytics-api/blob/main/app/main.py): `app/main.py`

### Analytics

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

### MongoDB data

- **MongoDB**
- **Employee records**
- **Attendance records**

### Other components

- **HTTP client**

## Connections

- HTTP client → FastAPI service: sends requests (evidence: `README.md`)
- FastAPI service → Request validation: validates input (evidence: `README.md`)
- FastAPI service → Attendance operations: routes requests (evidence: `README.md`)
- FastAPI service → Employee management: routes requests (evidence: `README.md`)
- FastAPI service → Attendance regularization: routes requests (evidence: `README.md`)
- FastAPI service → Health check: routes requests (evidence: `README.md`)
- FastAPI service → Explain plans: routes requests (evidence: `README.md`)
- FastAPI service → Employee monthly summary: routes requests (evidence: `README.md`)
- FastAPI service → Department summary: routes requests (evidence: `README.md`)
- FastAPI service → Late leaderboard: routes requests (evidence: `README.md`)
- FastAPI service → Department trend: routes requests (evidence: `README.md`)
- Health check → MongoDB: pings (evidence: `app/main.py`)
- Employee management → Employee records: reads and writes
- Attendance operations → Employee records: reads (evidence: `README.md`)
- Attendance operations → Attendance records: reads and writes (evidence: `app/main.py`)
- Attendance regularization → Attendance records: updates
- Employee monthly summary → Employee records: aggregates
- Employee monthly summary → Attendance records: aggregates
- Department summary → MongoDB: runs pipeline (evidence: `app/main.py`)
- Late leaderboard → MongoDB: runs pipeline (evidence: `app/main.py`)
- Department trend → Employee records: checks department (evidence: `README.md`)
- Department trend → Attendance records: aggregates
- Explain plans → MongoDB: requests plans
- MongoDB → Employee records: stores (evidence: `README.md`)
- MongoDB → Attendance records: stores (evidence: `README.md`)
