# sco1/pyflysight architecture

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

- Interactive diagram: https://gitdiagram.com/sco1/pyflysight
- Repository: https://github.com/sco1/pyflysight

## Overview

##### Main Components

a. Core Processing Components:
- FlySight V1 Parser
- FlySight V2 Parser
- Log Processing Utilities
- Configuration Utilities
- Device Interaction Layer

b. Data Flow Components:
- Input Data Handlers (CSV files)
- Data Processing Pipeline
- Output Formatters
- Interactive Trimming Interface

**┌─ User Interface Layer ─────────────────────┐**
- CLI Interface                            │
- Interactive Trimming GUI                 │
- ┬───────────────────────┘
- ↓
**┌─ Processing Layer ──────────────────────────┐**
- ┌─ Parser Module ─┐  ┌─ Utils Module ─┐    │
- V1 Parser    │  │ - Log Utils    │    │
- V2 Parser    │  │ - Config Utils │    │
- ┘   └───────────────┘     │
- ┌─ Core Processing ─────────────────┐      │
- Data Transformation             │      │
- Time Series Processing          │      │
- Sensor Data Integration         │      │
- ┘       │
- ┬───────────────────────┘
- ↓
**┌─ Data Layer ────────────────────────────────┐**
- ┌─ Input Formats ─┐  ┌─ Output Formats ─┐   │
- V1 CSV       │  │ - Polars DF      │   │
- V2 CSV       │  │ - Trimmed CSV    │   │
- Config Files │  │ - JSON           │   │
- ┘   └────────────────┘    │
- ┘

##### Key Elements to Highlight

- Blue: User Interface components
- Green: Processing components
- Yellow: Data storage/formats
- Red: Critical paths/dependencies

b. Interaction Flows:
- Bidirectional data flow between parsers and core processing
- Data transformation pipeline
- Async operations for device interaction

##### Implementation Details

- The modular nature of the parsers
- The separation between device interaction and data processing
- The extensible nature of the processing pipeline
- The interactive trimming functionality as a separate module

##### Technical Stack Indicators

- Python 3.x
- Polars (for DataFrame processing)
- Click (for CLI)
- Plotting libraries for interactive trimming

##### Documentation Integration

Connections to:
- API Documentation
- Configuration Documentation
- User Guide Integration

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style definitions
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef processing fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef critical fill:#e74c3c,stroke:#c0392b,color:white

    %% User Interface Layer
    subgraph UI
        CLI["CLI Interface"]:::ui
        TrimGUI["Interactive Trimming GUI"]:::ui
    end

    %% Processing Layer
    subgraph Processing
        subgraph ParserModule["Parser Module"]
            V1Parser["FlySight V1 Parser"]:::processing
            V2Parser["FlySight V2 Parser"]:::processing
        end

        subgraph UtilsModule["Utils Module"]
            LogUtils["Log Processing Utils"]:::processing
            ConfigUtils["Configuration Utils"]:::processing
            DeviceUtils["Device Interaction Layer"]:::processing
        end

        subgraph CoreProc["Core Processing"]
            DataTransform["Data Transformation"]:::processing
            TimeSeries["Time Series Processing"]:::processing
            SensorIntegration["Sensor Data Integration"]:::processing
        end
    end

    %% Data Layer
    subgraph Data
        subgraph InputFormats["Input Formats"]
            V1CSV["V1 CSV Files"]:::data
            V2CSV["V2 CSV Files"]:::data
            ConfigFiles["Configuration Files"]:::data
        end

        subgraph OutputFormats["Output Formats"]
            PolarsDf["Polars DataFrame"]:::data
            TrimmedCSV["Trimmed CSV"]:::data
            JSONOut["JSON Output"]:::data
        end
    end

    %% Relationships
    CLI --> V1Parser
    CLI --> V2Parser
    TrimGUI --> CoreProc
    V1Parser --> DataTransform
    V2Parser --> DataTransform
    DataTransform --> TimeSeries
    TimeSeries --> SensorIntegration
    LogUtils --> CoreProc
    ConfigUtils --> CoreProc
    DeviceUtils --> CoreProc
    V1CSV --> V1Parser
    V2CSV --> V2Parser
    ConfigFiles --> ConfigUtils
    CoreProc --> PolarsDf
    CoreProc --> TrimmedCSV
    CoreProc --> JSONOut

    %% Click events for component mapping
    click CLI "https://github.com/sco1/pyflysight/blob/main/pyflysight/cli.py"
    click TrimGUI "https://github.com/sco1/pyflysight/blob/main/pyflysight/trim_app.py"
    click CoreProc "https://github.com/sco1/pyflysight/blob/main/pyflysight/flysight_proc.py"
    click ConfigUtils "https://github.com/sco1/pyflysight/blob/main/pyflysight/config_utils.py"
    click LogUtils "https://github.com/sco1/pyflysight/blob/main/pyflysight/log_utils.py"
    click DeviceUtils "https://github.com/sco1/pyflysight/blob/main/pyflysight/flysight_utils.py"
    click V1CSV "https://github.com/sco1/pyflysight/blob/main/tests/test_data/21-04-20.CSV"
    click V2CSV "https://github.com/sco1/pyflysight/blob/main/tests/test_data/24-01-01/04-20-00/TRACK.CSV"
    click ConfigFiles "https://github.com/sco1/pyflysight/tree/main/tests/test_data/config/"
    click V1Parser "https://github.com/sco1/pyflysight/blob/main/tests/test_flysight_v1_parser.py"
    click V2Parser "https://github.com/sco1/pyflysight/blob/main/tests/test_flysight_v2_parser.py"

    %% Legend
    subgraph Legend
        UI_Legend["User Interface"]:::ui
        Proc_Legend["Processing Component"]:::processing
        Data_Legend["Data Component"]:::data
        Crit_Legend["Critical Component"]:::critical
    end
```
