# alainpaumen/polarflowtostravacropper architecture

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

## Overview

##### Client-Side Components (Browser Environment)
- File Input Handler (TcxFileReader.jsx)
- Data Processing Layer (ActivityData.jsx)
- Visualization Component (HeartRateChart.jsx)
- UI Components Layer (components/ui/*)
- File Export System

##### External Systems (to be shown as external entities)
- Polar Flow (data source)
- Strava (destination)

##### Component Relationships
- [Polar TCX File] → [File Input Handler] → [Activity Data Processor]
- ↓
- [Strava Upload] ← [Modified TCX File] ← [Data Export] ← [Heart Rate Chart]

##### Specific Implementation Details
- TcxFileReader: "TCX Parser & Validator"
- ActivityData: "Activity Data Management"
- HeartRateChart: "Interactive Graph Component"
- Utils Layer: "Time & Array Processing Utilities"

##### Technical Stack Indicators
A tech stack section showing:
- React (Frontend Framework)
- Vite (Build Tool)
- Tailwind CSS (Styling)

Important Considerations:

##### Privacy Flow
- Client-side only processing with a clear boundary
- No server connections except user-initiated file transfers

##### User Interaction Points
- File upload area
- Graph interaction zone
- Download trigger point

##### State Management
- Data flow between components
- Where activity data is stored and processed

##### Error Handling
- Validation checkpoints
- Error feedback loops

Remember to emphasize that this is a browser-based tool with no backend, which is crucial for understanding the architecture and privacy aspects of the application.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "External Data Sources"
        PolarFlow[Polar Flow]:::external
        Strava[Strava]:::external
    end

    subgraph "Input Layer"
        FileInput["File Input Handler"]:::input
        TcxReader["TCX Parser & Validator"]:::input
    end

    subgraph "Processing Core"
        ActivityProcessor["Activity Data Management"]:::processing
        Utils["Utility Layer"]:::processing
        TimeUtils["Time Processing"]:::processing
        ArrayUtils["Array Processing"]:::processing
    end

    subgraph "Visualization Layer"
        HeartRate["Heart Rate Chart"]:::viz
        UIComponents["UI Components"]:::viz
        Button["Button Component"]:::viz
        Input["Input Component"]:::viz
        Separator["Separator Component"]:::viz
    end

    subgraph "Output Layer"
        DataExport["Data Export System"]:::output
        ModifiedTCX["Modified TCX File"]:::output
    end

    %% Main Flow
    PolarFlow --> FileInput
    FileInput --> TcxReader
    TcxReader --> ActivityProcessor
    ActivityProcessor --> HeartRate
    HeartRate --> DataExport
    DataExport --> ModifiedTCX
    ModifiedTCX --> Strava

    %% Utility Connections
    Utils --> ActivityProcessor
    TimeUtils --> ActivityProcessor
    ArrayUtils --> ActivityProcessor
    UIComponents --> HeartRate
    Button --> UIComponents
    Input --> UIComponents
    Separator --> UIComponents

    %% Click Events
    click FileInput "https://github.com/AlainPaumen/polarFlowToStravaCropper/blob/main/src/TcxFileReader.jsx"
    click ActivityProcessor "https://github.com/AlainPaumen/polarFlowToStravaCropper/blob/main/src/ActivityData.jsx"
    click HeartRate "https://github.com/AlainPaumen/polarFlowToStravaCropper/blob/main/src/HeartRateChart.jsx"
    click UIComponents "https://github.com/AlainPaumen/polarFlowToStravaCropper/tree/main/src/components/ui/"
    click TimeUtils "https://github.com/AlainPaumen/polarFlowToStravaCropper/blob/main/src/utils/timeUtils.js"
    click ArrayUtils "https://github.com/AlainPaumen/polarFlowToStravaCropper/blob/main/src/utils/arrayUtils.js"
    click Utils "https://github.com/AlainPaumen/polarFlowToStravaCropper/blob/main/src/utils/utils.js"
    click Button "https://github.com/AlainPaumen/polarFlowToStravaCropper/blob/main/src/components/ui/button.jsx"
    click Input "https://github.com/AlainPaumen/polarFlowToStravaCropper/blob/main/src/components/ui/input.jsx"
    click Separator "https://github.com/AlainPaumen/polarFlowToStravaCropper/blob/main/src/components/ui/separator.jsx"

    %% Styling
    classDef external fill:#gray,stroke:#333,stroke-width:2px
    classDef input fill:#blue,stroke:#333,stroke-width:2px
    classDef processing fill:#green,stroke:#333,stroke-width:2px
    classDef viz fill:#orange,stroke:#333,stroke-width:2px
    classDef output fill:#blue,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[External Systems]:::external
        L2[Input/Output]:::input
        L3[Processing]:::processing
        L4[Visualization]:::viz
    end
```
