# ki1ian/lena architecture

> Architecture diagram of the GitHub repository ki1ian/lena, 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/ki1ian/lena
- Repository: https://github.com/ki1ian/lena

## Overview

Lena is a Discord task-and-reminder assistant. Users add, find, list, remove, and review dated tasks through slash commands; commands use task/date logic and SQLite, while calendar-image commands render calendar views. A scheduled digest combines task status with saved personalization and optional weather. The graph preserves documented calendar-range and digest capabilities; some command bodies were omitted, so those links rely on the README rather than inspected call sites.

Main entry points: [`bot.py`](https://github.com/ki1ian/lena/blob/main/bot.py) (Digest composer), [`database.py`](https://github.com/ki1ian/lena/blob/main/database.py) (Task storage), [`ui_components.py`](https://github.com/ki1ian/lena/blob/main/ui_components.py) (Removal buttons), [`weather.py`](https://github.com/ki1ian/lena/blob/main/weather.py) (Weather forecast)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interaction["Discord interaction"]
  node_discord["Discord platform"]
  node_commands["Slash commands<br/>[bot.py]"]
  node_removal_ui["Removal buttons<br/>[ui_components.py]"]
end

subgraph group_tasks["Task management"]
  node_task_ops["Task operations<br/>[bot.py]"]
  node_date_logic["Date parsing<br/>[bot.py]"]
  node_task_model["Task model<br/>[task.py]"]
  node_task_store[("Task storage<br/>[database.py]")]
end

subgraph group_calendar["Calendar views"]
  node_calendar_queries["Calendar data<br/>[database.py]"]
  node_calendar_views["Range views<br/>[bot.py]"]
  node_image_renderer["Calendar images<br/>[calendar_image.py]"]
end

subgraph group_digest["Digest and preferences"]
  node_digest_scheduler["Daily scheduler<br/>[bot.py]"]
  node_digest_builder["Digest composer<br/>[bot.py]"]
  node_preferences[("Personal settings<br/>[database.py]")]
  node_weather_service["Weather forecast<br/>[weather.py]"]
  node_weather_api["OpenWeatherMap"]
end

node_user(("Server user"))

node_user -->|"uses commands"| node_discord
node_discord -->|"dispatches"| node_commands
node_commands -->|"routes task actions"| node_task_ops
node_task_ops -->|"parses due dates"| node_date_logic
node_task_ops -->|"reads and writes"| node_task_store
node_task_store -->|"builds tasks"| node_task_model
node_task_ops -->|"prompts selection"| node_removal_ui
node_removal_ui -->|"removes selected task"| node_task_store
node_commands -->|"routes range views"| node_calendar_views
node_calendar_views -->|"gets due tasks"| node_calendar_queries
node_calendar_views -->|"renders calendars"| node_image_renderer
node_digest_scheduler -->|"triggers daily"| node_digest_builder
node_digest_builder -->|"reads tasks"| node_task_store
node_digest_builder -->|"reads preferences"| node_preferences
node_digest_builder -->|"gets forecast"| node_weather_service
node_weather_service -->|"requests forecast"| node_weather_api
node_digest_builder -->|"posts digest"| node_discord

click node_commands "https://github.com/ki1ian/lena/blob/main/bot.py"
click node_removal_ui "https://github.com/ki1ian/lena/blob/main/ui_components.py"
click node_task_ops "https://github.com/ki1ian/lena/blob/main/bot.py"
click node_date_logic "https://github.com/ki1ian/lena/blob/main/bot.py"
click node_task_model "https://github.com/ki1ian/lena/blob/main/task.py"
click node_task_store "https://github.com/ki1ian/lena/blob/main/database.py"
click node_calendar_queries "https://github.com/ki1ian/lena/blob/main/database.py"
click node_calendar_views "https://github.com/ki1ian/lena/blob/main/bot.py"
click node_image_renderer "https://github.com/ki1ian/lena/blob/main/calendar_image.py"
click node_digest_scheduler "https://github.com/ki1ian/lena/blob/main/bot.py"
click node_digest_builder "https://github.com/ki1ian/lena/blob/main/bot.py"
click node_preferences "https://github.com/ki1ian/lena/blob/main/database.py"
click node_weather_service "https://github.com/ki1ian/lena/blob/main/weather.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_discord,node_commands,node_removal_ui,node_user toneBlue
class node_task_ops,node_date_logic,node_task_model,node_task_store toneAmber
class node_calendar_queries,node_calendar_views,node_image_renderer toneMint
class node_digest_scheduler,node_digest_builder,node_preferences,node_weather_service,node_weather_api toneRose
```

## Components

### Discord interaction

- **Discord platform**
- [Slash commands](https://github.com/ki1ian/lena/blob/main/bot.py): `bot.py`
- [Removal buttons](https://github.com/ki1ian/lena/blob/main/ui_components.py): `ui_components.py`

### Task management

- [Task operations](https://github.com/ki1ian/lena/blob/main/bot.py): `bot.py`
- [Date parsing](https://github.com/ki1ian/lena/blob/main/bot.py): `bot.py`
- [Task model](https://github.com/ki1ian/lena/blob/main/task.py): `task.py`
- [Task storage](https://github.com/ki1ian/lena/blob/main/database.py): `database.py`

### Calendar views

- [Calendar data](https://github.com/ki1ian/lena/blob/main/database.py): `database.py`
- [Range views](https://github.com/ki1ian/lena/blob/main/bot.py): `bot.py`
- [Calendar images](https://github.com/ki1ian/lena/blob/main/calendar_image.py): `calendar_image.py`

### Digest and preferences

- [Daily scheduler](https://github.com/ki1ian/lena/blob/main/bot.py): `bot.py`
- [Digest composer](https://github.com/ki1ian/lena/blob/main/bot.py): `bot.py`
- [Personal settings](https://github.com/ki1ian/lena/blob/main/database.py): `database.py`
- [Weather forecast](https://github.com/ki1ian/lena/blob/main/weather.py): `weather.py`
- **OpenWeatherMap**

### Other components

- **Server user**

## Connections

- Server user → Discord platform: uses commands (evidence: `README.md`)
- Discord platform → Slash commands: dispatches (evidence: `README.md`)
- Slash commands → Task operations: routes task actions (evidence: `README.md`)
- Task operations → Date parsing: parses due dates (evidence: `README.md`)
- Task operations → Task storage: reads and writes (evidence: `bot.py`)
- Task storage → Task model: builds tasks (evidence: `database.py`)
- Task operations → Removal buttons: prompts selection (evidence: `bot.py`)
- Removal buttons → Task storage: removes selected task (evidence: `ui_components.py`)
- Slash commands → Range views: routes range views (evidence: `README.md`)
- Range views → Calendar data: gets due tasks (evidence: `bot.py`)
- Range views → Calendar images: renders calendars (evidence: `README.md`)
- Daily scheduler → Digest composer: triggers daily (evidence: `bot.py`)
- Digest composer → Task storage: reads tasks (evidence: `bot.py`)
- Digest composer → Personal settings: reads preferences (evidence: `bot.py`)
- Digest composer → Weather forecast: gets forecast (evidence: `bot.py`)
- Weather forecast → OpenWeatherMap: requests forecast (evidence: `weather.py`)
- Digest composer → Discord platform: posts digest (evidence: `bot.py`)
