# koushik-1230/leave-tracker architecture

> Architecture diagram of the GitHub repository koushik-1230/leave-tracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/koushik-1230/leave-tracker
- Repository: https://github.com/koushik-1230/leave-tracker

## Overview

This repository implements a Slack-based employee leave-management bot, backed by Supabase and accompanied by Flask health/readiness endpoints. The main workflow accepts a leave request, stores it as pending, asks an administrator to approve or reject it, then updates the request and notifies the employee. Other documented-in-code capabilities include leave history and balances, admin balance updates, and scheduled daily leave announcements. The sampled code shows the main handlers and storage methods; some wiring for unsampled handlers is therefore omitted or marked unverified.

Main entry points: [`app/supabase_client.py`](https://github.com/koushik-1230/leave-tracker/blob/main/app/supabase_client.py) (Supabase data access), [`app/app.py`](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py) (Leave commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_slack_workflows["Slack workflows"]
  node_leave_commands["Leave commands<br/>[app.py]"]
  node_request_creation["Request creation<br/>[app.py]"]
  node_approval_handling["Approval handling<br/>[app.py]"]
  node_slack_notifications["Slack notifications<br/>[app.py]"]
  node_balance_workflows["Balance workflows<br/>[app.py]"]
  node_history_workflow["Leave history<br/>[app.py]"]
end

subgraph group_leave_data["Leave data"]
  node_supabase_store["Supabase data access<br/>[supabase_client.py]"]
  node_supabase[("Supabase")]
end

subgraph group_background_ops["Background operations"]
  node_scheduler["Daily scheduler<br/>[app.py]"]
  node_daily_announcements["Daily announcements<br/>[app.py]"]
end

subgraph group_service_health["Service health"]
  node_flask_health["Health endpoints<br/>[app.py]"]
end

node_employee(("Employee"))
node_admin(("Administrator"))
node_slack["Slack"]

node_employee -->|"submits requests"| node_slack
node_admin -->|"reviews requests"| node_slack
node_slack -->|"dispatches commands"| node_leave_commands
node_leave_commands -->|"creates request"| node_request_creation
node_request_creation -->|"stores pending"| node_supabase_store
node_request_creation -->|"requests approval"| node_slack_notifications
node_approval_handling -->|"updates status"| node_supabase_store
node_approval_handling -->|"sends outcome"| node_slack_notifications
node_leave_commands -.->|"handles decisions"| node_approval_handling
node_leave_commands -->|"loads history"| node_history_workflow
node_history_workflow -->|"reads requests"| node_supabase_store
node_balance_workflows -.->|"reads and updates"| node_supabase_store
node_supabase_store -->|"queries tables"| node_supabase
node_scheduler -->|"runs daily"| node_daily_announcements
node_daily_announcements -.->|"loads today's leave"| node_supabase_store
node_daily_announcements -.->|"posts announcement"| node_slack_notifications
node_slack_notifications -->|"sends messages"| node_slack
node_slack -.->|"dispatches commands"| node_balance_workflows
node_slack -->|"dispatches actions"| node_approval_handling
node_employee -.->|"checks service"| node_flask_health
node_flask_health -->|"probes database"| node_supabase_store

click node_leave_commands "https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py"
click node_request_creation "https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py"
click node_approval_handling "https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py"
click node_slack_notifications "https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py"
click node_balance_workflows "https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py"
click node_history_workflow "https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py"
click node_supabase_store "https://github.com/koushik-1230/leave-tracker/blob/main/app/supabase_client.py"
click node_scheduler "https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py"
click node_daily_announcements "https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py"
click node_flask_health "https://github.com/koushik-1230/leave-tracker/blob/main/app/app.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_leave_commands,node_request_creation,node_approval_handling,node_slack_notifications,node_balance_workflows,node_history_workflow toneBlue
class node_supabase_store,node_supabase toneAmber
class node_scheduler,node_daily_announcements toneMint
class node_flask_health toneRose
class node_employee,node_admin,node_slack toneIndigo
```

## Components

### Slack workflows

- [Leave commands](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py): `app/app.py`
- [Request creation](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py): `app/app.py`
- [Approval handling](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py): `app/app.py`
- [Slack notifications](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py): `app/app.py`
- [Balance workflows](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py): `app/app.py`
- [Leave history](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py): `app/app.py`

### Leave data

- [Supabase data access](https://github.com/koushik-1230/leave-tracker/blob/main/app/supabase_client.py): `app/supabase_client.py`
- **Supabase**

### Background operations

- [Daily scheduler](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py): `app/app.py`
- [Daily announcements](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py): `app/app.py`

### Service health

- [Health endpoints](https://github.com/koushik-1230/leave-tracker/blob/main/app/app.py): `app/app.py`

### Other components

- **Employee**
- **Administrator**
- **Slack**

## Connections

- Employee → Slack: submits requests
- Administrator → Slack: reviews requests
- Slack → Leave commands: dispatches commands (evidence: `app/app.py`)
- Leave commands → Request creation: creates request (evidence: `app/app.py`)
- Request creation → Supabase data access: stores pending (evidence: `app/app.py`)
- Request creation → Slack notifications: requests approval (evidence: `app/app.py`)
- Approval handling → Supabase data access: updates status (evidence: `app/app.py`)
- Approval handling → Slack notifications: sends outcome (evidence: `app/app.py`)
- Leave commands → Approval handling: handles decisions (evidence: `app/app.py`)
- Leave commands → Leave history: loads history (evidence: `app/app.py`)
- Leave history → Supabase data access: reads requests (evidence: `app/app.py`)
- Balance workflows → Supabase data access: reads and updates (evidence: `app/app.py`)
- Supabase data access → Supabase: queries tables (evidence: `app/supabase_client.py`)
- Daily scheduler → Daily announcements: runs daily (evidence: `app/app.py`)
- Daily announcements → Supabase data access: loads today's leave (evidence: `app/app.py`)
- Daily announcements → Slack notifications: posts announcement (evidence: `app/app.py`)
- Slack notifications → Slack: sends messages (evidence: `app/app.py`)
- Slack → Balance workflows: dispatches commands
- Slack → Approval handling: dispatches actions (evidence: `app/app.py`)
- Employee → Health endpoints: checks service
- Health endpoints → Supabase data access: probes database (evidence: `app/app.py`)
