# bananharappulan-beep/attendance-monitor architecture

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

- Interactive diagram: https://gitdiagram.com/bananharappulan-beep/attendance-monitor
- Repository: https://github.com/bananharappulan-beep/attendance-monitor

## Overview

Attendance Monitor collects attendance reports from ESSL, replaces per-branch rows in Neon PostgreSQL, then serves dashboard data and derived attendance views through a Flask app. Users can inspect daily records and P/H/A matrices; the product also documents summary, inactive-employee, report-download, and developer sync capabilities. The daily fetch may run automatically or be triggered manually. Some UI and route wiring is unsampled, so the graph omits uncertain links rather than inferring calls.

Main entry points: [`db.py`](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/db.py) (Database access), [`data_fetch.py`](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/data_fetch.py) (Report fetcher), [`app.py`](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/app.py) (Flask API), [`neon_sync.py`](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/neon_sync.py) (Dashboard data and matrices)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Attendance ingestion"]
  node_fetcher["Report fetcher<br/>[data_fetch.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_scheduler["Daily scheduler<br/>[app.py]"]
end

subgraph group_storage["Neon data layer"]
  node_db_access["Database access<br/>[db.py]"]
  node_neon[("Neon PostgreSQL")]
end

subgraph group_web["Dashboard and access"]
  node_dashboard_ui["Dashboard interface<br/>[app.js]"]
  node_auth_ui["Account interface<br/>[auth-ui.js]"]
  node_auth["Authentication and roles<br/>[auth.py]"]
  node_flask["Flask API<br/>[app.py]"]
  node_punchin_ui["Punch-in view<br/>[punchin.js]"]
  node_punchout_ui["Punch-out view<br/>[punchout.js]"]
  node_monthly_ui["Monthly view<br/>[monthly.js]"]
end

subgraph group_views["Attendance views"]
  node_sync["Dashboard data and matrices<br/>[neon_sync.py]"]
  node_inactive["Inactive employee matrices<br/>[inaactive.py]"]
  node_report["Downloadable reports<br/>[report.py]"]
end

node_essl(("ESSL attendance"))
node_browser(("Dashboard user"))

node_essl -->|"provides reports"| node_fetcher
node_fetcher -->|"replaces rows"| node_db_access
node_db_access -->|"writes and cleans"| node_neon
node_fetcher -->|"reads settings"| node_config
node_db_access -->|"reads connection"| node_config
node_scheduler -->|"runs daily fetch"| node_fetcher
node_browser -->|"uses dashboard"| node_dashboard_ui
node_dashboard_ui -.->|"requests dashboard data"| node_flask
node_auth_ui -->|"calls account routes"| node_flask
node_flask -->|"registers access control"| node_auth
node_flask -->|"reads dashboard data"| node_sync
node_sync -->|"reads branch rows"| node_db_access
node_db_access -->|"reads rows"| node_neon
node_inactive -->|"builds matrices from"| node_sync
node_report -->|"reads attendance data"| node_sync

click node_fetcher "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/data_fetch.py"
click node_db_access "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/db.py"
click node_config "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/config.py"
click node_scheduler "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/app.py"
click node_dashboard_ui "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/app.js"
click node_auth_ui "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/auth-ui.js"
click node_auth "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/auth.py"
click node_flask "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/app.py"
click node_punchin_ui "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/punchin.js"
click node_punchout_ui "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/punchout.js"
click node_monthly_ui "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/monthly.js"
click node_sync "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/neon_sync.py"
click node_inactive "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/inaactive.py"
click node_report "https://github.com/bananharappulan-beep/attendance-monitor/blob/main/report.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_fetcher,node_config,node_scheduler,node_browser toneBlue
class node_db_access,node_neon toneAmber
class node_dashboard_ui,node_auth_ui,node_auth,node_flask,node_punchin_ui,node_punchout_ui,node_monthly_ui toneMint
class node_sync,node_inactive,node_report toneRose
class node_essl toneIndigo
```

## Components

### Attendance ingestion

- [Report fetcher](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/data_fetch.py): `data_fetch.py`
- [Runtime configuration](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/config.py): `config.py`
- [Daily scheduler](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/app.py): `app.py`

### Neon data layer

- [Database access](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/db.py): `db.py`
- **Neon PostgreSQL**

### Dashboard and access

- [Dashboard interface](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/app.js): `static/js/app.js`
- [Account interface](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/auth-ui.js): `static/js/auth-ui.js`
- [Authentication and roles](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/auth.py): `auth.py`
- [Flask API](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/app.py): `app.py`
- [Punch-in view](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/punchin.js): `static/js/punchin.js`
- [Punch-out view](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/punchout.js): `static/js/punchout.js`
- [Monthly view](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/static/js/monthly.js): `static/js/monthly.js`

### Attendance views

- [Dashboard data and matrices](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/neon_sync.py): `neon_sync.py`
- [Inactive employee matrices](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/inaactive.py): `inaactive.py`
- [Downloadable reports](https://github.com/bananharappulan-beep/attendance-monitor/blob/main/report.py): `report.py`

### Other components

- **ESSL attendance**
- **Dashboard user**

## Connections

- ESSL attendance → Report fetcher: provides reports (evidence: `README.md`)
- Report fetcher → Database access: replaces rows (evidence: `data_fetch.py`)
- Database access → Neon PostgreSQL: writes and cleans (evidence: `README.md`)
- Report fetcher → Runtime configuration: reads settings (evidence: `data_fetch.py`)
- Database access → Runtime configuration: reads connection (evidence: `db.py`)
- Daily scheduler → Report fetcher: runs daily fetch (evidence: `README.md`)
- Dashboard user → Dashboard interface: uses dashboard (evidence: `README.md`)
- Dashboard interface → Flask API: requests dashboard data
- Account interface → Flask API: calls account routes (evidence: `static/js/auth-ui.js`)
- Flask API → Authentication and roles: registers access control (evidence: `app.py`)
- Flask API → Dashboard data and matrices: reads dashboard data (evidence: `app.py`)
- Dashboard data and matrices → Database access: reads branch rows (evidence: `neon_sync.py`)
- Database access → Neon PostgreSQL: reads rows (evidence: `README.md`)
- Inactive employee matrices → Dashboard data and matrices: builds matrices from (evidence: `inaactive.py`)
- Downloadable reports → Dashboard data and matrices: reads attendance data (evidence: `report.py`)
