# d33pk3rn3l/altitimematcher architecture

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

- Interactive diagram: https://gitdiagram.com/d33pk3rn3l/altitimematcher
- Repository: https://github.com/d33pk3rn3l/altitimematcher

## Overview

##### Main Components
- GUI Component: Represented by the main application (main.py) and the GUI elements built using tkinter/customtkinter. This is the user interface that provides buttons for selecting files, entering liftoff time and row index, and triggering visualizations.
- Data Handling Module: This component encompasses the logic to load and process the CSV (altimeter) and TXT (IMU) files. It includes reading the files (ensuring proper columns as expected), processing the timestamps, and saving the resulting CSV.
- Visualization Module: Embodied partly in webview_plotly.py, this is responsible for generating interactive visualizations of the altimeter heights and acceleration data via Plotly. It likely collaborates with the GUI.
- External Libraries & Dependencies: Indicate dependencies such as pandas (for data manipulation), Plotly (for visualization), tkinter/customtkinter (for GUI), and webview (for embedding web content). Python 3 is the runtime.

##### Relationships and Interactions
- The GUI component (main.py) serves as the entry point, handling user inputs (file selections, liftoff time/index) and then relaying these commands to the Data Handling and Visualization modules.
- The Data Handling module uses pandas to load/process files and communicates back processed data for further visualization.
- The Visualization module calls Plotly (and possibly uses webview as a container) to render charts that the GUI displays.
- Data flows from the file system (CSV and TXT file inputs) into the Data Handling module, then into the Visualization module, with processed results also being written back as a CSV output file.
- The packaging build tool (pyinstaller) is used separately to bundle everything into a standalone executable for end-users.

##### Architectural Patterns and Principles
- Modular Structure: The division into separate files (main.py for core application logic, webview_plotly.py for visualization) shows a clear modular separation.
- Separation of Concerns: Input handling, data processing, and visualization are distinct functional blocks.
- Dependency Management: External libraries (pandas, tkinter, plotly) are clearly identified in the requirements.txt to manage dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% GUI Layer
    subgraph "GUI Layer"
        GUI["GUI Component (main.py)"]:::module
    end

    %% Data Processing Layer
    subgraph "Data Processing Layer"
        DataHandling["Data Handling Module (CSV/TXT Processing)"]:::module
    end

    %% Visualization Layer
    subgraph "Visualization Layer"
        Visualization["Visualization Module (webview_plotly.py)"]:::module
    end

    %% Deployment Layer
    subgraph "Deployment Layer"
        Packaging["Packaging (pyinstaller)"]:::packaging
        Assets["Assets (img/icon.icns)"]:::asset
    end

    %% Dependencies
    subgraph "Dependencies"
        Libs["External Libraries (requirements.txt)"]:::external
    end

    %% Data Flow Connections
    GUI -->|"triggers"| DataHandling
    DataHandling -->|"processes_data"| Visualization
    Visualization -->|"renders_in_GUI"| GUI
    DataHandling -->|"reads_files_via"| Libs
    Visualization -->|"utilizes"| Libs
    DataHandling -->|"writes_output_CSV"| GUI

    %% Packaging Connections
    Packaging -->|"includes"| Assets

    %% Click Events
    click GUI "https://github.com/d33pk3rn3l/altitimematcher/blob/main/main.py"
    click DataHandling "https://github.com/d33pk3rn3l/altitimematcher/blob/main/main.py"
    click Visualization "https://github.com/d33pk3rn3l/altitimematcher/blob/main/webview_plotly.py"
    click Libs "https://github.com/d33pk3rn3l/altitimematcher/blob/main/requirements.txt"
    click Assets "https://github.com/d33pk3rn3l/altitimematcher/blob/main/img/icon.icns"

    %% Styles
    classDef module fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef external fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef packaging fill:#A9DFBF,stroke:#27AE60,stroke-width:2px;
    classDef asset fill:#FADBD8,stroke:#E74C3C,stroke-width:2px;
```
