# rjchauhan18/gtu_notification architecture

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

- Interactive diagram: https://gitdiagram.com/rjchauhan18/gtu_notification
- Repository: https://github.com/rjchauhan18/gtu_notification

## Overview

##### Project type and purpose
- This is an open-source notification tool written in Python. It periodically scrapes the GTU website for new notifications, compares them to the last-seen notification stored locally, and sends alerts via email (and optionally Discord if the discord.py module is used).
- It is not a full-stack app or microservice suite, but rather a CLI/automation utility that can be scheduled (e.g., via GitHub Actions or cron).

##### File structure
- Top-level modules:
- main.py – the entrypoint orchestrating scraping and notifications
- Digital_guj_scraper.py – encapsulates the web-scraping logic against the GTU site
- discord.py – (optional) integration to post alerts to a Discord channel
- notifications.json / Record/ – local persistence of the last-seen notification ID or link
- Configuration and metadata:
- requirements.txt – Python dependencies (e.g., requests, BeautifulSoup, python-dotenv)
- .env (not in repo) – SMTP credentials for sending email
- .github/workflows/actions.yml – CI and scheduled execution definition
- Supporting files:
- README.md, Contributing.md, LICENSE, .gitignore, .readthedocs.yaml

##### README for additional insights
- The README describes:
- Program flow: check GTU site → detect new notification → send email → update state
- SMTP setup instructions
- Customization points (frequency, recipients list, content)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Subgraphs
    subgraph "Internal Modules"
        Scheduler["Scheduler"]:::internal
        Orchestrator["main.py\n(Notification Service)"]:::internal
        Scraper["Digital_guj_scraper.py"]:::internal
        EmailDispatcher["Email Dispatcher\n(smtplib)"]:::internal
        DiscordDispatcher["discord.py"]:::internal
        StateJSON[(notifications.json)]:::datastore
        RecordDir[(Record/)]:::datastore
    end

    subgraph "External Services"
        GTU["GTU Website"]:::external
        SMTP["SMTP Mail Server"]:::external
        DiscordAPI["Discord API"]:::external
        UsersEmail["User Email Inbox"]:::external
        UsersDiscord["Discord Channel"]:::external
    end

    %% Data Flow
    Scheduler -->|triggers| Orchestrator
    Orchestrator -->|calls| Scraper
    Scraper -->|HTTP request| GTU
    GTU -->|HTML response| Scraper
    Scraper -->|latest notification| Orchestrator
    Orchestrator -->|read state| StateJSON
    StateJSON -->|last-seen data| Orchestrator
    Orchestrator -->|archive record| RecordDir
    Orchestrator -->|update state| StateJSON
    Orchestrator -->|send email| EmailDispatcher
    EmailDispatcher -->|SMTP connect| SMTP
    SMTP -->|deliver email| UsersEmail
    Orchestrator -->|send message| DiscordDispatcher
    DiscordDispatcher -->|API call| DiscordAPI
    DiscordAPI -->|post message| UsersDiscord

    %% Click Events
    click Scheduler "https://github.com/rjchauhan18/gtu_notification/blob/main/.github/workflows/actions.yml"
    click Orchestrator "https://github.com/rjchauhan18/gtu_notification/blob/main/main.py"
    click Scraper "https://github.com/rjchauhan18/gtu_notification/blob/main/Digital_guj_scraper.py"
    click DiscordDispatcher "https://github.com/rjchauhan18/gtu_notification/blob/main/discord.py"
    click StateJSON "https://github.com/rjchauhan18/gtu_notification/blob/main/notifications.json"
    click RecordDir "https://github.com/rjchauhan18/gtu_notification/tree/main/Record/"
    click Requirements "https://github.com/rjchauhan18/gtu_notification/blob/main/requirements.txt"

    %% Styles
    classDef internal fill:#ADD8E6,stroke:#333,stroke-width:1px;
    classDef external fill:#90EE90,stroke:#333,stroke-width:1px;
    classDef datastore fill:#FFD700,stroke:#333,stroke-width:1px;
```
