# yukunsun/leek architecture

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

- Interactive diagram: https://gitdiagram.com/yukunsun/leek
- Repository: https://github.com/yukunsun/leek

## Overview

##### Project Type Analysis
This is an automated notification system that:
- Runs on GitHub Actions
- Scrapes financial data from external sources
- Sends notifications via webhook integrations
- Focuses on two main functions: fund valuation and bond subscription alerts

##### Main Components

a) External Data Sources (Input Layer):
- DanJuanApp (Fund valuations)
- TongHuaShun Data Center (Bond data)

b) GitHub Actions Layer:
- Two separate workflows (.github/workflows/)
- app-leek-bond.yml
- app-leek-fund.yml

c) Core Processing Components:
- Bond Module (bond/applyNewBond.py)
- Fund Module (fund/valuationTable.py)
- Utility Module (util/webHookUtil.py)

d) Notification Endpoints:
- Enterprise WeChat Bot
- Other webhook-compatible platforms (Feishu, etc.)

**[External Data Sources] → [GitHub Actions Workflows] → [Processing Modules] → [Webhook Integration] → [Notification Platforms]**

##### Specific Implementation Details

1. External scrapers collect data from financial sources
2. GitHub Actions triggers the workflows on schedule
3. Processing modules analyze and format the data
4. Webhook utility sends formatted messages
5. Notification platforms receive and display alerts

b) Configuration elements:
- GitHub Secrets (WEB_HOOK_BOND, WEB_HOOK_FUND)
- Requirements from requirements.txt

##### Important Architectural Notes

- Serverless nature of the system
- Separation of concerns between bond and fund modules
- Common webhook utility used by both workflows
- Configuration management through GitHub Secrets

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef external fill:#a8d1f0,stroke:#333
    classDef github fill:#90EE90,stroke:#333
    classDef processing fill:#FFE4B5,stroke:#333
    classDef notification fill:#DDA0DD,stroke:#333
    classDef config fill:#D3D3D3,stroke:#333

    %% External Data Sources
    subgraph DataSources["External Data Sources"]
        DJA["DanJuanApp"]:::external
        THS["TongHuaShun Data Center"]:::external
    end

    %% GitHub Actions Layer
    subgraph GHActions["GitHub Actions Workflows"]
        BondWorkflow["Bond Workflow"]:::github
        FundWorkflow["Fund Workflow"]:::github
    end

    %% Processing Modules
    subgraph Processing["Processing Layer"]
        BondModule["Bond Processing Module"]:::processing
        FundModule["Fund Processing Module"]:::processing
        WebhookUtil["Webhook Utility"]:::processing
    end

    %% Configuration
    subgraph Config["Configuration"]
        GHSecrets["GitHub Secrets"]:::config
        Dependencies["Dependencies"]:::config
    end

    %% Notification Layer
    subgraph Notifications["Notification Layer"]
        WeChat["Enterprise WeChat Bot"]:::notification
        Feishu["Feishu"]:::notification
    end

    %% Connections
    THS --> BondWorkflow
    DJA --> FundWorkflow
    BondWorkflow --> BondModule
    FundWorkflow --> FundModule
    BondModule --> WebhookUtil
    FundModule --> WebhookUtil
    WebhookUtil --> WeChat
    WebhookUtil --> Feishu
    GHSecrets -.-> WebhookUtil
    Dependencies -.-> Processing

    %% Click Events
    click BondModule "https://github.com/YukunSun/leek/blob/master/bond/applyNewBond.py"
    click FundModule "https://github.com/YukunSun/leek/blob/master/fund/valuationTable.py"
    click WebhookUtil "https://github.com/YukunSun/leek/blob/master/util/webHookUtil.py"
    click BondWorkflow "https://github.com/YukunSun/leek/blob/master/.github/workflows/app-leek-bond.yml"
    click FundWorkflow "https://github.com/YukunSun/leek/blob/master/.github/workflows/app-leek-fund.yml"
    click Dependencies "https://github.com/YukunSun/leek/blob/master/requirements.txt"

    %% Legend
    subgraph Legend
        E["External Sources"]:::external
        G["GitHub Actions"]:::github
        P["Processing Modules"]:::processing
        N["Notification Services"]:::notification
        C["Configuration"]:::config
    end
```
