# falak097/daily-tasks-allocation-automation architecture

> Architecture diagram of the GitHub repository falak097/daily-tasks-allocation-automation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/falak097/daily-tasks-allocation-automation
- Repository: https://github.com/falak097/daily-tasks-allocation-automation

## Overview

##### Main Components
- Environment & Configuration:
- The .env file (copied from .env.example) holds critical configuration values such as the Google Sheet URL, Gmail credentials, and email recipient details.
- Google Sheets Client:
- Represented by sheets_client.py, this component is responsible for authenticating with the Google Sheets API (using credentials.json) and fetching task data.
- Email Composition & Styling:
- email_styles.py provides the templates or styling details needed for the email content.
- Email Sending:
- This function is in email_sender.py and handles email delivery through Gmail using the configured credentials.
- Mail Scheduler:
- The mail_scheduler.py module likely automates or manages the timing of these email dispatches.
- Main Orchestrator:
- main.py ties everything together, coordinating the data retrieval, processing, email composition, and sending process.
- GitHub Prompts (under .github/prompts):
- These might provide guidance or additional configurations (for emails and scheduling) but are less central to runtime behavior—they inform development and may be used for future automation enhancements.

##### Relationships and Data Flow
- The system starts with the main.py script, which orchestrates the overall flow.
- main.py invokes the mail_scheduler.py to schedule the service, ensuring that tasks run at the desired intervals.
- When triggered, the scheduler uses the sheets_client.py to fetch data from Google Sheets.
- The fetched data is then handed off to email_styles.py for generating a formatted email content.
- Finally, the email_sender.py sends the email to the intended recipients using the credentials from the .env file.
- Additionally, configuration and credentials (via .env and credentials.json) impact how the Google Sheets API and Gmail services are accessed.

##### Important Architectural Choices
- Modularity: Each file (module) handles a distinct responsibility—fetching data, styling emails, sending emails, and scheduling. This separation promotes clarity and maintainability.
- Environment-based Configuration: Highlight that sensitive configurations are managed via the .env file and credentials.json, ensuring secure and flexible deployment.

##### Technologies and Tools
- Python as the main programming language.
- Google Sheets API for data retrieval.
- Gmail (with app passwords) to send emails.
- Poetry for dependency management.
- Standard modules for scheduling tasks (as implemented in mail_scheduler.py) may be based on built-in libraries or third-party scheduling modules.

##### Final Advice
- Remember to include any notes about external service interactions and the configuration management strategy used within the automation process.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Main Orchestrator (main.py)"]:::module
    B["Mail Scheduler (mail_scheduler.py)"]:::module
    C["Google Sheets Client (sheets_client.py)"]:::module
    D["Email Composition & Styling (email_styles.py)"]:::module
    E["Email Sending (email_sender.py)"]:::module
    F["Environment & Configuration (.env)"]:::config
    G["Google Sheets API"]:::external
    H["Gmail SMTP"]:::external
    I["GitHub Prompts (.github/prompts)"]:::github

    A -->|"triggers"| B
    B -->|"fetchesData"| C
    C -->|"formatsDataFor"| D
    D -->|"sendsEmailVia"| E

    F -->|"configures"| C
    F -->|"configures"| E

    C -->|"authenticatesWith"| G
    E -->|"utilizes"| H

    A ---|"references"| I

    click F "https://github.com/falak097/daily-tasks-allocation-automation/blob/main/.env.example"
    click C "https://github.com/falak097/daily-tasks-allocation-automation/blob/main/sheets_client.py"
    click D "https://github.com/falak097/daily-tasks-allocation-automation/blob/main/email_styles.py"
    click E "https://github.com/falak097/daily-tasks-allocation-automation/blob/main/email_sender.py"
    click B "https://github.com/falak097/daily-tasks-allocation-automation/blob/main/mail_scheduler.py"
    click A "https://github.com/falak097/daily-tasks-allocation-automation/blob/main/main.py"
    click I "https://github.com/falak097/daily-tasks-allocation-automation/tree/main/.github/prompts"

    classDef module fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef config fill:#FFD700,stroke:#000,stroke-width:1px;
    classDef external fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef github fill:#FFA500,stroke:#000,stroke-width:1px;
```
