# carson-eeee/event-schedule architecture

> Architecture diagram of the GitHub repository carson-eeee/event-schedule, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/carson-eeee/event-schedule
- Repository: https://github.com/carson-eeee/event-schedule

## Overview

##### Project type and purpose
- This is a Python-based Discord bot (“event-schedule”) whose job is to respond to user commands on Discord, pull or generate event schedules (from local JSON or via AI), produce QR codes, and fetch weather information. It’s an event-scheduling assistant running entirely as a single process (bot.py) with multiple helper modules.

##### File structure
- Top level:
- bot.py           ← main entrypoint, Discord client and command handlers
- timetable_functions.py ← logic to load/test schedules (JSON in test_data)
- qr_code.py       ← QR code generation module
- request_AI.py    ← wrapper around OpenAI API calls
- weather.py       ← weather API integration
- test_data/       ← local JSON files (sample event schedules)
- qrcode_logs.log… ← runtime log file
- .txt         ← developer notes
- .env             ← environment variable definitions (token, API keys)
- There are no separate “frontend” or “backend” directories—this is a single service with clear functional modules.
- Configuration is minimal: environment variables (DISCORD_BOT_TOKEN, OPENAI_API_KEY) and Python dependencies (implied by imports).

##### Insights from README
- The bot needs a Discord token and an OpenAI API key.
- Usage is simply “python bot.py”. No containerization, no external database.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Services
    DiscordAPI["Discord API"]:::external
    OpenAIAPI["OpenAI API"]:::external
    WeatherAPI["Weather API"]:::external

    %% Internal Modules and Data
    subgraph "Event-Schedule Bot Service"
        Bot["Discord Bot\n(bot.py)\nENV: DISCORD_BOT_TOKEN, OPENAI_API_KEY"]:::internal
        Schedule["Schedule Engine\n(timetable_functions.py)"]:::internal
        QR["QR-Code Generator\n(qr_code.py)"]:::internal
        AI["AI Service Client\n(request_AI.py)"]:::internal
        Weather["Weather Client\n(weather.py)"]:::internal
        Logging["Logging & Storage\n(qrcode_logs.log.2025-05-24)"]:::data
        Data["Schedule Data Store\n(test_data/]"]:::data
        Notes["Developer Notes\n(note.txt)"]:::data
        Readme["Readme & License\n(README.md, LICENSE)"]:::data
    end

    %% Flows
    DiscordAPI -->|"Event"| Bot
    Bot -->|"get_schedule()"| Schedule
    Schedule -->|"read JSON"| Data
    Bot -->|"POST prompt"| AI
    AI -->|"API call"| OpenAIAPI
    OpenAIAPI -->|"response"| AI
    Bot -->|"fetch_weather()"| Weather
    Weather -->|"API call"| WeatherAPI
    WeatherAPI -->|"response"| Weather
    Bot -->|"generate_qr()"| QR
    Bot -->|"respond"| DiscordAPI

    %% Logging flows
    Bot -->|logs| Logging
    Schedule -->|logs| Logging
    AI -->|logs| Logging
    Weather -->|logs| Logging
    QR -->|logs| Logging

    %% Click Events
    click Bot "https://github.com/carson-eeee/event-schedule/blob/main/bot.py"
    click Schedule "https://github.com/carson-eeee/event-schedule/blob/main/timetable_functions.py"
    click Data "https://github.com/carson-eeee/event-schedule/tree/main/test_data/"
    click QR "https://github.com/carson-eeee/event-schedule/blob/main/qr_code.py"
    click AI "https://github.com/carson-eeee/event-schedule/blob/main/request_AI.py"
    click Weather "https://github.com/carson-eeee/event-schedule/blob/main/weather.py"
    click Logging "https://github.com/carson-eeee/event-schedule/blob/main/qrcode_logs.log.2025-05-24"
    click Notes "https://github.com/carson-eeee/event-schedule/blob/main/note.txt"
    click Readme "https://github.com/carson-eeee/event-schedule/blob/main/README.md"
    click Readme "https://github.com/carson-eeee/event-schedule/tree/main/LICENSE"

    %% Styles
    classDef internal fill:#a2d2ff,stroke:#000;
    classDef external fill:#ffafcc,stroke:#000;
    classDef data fill:#caffbf,stroke:#000;
```
