# codemachinee/wb_parser architecture

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

- Interactive diagram: https://gitdiagram.com/codemachinee/wb_parser
- Repository: https://github.com/codemachinee/wb_parser

## Overview

##### Project type and purpose
- This is an open-source Python tool (“wb_parser”) whose goal is to fetch and parse various seller data from the Wildberries API.
- Key indicators:
- The README states “парсер различных данных продавца через wildberries_api.”
- Presence of modules like wb_api.py, parse.py, and output helpers (exel.py, google_sheets.py).

##### File structure
- Top-level Python modules:
- main.py – entry point
- FSM.py – finite-state machine logic to manage parsing sessions
- callbacks.py & keyboards.py – likely handle user interaction or command routing
- parse.py & wb_api.py – perform API requests and transform raw responses
- database.py – persistence layer (e.g., storing fetched data)
- file.py & functions.py – file I/O utilities and general business logic helpers
- exel.py & google_sheets.py – output/export modules to Excel or Google Sheets
- salute.py – perhaps greeting logic or startup messages
- Configuration and tooling:
- Dockerfile / .dockerignore / .python-version / pyproject.toml / requirements.txt
- tests/ suite with pytest configurations and at least one test file
- No “frontend” directory: this is a backend CLI or bot-style parser.

##### README for additional insights
- Minimal info: confirms this is a data parser using Wildberries API.

##### Detail without overthinking
- Configuration/infrastructure at the bottom or side (Docker, pyproject.toml)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface Layer
    subgraph "User Interface"
        UI_MAIN["main.py"]:::ui
        UI_KEY["keyboards.py"]:::ui
        UI_CB["callbacks.py"]:::ui
    end

    %% Controller / Orchestration Layer
    subgraph "Controller / Orchestration"
        CTRL_FSM["FSM.py"]:::business
        CTRL_FUN["functions.py"]:::business
    end

    %% API Integration Layer
    subgraph "API Integration"
        API_WB["wb_api.py"]:::io
        EXT_WB["Wildberries API"]:::external
    end

    %% Data Parsing Layer
    subgraph "Data Parsing"
        PARSE["parse.py"]:::io
    end

    %% Data Persistence Layer
    subgraph "Data Persistence"
        DB[(database.py)]:::io
        FILE["file.py"]:::io
        SYS_FILE["File System"]:::external
    end

    %% Output Modules Layer
    subgraph "Output Modules"
        OUT_EXEL["exel.py"]:::io
        OUT_GS["google_sheets.py"]:::io
        EXT_GS["Google Sheets API"]:::external
    end

    %% Configuration & Infrastructure
    subgraph "Configuration & Infrastructure"
        INF_DOCKER["Dockerfile"]:::infra
        INF_IGNORE[".dockerignore"]:::infra
        INF_PYVER[".python-version"]:::infra
        INF_PYPROJECT["pyproject.toml"]:::infra
        INF_REQ["requirements.txt"]:::infra
    end

    %% Testing Layer
    subgraph "Testing"
        TESTS_DIR["tests/"]:::test
        TEST_FUN["tests/test_functions_file.py"]:::test
    end

    %% Data Flow Connections
    UI_MAIN -->|invokes| CTRL_FSM
    UI_KEY -->|triggers| CTRL_FSM
    UI_CB -->|callbacks to| CTRL_FSM

    CTRL_FSM -->|orchestrates| CTRL_FUN
    CTRL_FUN -->|calls| API_WB
    API_WB -->|fetches data| EXT_WB
    API_WB -->|returns JSON| PARSE
    PARSE -->|parsed objects| CTRL_FUN

    CTRL_FUN -->|saves to| DB
    CTRL_FUN -->|writes to| FILE
    FILE -->|reads/writes| SYS_FILE

    CTRL_FUN -->|exports via| OUT_EXEL
    CTRL_FUN -->|exports via| OUT_GS
    OUT_GS -->|pushes to| EXT_GS

    %% Testing relationships
    TESTS_DIR -->|tests| CTRL_FUN
    TESTS_DIR -->|tests| FILE
    TEST_FUN -->|validates| CTRL_FUN
    TEST_FUN -->|validates| FILE

    %% Click Events
    click UI_MAIN "https://github.com/codemachinee/wb_parser/blob/main/main.py"
    click UI_KEY "https://github.com/codemachinee/wb_parser/blob/main/keyboards.py"
    click UI_CB "https://github.com/codemachinee/wb_parser/blob/main/callbacks.py"
    click CTRL_FSM "https://github.com/codemachinee/wb_parser/blob/main/FSM.py"
    click CTRL_FUN "https://github.com/codemachinee/wb_parser/blob/main/functions.py"
    click API_WB "https://github.com/codemachinee/wb_parser/blob/main/wb_api.py"
    click PARSE "https://github.com/codemachinee/wb_parser/blob/main/parse.py"
    click DB "https://github.com/codemachinee/wb_parser/blob/main/database.py"
    click FILE "https://github.com/codemachinee/wb_parser/blob/main/file.py"
    click OUT_EXEL "https://github.com/codemachinee/wb_parser/blob/main/exel.py"
    click OUT_GS "https://github.com/codemachinee/wb_parser/blob/main/google_sheets.py"
    click INF_DOCKER "https://github.com/codemachinee/wb_parser/tree/main/Dockerfile"
    click INF_IGNORE "https://github.com/codemachinee/wb_parser/blob/main/.dockerignore"
    click INF_PYVER "https://github.com/codemachinee/wb_parser/blob/main/.python-version"
    click INF_PYPROJECT "https://github.com/codemachinee/wb_parser/blob/main/pyproject.toml"
    click INF_REQ "https://github.com/codemachinee/wb_parser/blob/main/requirements.txt"
    click TESTS_DIR "https://github.com/codemachinee/wb_parser/tree/main/tests/"
    click TEST_FUN "https://github.com/codemachinee/wb_parser/blob/main/tests/test_functions_file.py"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef business fill:#90EE90,stroke:#333,stroke-width:1px
    classDef io fill:#FFA500,stroke:#333,stroke-width:1px
    classDef infra fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef test fill:#FFB6C1,stroke:#333,stroke-width:1px
    classDef external fill:#FFFFE0,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
