# fawq/test-polars architecture

> Architecture diagram of the GitHub repository fawq/test-polars, 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/fawq/test-polars
- Repository: https://github.com/fawq/test-polars

## Overview

##### Main Components
- Command-Line Interface (CLI) Entrypoints:
– Python Runner: Using the “uv” manager (see README commands). This uses the Python module in src/test_polars (with its __main__.py acting as an entry point) and its supporting utilities (process_csv.py and process_data.py).
– Rust Runner: The Rust side uses Cargo; the main.rs in src/ is the entry point, with core processing code in src/utils (with modules such as process_csv.rs and process_data.rs).

- Core Processing Components:
– CSV Processing: Both implementations provide modules for reading and processing CSV files. For Python, this is under src/test_polars/utils; for Rust it is located in src/utils.
– Data Processing / Join Logic: This encapsulates the join operations (inner, outer, left, right, etc.) as depicted in the README’s “Results” section. These algorithms are implemented respectively in Rust and Python.

- Data Resources:
– Test Data Directory (test/data): Contains CSV files (ip_request.csv and ip_response.csv) which serve as input examples for running the tool.

##### Relationships and Interactions
- Both languages’ entry points accept CSV file paths as input parameters via the command line.
- They pass these inputs to their respective CSV processing modules.
- After ingesting the CSV files, the data processing components perform various join operations and data manipulations, outputting DataFrames similar to those described in the README.

##### Architectural Patterns and Design Principles
- Separation of Concerns: Distinct modules handle input parsing, CSV processing, and data joining.
- Dual Implementation Layers: The system is intentionally split to provide parallel Python and Rust implementations for similar functionality, which suggests an experimental or comparative design.
- Modularity and Reusability: The utility functions (e.g., those in the “utils” directories) are clearly separated, making it easier to identify and isolate components.

##### Relevant Technologies, Frameworks, and Tools
- For the Python side: The use of the “uv” manager (an external dependency) along with typical Python module structure.
- For the Rust side: Cargo as the build and package manager, using multiple source modules.
- Both parts process CSV data–which is likely based on the polars library (hinted by the project name “Test Polars”).

##### Elements
- Clear labels for each major component (CLI, CSV Processor, Data Processor/Join Engine, Test Data).
– Shared resources (like test data)
- External dependencies such as the uv and Cargo tools.

## Diagram (Mermaid)

```mermaid
flowchart TD
    TestData["Test Data CSV Files"]:::shared

    subgraph "Python Implementation"
        PythonCLI["CLI Entrypoint (uv)"]:::python
        PythonCSV["CSV Processing Module"]:::python
        PythonDP["Data Processing / Join Logic"]:::python
        PythonCLI -->|"parsesCSV"| PythonCSV
        PythonCSV -->|"processesData"| PythonDP
    end

    subgraph "Rust Implementation"
        RustCLI["CLI Entrypoint (Cargo)"]:::rust
        RustCSV["CSV Processing Module"]:::rust
        RustDP["Data Processing / Join Logic"]:::rust
        RustCLI -->|"parsesCSV"| RustCSV
        RustCSV -->|"processesData"| RustDP
    end

    Final["Output: DataFrame Join Results"]:::output

    TestData -->|"feeds"| PythonCLI
    TestData -->|"feeds"| RustCLI
    PythonDP -->|"outputs"| Final
    RustDP -->|"outputs"| Final

    click PythonCLI "https://github.com/fawq/test-polars/blob/master/src/test_polars/__main__.py"
    click PythonCSV "https://github.com/fawq/test-polars/blob/master/src/test_polars/utils/process_csv.py"
    click PythonDP "https://github.com/fawq/test-polars/blob/master/src/test_polars/utils/process_data.py"
    click RustCLI "https://github.com/fawq/test-polars/blob/master/src/main.rs"
    click RustCSV "https://github.com/fawq/test-polars/blob/master/src/utils/process_csv.rs"
    click RustDP "https://github.com/fawq/test-polars/blob/master/src/utils/process_data.rs"
    click TestData "https://github.com/fawq/test-polars/tree/master/test/data"

    classDef python fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef rust fill:#F08080,stroke:#000,stroke-width:2px;
    classDef shared fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef output fill:#FFFF99,stroke:#000,stroke-width:2px;
```
