# taco-de/airflow-lab architecture

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

- Interactive diagram: https://gitdiagram.com/taco-de/airflow-lab
- Repository: https://github.com/taco-de/airflow-lab

## Overview

##### Project type and purpose
- From the file tree and README, this is an Airflow‐focused Python library / sample “lab” project.
- It provides a set of DAG factories (under `dags/dag_factory`), reuseable patterns (under `module/airflow/pattern/factory`), handlers (e.g., Slack notifications), and utility notifiers (Slack, Telegram).
- Its purpose is to demonstrate and package an extensible DAG‐generation framework and notification system for Airflow workflows.

##### File structure
- Top‐level files & dirs:
- `dags/`:
– `dag_factory/*`: sample DAG definitions using factory pattern.
– `sample.py`: example of a directly‐coded DAG.
- `module/`:
– `airflow/`: configuration (`conf.py`), handlers (`handler/slack.py`), patterns (`pattern/factory/dag_factory.py`).
– `util/notifier`: reusable notification modules (`slack.py`, `telegram.py`).
- `tests/`: unit tests.
- Configuration files: `pyproject.toml`, `.pylintrc`, `.pre-commit-config.yaml`, `env.example.json`.
- Architectural hints:
- DAG factory pattern under `module/airflow/pattern`.
- Handler abstraction in `module/airflow/handler`.
- Notification utilities decoupled under `module/util/notifier`.

##### README for additional insights
- Minimal content, but shows how to set `PYTHONPATH` so that `module/` becomes importable.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Airflow Platform
    subgraph "Airflow Platform"
        direction TB
        Scheduler["Scheduler"]:::airflow
        Webserver["Webserver (UI)"]:::airflow
        Worker["Worker(s)"]:::airflow
    end

    %% DAG Source
    subgraph "DAG Source" 
        direction TB
        DAGDefs["DAG Definitions"]:::dag
        SampleDAG["Sample DAG"]:::dag
        FactoryUsages["Sample DAG Factory Usages"]:::dag
    end

    %% Framework Modules
    subgraph "Framework Modules"
        direction TB
        Conf["Airflow Configuration Module"]:::core
        PatternPkg["Airflow Pattern Package"]:::core
        DagFactory["DAG Factory Framework Module"]:::core
        HandlerAbs["Handler Abstraction"]:::core
        SlackHandler["Slack Handler Implementation"]:::core
        NotifierPkg["Notification Utilities Package"]:::core
        SlackNotifier["Slack Notifier Backend"]:::core
        TelegramNotifier["Telegram Notifier Backend"]:::core
    end

    %% External Services
    subgraph "External Services"
        direction TB
        SlackAPI["Slack API"]:::external
        TelegramAPI["Telegram API"]:::external
    end

    %% CI/Test Pipeline
    subgraph "CI/Test Pipeline"
        direction TB
        Tests["Unit Tests Suite"]:::ci
        Pyproject["Project Configuration"]:::ci
        EnvTemplate["Environment Variables Template"]:::ci
        Precommit["Pre-commit Configuration"]:::ci
        PylintCfg["Pylint Configuration"]:::ci
    end

    %% Connections
    Scheduler -->|"loads DAGs from"| DAGDefs
    Scheduler -->|"loads DAGs from"| SampleDAG
    Scheduler -->|"loads DAGs from"| FactoryUsages

    DAGDefs -->|"calls factory"| DagFactory
    FactoryUsages -->|"calls factory"| DagFactory
    DagFactory -->|"uses patterns in"| PatternPkg
    PatternPkg -->|"defined in"| DagFactory

    Worker -->|"executes tasks defined by DAGs"| HandlerAbs
    HandlerAbs -->|"delegates to"| SlackHandler
    HandlerAbs -->|"delegates to"| NotifierPkg

    SlackHandler -->|"uses notifier"| SlackNotifier
    NotifierPkg -->|"provides implementations"| SlackNotifier
    NotifierPkg -->|"provides implementations"| TelegramNotifier

    SlackNotifier -->|"HTTP request"| SlackAPI
    TelegramNotifier -->|"HTTP request"| TelegramAPI

    Tests -->|"import & test"| DagFactory
    Tests -->|"import & test"| SlackNotifier
    Tests -->|"import & test"| TelegramNotifier

    EnvTemplate --> Conf
    Pyproject --> Conf
    Precommit --> Tests
    PylintCfg --> Tests

    %% Click Events
    click DAGDefs "https://github.com/taco-de/airflow-lab/tree/main/dags/"
    click SampleDAG "https://github.com/taco-de/airflow-lab/blob/main/dags/sample.py"
    click FactoryUsages "https://github.com/taco-de/airflow-lab/tree/main/dags/dag_factory/"
    click DagFactory "https://github.com/taco-de/airflow-lab/blob/main/module/airflow/pattern/factory/dag_factory.py"
    click PatternPkg "https://github.com/taco-de/airflow-lab/tree/main/module/airflow/pattern/"
    click HandlerAbs "https://github.com/taco-de/airflow-lab/blob/main/module/airflow/handler/__init__.py"
    click SlackHandler "https://github.com/taco-de/airflow-lab/blob/main/module/airflow/handler/slack.py"
    click Conf "https://github.com/taco-de/airflow-lab/blob/main/module/airflow/conf.py"
    click NotifierPkg "https://github.com/taco-de/airflow-lab/tree/main/module/util/notifier/"
    click SlackNotifier "https://github.com/taco-de/airflow-lab/blob/main/module/util/notifier/slack.py"
    click TelegramNotifier "https://github.com/taco-de/airflow-lab/blob/main/module/util/notifier/telegram.py"
    click Tests "https://github.com/taco-de/airflow-lab/tree/main/tests/"
    click Pyproject "https://github.com/taco-de/airflow-lab/blob/main/pyproject.toml"
    click EnvTemplate "https://github.com/taco-de/airflow-lab/blob/main/env.example.json"
    click Precommit "https://github.com/taco-de/airflow-lab/blob/main/.pre-commit-config.yaml"
    click PylintCfg "https://github.com/taco-de/airflow-lab/blob/main/.pylintrc"

    %% Styles
    classDef airflow fill:#b3e5fc,stroke:#333,stroke-width:1px
    classDef dag fill:#c8e6c9,stroke:#333,stroke-width:1px
    classDef core fill:#bbdefb,stroke:#333,stroke-width:1px
    classDef external fill:#ffe0b2,stroke:#333,stroke-width:1px
    classDef ci fill:#eeeeee,stroke:#333,stroke-width:1px
```
