# jrotheneder/notifier architecture

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

- Interactive diagram: https://gitdiagram.com/jrotheneder/notifier
- Repository: https://github.com/jrotheneder/notifier

## Overview

##### Main Components

a) User Interface Layer:
- Telegram Bot Interface (notifier_bot.py)
- It as the entry point for user interactions

b) Core Application Layer:
- Main Controller (notifier_main.py)
- Product Management System
- Tracking System

c) Scraping Layer:
- Web Scraping Modules (one for each retailer)
- Selenium WebDriver Helper

d) Data Model Layer:
- Product Classes Hierarchy
- Storage System (JSON file storage)

##### Component Relationships

**[Telegram Users] ←→ [Telegram Bot Interface]**
- ↓
**[Main Controller]**
- ↓
- ┌────┴────┐
**[Product Management] ←→ [Tracking System]**
- ↓
**[Scraping Layer]**
- ┌────┴────┐
**[Retailer Scrapers] ←→ [WebDriver Helper]**
- ↓
**[Product Classes]**
- ↓
**[Storage System]**

##### Important Details

a) Supported Retailers (show as connected modules):
- Zara
- Uniqlo
- Zalando
- H&M
- COS

b) Key Features (as annotations):
- Per-user tracking
- Price/availability monitoring
- JSON export/import
- Scheduled checks

##### Technical Elements

- Selenium WebDriver as a dependent service
- JSON file storage
- Configuration requirements (bot_token.txt, allowed_users.txt)

##### Data Flow Indicators

- User commands flow
- Scraping data flow
- Notification flow
- Storage operations

##### Implementation Notes

- Maintain a clear hierarchy from user interface to data storage
- Version information and supported retailers list

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef scraper fill:#e67e22,stroke:#d35400,color:white
    classDef model fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef storage fill:#34495e,stroke:#2c3e50,color:white

    %% User Interface Layer
    Users([Telegram Users]):::external
    TBot[Telegram Bot Interface]:::ui
    click TBot "https://github.com/jrotheneder/Notifier/blob/main/notifier_bot.py"

    %% Core Application Layer
    MainCtrl[Main Controller]:::core
    click MainCtrl "https://github.com/jrotheneder/Notifier/blob/main/notifier_main.py"
    ProdMgmt[Product Management]:::core
    TrackSys[Tracking System]:::core

    %% Data Layer
    Storage[(JSON Storage)]:::storage
    
    %% Base Models
    BaseProduct[Base Product Model]:::model
    click BaseProduct "https://github.com/jrotheneder/Notifier/blob/main/src/product.py"
    WebDriver[WebDriver Helper]:::core
    click WebDriver "https://github.com/jrotheneder/Notifier/blob/main/src/webdriverhelper.py"
    Exceptions[Exception Handler]:::core
    click Exceptions "https://github.com/jrotheneder/Notifier/blob/main/src/exceptions.py"

    %% Retail Specific Components
    subgraph Scrapers
        direction TB
        ZaraScraper[Zara Scraper]:::scraper
        click ZaraScraper "https://github.com/jrotheneder/Notifier/blob/main/src/zara_scraper.py"
        ZaraProd[Zara Product]:::model
        click ZaraProd "https://github.com/jrotheneder/Notifier/blob/main/src/zara_product.py"

        UniqloScraper[Uniqlo Scraper]:::scraper
        click UniqloScraper "https://github.com/jrotheneder/Notifier/blob/main/src/uniqlo_scraper.py"
        UniqloProd[Uniqlo Product]:::model
        click UniqloProd "https://github.com/jrotheneder/Notifier/blob/main/src/uniqlo_product.py"

        ZalandoScraper[Zalando Scraper]:::scraper
        click ZalandoScraper "https://github.com/jrotheneder/Notifier/blob/main/src/zalando_scraper.py"
        ZalandoProd[Zalando Product]:::model
        click ZalandoProd "https://github.com/jrotheneder/Notifier/blob/main/src/zalando_product.py"

        HMScraper[H&M Scraper]:::scraper
        click HMScraper "https://github.com/jrotheneder/Notifier/blob/main/src/hm_scraper.py"
        HMProd[H&M Product]:::model
        click HMProd "https://github.com/jrotheneder/Notifier/blob/main/src/hm_product.py"

        COSScraper[COS Scraper]:::scraper
        click COSScraper "https://github.com/jrotheneder/Notifier/blob/main/src/cos_scraper.py"
        COSProd[COS Product]:::model
        click COSProd "https://github.com/jrotheneder/Notifier/blob/main/src/cos_product.py"
    end

    Retailers([Retail Websites]):::external

    %% Relationships
    Users <--> TBot
    TBot <--> MainCtrl
    MainCtrl --> ProdMgmt
    MainCtrl --> TrackSys
    ProdMgmt <--> Storage
    TrackSys --> Scrapers
    
    %% Model Relationships
    BaseProduct --> ZaraProd & UniqloProd & ZalandoProd & HMProd & COSProd
    WebDriver --> Scrapers
    
    %% Scraper Relationships
    ZaraScraper & UniqloScraper & ZalandoScraper & HMScraper & COSScraper --> Retailers

    %% Legend
    subgraph Legend
        UI[User Interface]:::ui
        Core[Core Components]:::core
        Scrape[Scrapers]:::scraper
        Mod[Models]:::model
        Ext[External Systems]:::external
        Store[Storage]:::storage
    end
```
