# owlnext-fr/nocostorm architecture

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

- Interactive diagram: https://gitdiagram.com/owlnext-fr/nocostorm
- Repository: https://github.com/owlnext-fr/nocostorm

## Overview

##### Main Components Identification
The system has several key components that should be represented:

a. Core Components:
- CLI Interface (entry point)
- CSV Processor
- NocoDB API Client
- Multi-threading Manager
- Logger System

**[User Input Layer]**

**[Core Processing Layer]**

**[External Integration Layer]**

##### Component Relationships

a. Input Layer:
- CSV File Input
- CLI Arguments/Options
- Interactive Input Handler

b. Core Processing Layer:
- Command Processor (from src/core/command.rs)
- Context Manager (from src/core/context.rs)
- CSV Parser (from src/core/csv.rs)
- Multi-threading Controller

c. External Integration Layer:
- NocoDB API Client (from src/core/nocodb.rs)
- HTTP Request Handler
- Response Processor

##### Data Flow Representation

- CSV file → CSV Parser → Data Chunks
- Data Chunks → Multi-threading Controller → Parallel Workers
- Workers → NocoDB API Client → NocoDB Server

##### Specific Elements

a. Input Processing:
- CSV file input
- Configuration options (from CLI args)
- Interactive input handling

b. Core Processing:
- Chunk processing mechanism (chunk_size parameter)
- Parallel job distribution (parallel_jobs parameter)
- CSV parsing with encoding options

c. External Communication:
- HTTP requests to NocoDB API
- Authentication flow (API token usage)
- Error handling and logging

##### Important Notes

- Multi-threaded nature of the system
- Configurable parameters (chunk size, parallel jobs)
- Error handling and logging paths

##### Technical Details to Highlight

- CSV parsing options (separators, encoding)
- Authentication mechanism
- Parallel processing configuration
- Error handling and logging levels

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef input fill:#90EE90,stroke:#333,stroke-width:2px
    classDef core fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef external fill:#FFA500,stroke:#333,stroke-width:2px
    classDef support fill:#D3D3D3,stroke:#333,stroke-width:2px

    %% Input Layer
    subgraph Input
        CSV[("CSV File")]:::input
        CLI["CLI Interface"]:::input
        Args["CLI Arguments/Options"]:::input
        Interactive["Interactive Input Handler"]:::input
    end

    %% Core Processing Layer
    subgraph CoreProcessing
        CmdProc["Command Processor"]:::core
        CtxMgr["Context Manager"]:::core
        CSVParser["CSV Parser"]:::core
        MTController["Multi-threading Controller"]:::core
        Logger["Logger System"]:::core
    end

    %% External Integration Layer
    subgraph ExternalIntegration
        NocoAPI["NocoDB API Client"]:::external
        HTTPHandler["HTTP Request Handler"]:::external
        RespProc["Response Processor"]:::external
    end

    %% Relationships
    CSV --> CSVParser
    CLI --> Args
    CLI --> Interactive
    Args --> CmdProc
    Interactive --> CmdProc
    CmdProc --> CtxMgr
    CSVParser --> MTController
    MTController --> NocoAPI
    NocoAPI --> HTTPHandler
    HTTPHandler --> RespProc
    RespProc --> Logger

    %% Component click events
    click CLI "https://github.com/owlnext-fr/nocostorm/blob/main/src/main.rs"
    click CmdProc "https://github.com/owlnext-fr/nocostorm/blob/main/src/core/command.rs"
    click CtxMgr "https://github.com/owlnext-fr/nocostorm/blob/main/src/core/context.rs"
    click CSVParser "https://github.com/owlnext-fr/nocostorm/blob/main/src/core/csv.rs"
    click Logger "https://github.com/owlnext-fr/nocostorm/blob/main/src/core/logger.rs"
    click NocoAPI "https://github.com/owlnext-fr/nocostorm/blob/main/src/core/nocodb.rs"
    click CLI "https://github.com/owlnext-fr/nocostorm/blob/main/src/core/cli.rs"

    %% Legend
    subgraph Legend
        L1["Input Components"]:::input
        L2["Core Components"]:::core
        L3["External Components"]:::external
        L4["Support Systems"]:::support
    end
```
