# henicosa/conanbot architecture

> Architecture diagram of the GitHub repository henicosa/conanbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/henicosa/conanbot
- Repository: https://github.com/henicosa/conanbot

## Overview

##### Main Components

a) External Calendar Sources
- Multiple iCal calendar sources as external systems

b) Core Application Components
- Calendar Fetcher Service (conanbot.py)
- Calendar Processing Engine (icaltools.py)
- Calendar Merger (mrkalender.py)
- Logging System (applog.py)
- Web Interface (main.py, Flask application)

c) Storage/Configuration
- links.txt (calendar sources)
- Generated calendar data
- Application logs

##### Component Relationships

- External calendars → Calendar Fetcher
- Calendar Fetcher → Calendar Processing Engine
- Calendar Processing Engine → Calendar Merger
- Calendar Merger → Web Interface
- All components → Logging System

##### Technical Implementation Details

Elements:
- Docker container boundary (show containerization)
- Flask web server
- Static assets (CSS, HTML templates)
- Periodic scheduler (2-hour intervals)

##### Architectural Patterns to Highlight

- Microservice architecture (containerized application)
- Event-driven processing (periodic calendar updates)
- MVC pattern for web interface
- Pipeline pattern for calendar processing

## Diagram (Mermaid)

```mermaid
%%{init: {
  'theme': 'base',
  'themeVariables': {
    'primaryColor': '#2b2b2b',
    'primaryTextColor': '#fff',
    'primaryBorderColor': '#7C0000',
    'lineColor': '#F8B229',
    'secondaryColor': '#006100',
    'tertiaryColor': '#fff'
  }
}}%%

flowchart TB
    subgraph Legend
        direction TB
        L1[Internal Component]
        L2[(Storage)]
        L3([Process Component])
        L4>Web Interface]
        L5[("External Source")]
        style L1 fill:#f5f5f5
        style L2 fill:#dae8fc
        style L3 fill:#d5e8d4
        style L4 fill:#ffe6cc
        style L5 fill:#f8cecc
    end

    subgraph Docker["Docker Container"]
        direction TB
        
        subgraph Core["Core Processing"]
            direction TB
            Fetcher([Calendar Fetcher]):::process
            Processor([Calendar Processing Engine]):::process
            Merger([Calendar Merger]):::process
            Logger([Logging System]):::process
        end

        subgraph Web["Web Layer"]
            direction TB
            Flask[Flask Web Server]:::web
            Templates[HTML Templates]:::web
            Static[Static Assets]:::web
        end

        subgraph Storage["Storage"]
            direction TB
            Config[(Configuration)]:::storage
            Links[(Calendar Sources)]:::storage
            Logs[(Application Logs)]:::storage
        end

        Scheduler([Periodic Scheduler<br>2-hour intervals]):::process
    end

    ExternalCal1[("iCal Source 1")]:::external
    ExternalCal2[("iCal Source 2")]:::external
    ExternalCal3[("iCal Source 3")]:::external
    Users>End Users]:::user

    ExternalCal1 & ExternalCal2 & ExternalCal3 --> Fetcher
    Scheduler --> Fetcher
    Fetcher --> Processor
    Processor --> Merger
    Merger --> Flask
    Flask --> Templates
    Flask --> Static
    Core --> Logger
    Logger --> Logs
    Links --> Fetcher
    Config --> Core
    Users --> Flask

    %% Click events for component mapping
    click Fetcher "https://github.com/henicosa/ConanBot/blob/master/app/conanbot.py"
    click Processor "https://github.com/henicosa/ConanBot/blob/master/app/icaltools.py"
    click Merger "https://github.com/henicosa/ConanBot/blob/master/app/mrkalender.py"
    click Logger "https://github.com/henicosa/ConanBot/blob/master/app/applog.py"
    click Flask "https://github.com/henicosa/ConanBot/blob/master/app/main.py"
    click Static "https://github.com/henicosa/ConanBot/blob/master/static/styling.css"
    click Templates "https://github.com/henicosa/ConanBot/tree/master/templates"
    click Config "https://github.com/henicosa/ConanBot/blob/master/application.json"
    click Docker "https://github.com/henicosa/ConanBot/tree/master/app/Dockerfile"

    %% Styling
    classDef process fill:#d5e8d4,stroke:#82b366
    classDef storage fill:#dae8fc,stroke:#6c8ebf
    classDef web fill:#ffe6cc,stroke:#d79b00
    classDef external fill:#f8cecc,stroke:#b85450
    classDef user fill:#e1d5e7,stroke:#9673a6
```
