# yashsahane-eng/employee-attendance architecture

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

- Interactive diagram: https://gitdiagram.com/yashsahane-eng/employee-attendance
- Repository: https://github.com/yashsahane-eng/employee-attendance

## Overview

This is a FastAPI employee attendance and analytics backend. Users and managers create employees, record or correct attendance, retrieve attendance, and request reports; administrators can inspect simplified query plans. The routes and their database operations live together in app/main.py, so the nodes distinguish product responsibilities rather than separate code modules. The excerpts show employee and attendance database calls; the README documents the broader endpoint set and MongoDB aggregation reports. Unsampled route internals are represented only at that documented level.

Main entry points: [`app/main.py`](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py) (FastAPI routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and employee records"]
  node_api["FastAPI routes<br/>[main.py]"]
  node_health["Health check<br/>[main.py]"]
  node_employees["Employee records<br/>[main.py]"]
end

subgraph group_attendance["Attendance lifecycle"]
  node_attendance_ops["Punch in and out<br/>[main.py]"]
  node_corrections["Manual corrections<br/>[main.py]"]
  node_attendance_query["Attendance lookup<br/>[main.py]"]
end

subgraph group_analytics["Reports and query insights"]
  node_monthly["Employee monthly report<br/>[main.py]"]
  node_dept_summary["Department summary<br/>[main.py]"]
  node_late_board["Late leaderboard<br/>[main.py]"]
  node_dept_trend["Department trend<br/>[main.py]"]
  node_explain["Query explain<br/>[main.py]"]
end

node_users(("API users"))
node_mongo[("MongoDB")]

node_users -->|"calls endpoints"| node_api
node_api -->|"routes health"| node_health
node_api -->|"routes employee requests"| node_employees
node_api -->|"routes punch requests"| node_attendance_ops
node_api -->|"routes corrections"| node_corrections
node_api -->|"routes attendance queries"| node_attendance_query
node_api -->|"routes monthly reports"| node_monthly
node_api -->|"routes summaries"| node_dept_summary
node_api -->|"routes leaderboard"| node_late_board
node_api -->|"routes trends"| node_dept_trend
node_api -->|"routes explain requests"| node_explain
node_health -->|"pings"| node_mongo
node_employees -->|"reads and writes employees"| node_mongo
node_attendance_ops -->|"reads and writes attendance"| node_mongo
node_corrections -->|"reads attendance"| node_mongo
node_attendance_query -->|"queries attendance"| node_mongo
node_monthly -->|"aggregates attendance"| node_mongo
node_dept_summary -->|"aggregates attendance"| node_mongo
node_late_board -->|"aggregates attendance"| node_mongo
node_dept_trend -->|"aggregates attendance"| node_mongo
node_explain -->|"explains queries"| node_mongo

click node_api "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_health "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_employees "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_attendance_ops "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_corrections "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_attendance_query "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_monthly "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_dept_summary "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_late_board "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_dept_trend "https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py"
click node_explain "https://github.com/yashsahane-eng/employee-attendance/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_api,node_health,node_employees,node_users toneBlue
class node_attendance_ops,node_corrections,node_attendance_query,node_mongo toneAmber
class node_monthly,node_dept_summary,node_late_board,node_dept_trend,node_explain toneMint
```

## Components

### API and employee records

- [FastAPI routes](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`
- [Health check](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`
- [Employee records](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`

### Attendance lifecycle

- [Punch in and out](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`
- [Manual corrections](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`
- [Attendance lookup](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`

### Reports and query insights

- [Employee monthly report](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`
- [Department summary](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`
- [Late leaderboard](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`
- [Department trend](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`
- [Query explain](https://github.com/yashsahane-eng/employee-attendance/blob/main/app/main.py): `app/main.py`

### Other components

- **API users**
- **MongoDB**

## Connections

- API users → FastAPI routes: calls endpoints (evidence: `README.md`)
- FastAPI routes → Health check: routes health (evidence: `README.md`)
- FastAPI routes → Employee records: routes employee requests (evidence: `README.md`)
- FastAPI routes → Punch in and out: routes punch requests (evidence: `README.md`)
- FastAPI routes → Manual corrections: routes corrections (evidence: `README.md`)
- FastAPI routes → Attendance lookup: routes attendance queries (evidence: `README.md`)
- FastAPI routes → Employee monthly report: routes monthly reports (evidence: `README.md`)
- FastAPI routes → Department summary: routes summaries (evidence: `README.md`)
- FastAPI routes → Late leaderboard: routes leaderboard (evidence: `README.md`)
- FastAPI routes → Department trend: routes trends (evidence: `README.md`)
- FastAPI routes → Query explain: routes explain requests (evidence: `README.md`)
- Health check → MongoDB: pings (evidence: `app/main.py`)
- Employee records → MongoDB: reads and writes employees (evidence: `app/main.py`)
- Punch in and out → MongoDB: reads and writes attendance (evidence: `app/main.py`)
- Manual corrections → MongoDB: reads attendance (evidence: `app/main.py`)
- Attendance lookup → MongoDB: queries attendance (evidence: `app/main.py`)
- Employee monthly report → MongoDB: aggregates attendance (evidence: `README.md`)
- Department summary → MongoDB: aggregates attendance (evidence: `README.md`)
- Late leaderboard → MongoDB: aggregates attendance (evidence: `README.md`)
- Department trend → MongoDB: aggregates attendance (evidence: `README.md`)
- Query explain → MongoDB: explains queries (evidence: `README.md`)
