# pluggnkey/messagesnotifier architecture

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

- Interactive diagram: https://gitdiagram.com/pluggnkey/messagesnotifier
- Repository: https://github.com/pluggnkey/messagesnotifier

## Overview

This Django service turns Google Sheets duty, vacation, and release schedules into date-specific assignments, then sends scheduled Slack notifications and exposes duty data and management through REST endpoints. Its main path is scheduler or API entry → DataDutyService → sheet retrieval and normalization → duty maps with vacation substitutions and Kazakhstan holidays → formatted messages or API responses. The README also describes monthly weekend reports and CRUD. Some of those capabilities are documented but their full implementation was not sampled; edges are limited to visible references or README statements.

Main entry points: [`src/apps/duties/services/service.py`](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/service.py) (Duty service), [`src/apps/duties/services/health_check_services.py`](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/health_check_services.py) (Health checks), [`src/apps/duties/services/google_client.py`](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/google_client.py) (Sheets client), [`src/apps/duties/services/slack_service.py`](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/slack_service.py) (Slack client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_scheduler["Notification scheduler<br/>[total_scheduler.py]"]
  node_api["REST API<br/>[views.py]"]
end

subgraph group_duty["Duty processing"]
  node_service["Duty service<br/>[service.py]"]
  node_clean["Data cleanup"]
  node_duty_maps["Duty maps and substitutions<br/>[data_duty.py]"]
  node_translit["Name transliteration<br/>[transliteration.py]"]
  node_formatter["Message formatter"]
  node_handler["Message handler<br/>[message_handler.py]"]
end

subgraph group_integrations["External integrations"]
  node_google["Sheets client<br/>[google_client.py]"]
  node_calendar["Kazakhstan holidays"]
  node_slack["Slack client<br/>[slack_service.py]"]
  node_telegram["Telegram client"]
end

subgraph group_operations["Monitoring and resilience"]
  node_health["Health checks"]
  node_telegram_health["Telegram health status"]
  node_technical_break["Technical break monitor"]
  node_retry["Retry and backoff<br/>[retry_client.py]"]
  node_breaker["Circuit breaker<br/>[circuit_breaker.py]"]
end

node_sheets_service[("Google Sheets")]
node_slack_service(("Slack"))
node_kz_service(("Holiday calendar API"))
node_telegram_service(("Telegram"))
node_user(("API caller"))

node_scheduler -->|"schedules calls"| node_service
node_api -->|"requests duty data"| node_service
node_api -->|"updates sheet data"| node_google
node_user -.->|"requests endpoints"| node_api
node_service -->|"loads sheet data"| node_google
node_google -->|"reads and updates"| node_sheets_service
node_service -->|"cleans sheet data"| node_clean
node_service -->|"builds duty maps"| node_duty_maps
node_service -->|"normalizes names"| node_translit
node_duty_maps -->|"uses name mapping"| node_translit
node_service -->|"loads holidays"| node_calendar
node_calendar -->|"fetches calendar"| node_kz_service
node_service -->|"gets user IDs"| node_slack
node_slack -->|"queries members"| node_slack_service
node_service -->|"prepares messages"| node_handler
node_handler -->|"requests duty data"| node_service
node_service -->|"formats results"| node_formatter
node_scheduler -.->|"schedules alerts"| node_telegram
node_telegram -->|"sends messages"| node_telegram_service
node_health -->|"checks connection"| node_google
node_health -->|"checks connection"| node_slack
node_health -->|"checks availability"| node_calendar
node_health -->|"checks connection"| node_telegram
node_telegram_health -->|"reports status"| node_health
node_technical_break -->|"monitors schedule"| node_scheduler
node_google -->|"retries requests"| node_retry
node_slack -->|"retries requests"| node_retry
node_telegram -->|"retries requests"| node_retry
node_service -->|"uses protection"| node_breaker

click node_scheduler "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/scheduler/total_scheduler.py"
click node_api "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/views.py"
click node_service "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/service.py"
click node_google "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/google_client.py"
click node_clean "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/clear_data_google.py"
click node_duty_maps "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/data_duty.py"
click node_translit "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/transliteration.py"
click node_calendar "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/kz_calendar_service.py"
click node_formatter "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/messages_formatter.py"
click node_handler "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/message_handler.py"
click node_slack "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/slack_service.py"
click node_telegram "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/telegram_integration.py"
click node_health "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/health_check_services.py"
click node_telegram_health "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/telegram_health_status.py"
click node_technical_break "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/technical_break_settings.py"
click node_retry "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/retry_client.py"
click node_breaker "https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/circuit_breaker.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_scheduler,node_api toneBlue
class node_service,node_clean,node_duty_maps,node_translit,node_formatter,node_handler,node_sheets_service toneAmber
class node_google,node_calendar,node_slack,node_telegram,node_kz_service,node_user toneMint
class node_health,node_telegram_health,node_technical_break,node_retry,node_breaker toneRose
class node_slack_service,node_telegram_service toneIndigo
```

## Components

### Entry points

- [Notification scheduler](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/scheduler/total_scheduler.py): `src/apps/duties/scheduler/total_scheduler.py`
- [REST API](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/views.py): `src/apps/duties/views.py`

### Duty processing

- [Duty service](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/service.py): `src/apps/duties/services/service.py`
- [Data cleanup](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/clear_data_google.py): `src/apps/duties/services/clear_data_google.py`
- [Duty maps and substitutions](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/data_duty.py): `src/apps/duties/services/data_duty.py`
- [Name transliteration](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/transliteration.py): `src/apps/duties/services/transliteration.py`
- [Message formatter](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/messages_formatter.py): `src/apps/duties/services/messages_formatter.py`
- [Message handler](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/message_handler.py): `src/apps/duties/services/message_handler.py`

### External integrations

- [Sheets client](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/google_client.py): `src/apps/duties/services/google_client.py`
- [Kazakhstan holidays](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/kz_calendar_service.py): `src/apps/duties/services/kz_calendar_service.py`
- [Slack client](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/slack_service.py): `src/apps/duties/services/slack_service.py`
- [Telegram client](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/telegram_integration.py): `src/apps/duties/services/telegram_integration.py`

### Monitoring and resilience

- [Health checks](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/health_check_services.py): `src/apps/duties/services/health_check_services.py`
- [Telegram health status](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/telegram_health_status.py): `src/apps/duties/services/telegram_health_status.py`
- [Technical break monitor](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/technical_break_settings.py): `src/apps/duties/services/technical_break_settings.py`
- [Retry and backoff](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/retry_client.py): `src/apps/duties/services/retry_client.py`
- [Circuit breaker](https://github.com/pluggnkey/messagesnotifier/blob/main/src/apps/duties/services/circuit_breaker.py): `src/apps/duties/services/circuit_breaker.py`

### Other components

- **Google Sheets**
- **Slack**
- **Holiday calendar API**
- **Telegram**
- **API caller**

## Connections

- Notification scheduler → Duty service: schedules calls (evidence: `src/apps/duties/scheduler/total_scheduler.py`)
- REST API → Duty service: requests duty data (evidence: `src/apps/duties/views.py`)
- REST API → Sheets client: updates sheet data (evidence: `src/apps/duties/views.py`)
- API caller → REST API: requests endpoints (evidence: `README.md`)
- Duty service → Sheets client: loads sheet data (evidence: `src/apps/duties/services/service.py`)
- Sheets client → Google Sheets: reads and updates (evidence: `src/apps/duties/services/google_client.py`)
- Duty service → Data cleanup: cleans sheet data (evidence: `src/apps/duties/services/service.py`)
- Duty service → Duty maps and substitutions: builds duty maps (evidence: `src/apps/duties/services/service.py`)
- Duty service → Name transliteration: normalizes names (evidence: `src/apps/duties/services/service.py`)
- Duty maps and substitutions → Name transliteration: uses name mapping (evidence: `src/apps/duties/services/data_duty.py`)
- Duty service → Kazakhstan holidays: loads holidays (evidence: `src/apps/duties/services/service.py`)
- Kazakhstan holidays → Holiday calendar API: fetches calendar (evidence: `src/apps/duties/services/kz_calendar_service.py`)
- Duty service → Slack client: gets user IDs (evidence: `src/apps/duties/services/service.py`)
- Slack client → Slack: queries members (evidence: `src/apps/duties/services/slack_service.py`)
- Duty service → Message handler: prepares messages (evidence: `src/apps/duties/services/service.py`)
- Message handler → Duty service: requests duty data (evidence: `src/apps/duties/services/message_handler.py`)
- Duty service → Message formatter: formats results (evidence: `src/apps/duties/services/service.py`)
- Notification scheduler → Telegram client: schedules alerts
- Telegram client → Telegram: sends messages (evidence: `src/apps/duties/services/telegram_integration.py`)
- Health checks → Sheets client: checks connection (evidence: `src/apps/duties/services/health_check_services.py`)
- Health checks → Slack client: checks connection (evidence: `src/apps/duties/services/health_check_services.py`)
- Health checks → Kazakhstan holidays: checks availability (evidence: `src/apps/duties/services/health_check_services.py`)
- Health checks → Telegram client: checks connection (evidence: `src/apps/duties/services/health_check_services.py`)
- Telegram health status → Health checks: reports status (evidence: `src/apps/duties/services/telegram_health_status.py`)
- Technical break monitor → Notification scheduler: monitors schedule (evidence: `src/apps/duties/services/technical_break_settings.py`)
- Sheets client → Retry and backoff: retries requests (evidence: `src/apps/duties/services/google_client.py`)
- Slack client → Retry and backoff: retries requests (evidence: `src/apps/duties/services/slack_service.py`)
- Telegram client → Retry and backoff: retries requests (evidence: `src/apps/duties/services/telegram_integration.py`)
- Duty service → Circuit breaker: uses protection (evidence: `src/apps/duties/services/service.py`)
