# daveebbelaar/tracking-barbell-exercises architecture

> Architecture diagram of the GitHub repository daveebbelaar/tracking-barbell-exercises, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-05). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/daveebbelaar/tracking-barbell-exercises
- Repository: https://github.com/daveebbelaar/tracking-barbell-exercises

## Overview

##### Main Components
- Data Sources – Represent the raw CSV files housed in the “PythonCode/data” directory (and subfolders like “form”). These are produced from the Mbientlab’s sensor device.
- Data Ingestion & Preprocessing – Include components from Chapter2 (“CreateDataset.py”) where the raw data is initially ingested and converted.
- Data Transformation & Cleaning – Cover Chapter3 scripts (e.g., “DataTransformation.py”, “ImputationMissingValues.py”, “KalmanFilters.py”, “OutlierDetection.py”). This stage involves cleaning the data, imputing missing values, filtering noise, and dealing with outliers.
- Feature Extraction (Abstraction) – Incorporate Chapter4 modules (“FrequencyAbstraction.py”, “TemporalAbstraction.py”, “TextAbstraction.py”) which extract different types of features from the sensor signals.
- Clustering & Distance Metrics – Add Chapter5 (e.g., “Clustering.py”, “DistanceMetrics.py”) that likely cluster similar exercises or patterns.
- Evaluation & Model Training – Represent Chapter7 (with “Evaluation.py”, “FeatureSelection.py”, “LearningAlgorithms.py”, “PrepareDatasetForLearning.py”) and Chapter8 (“LearningAlgorithmsTemporal.py” along with the dynsys subfolder code “Evaluator.py”, “Model.py”) where the machine learning models are built, selected, and evaluated.
- Visualization & Reporting – Indicate utility modules (e.g., “VisualizeDataset.py”, “ClassificationReport.py”) and example notebooks that output graphs and reports. These correspond to the “PythonCode/images” directory and notebook files which display the results.

##### Relationships and Interactions
- Then, indicate that the processed features feed into two branches: one for clustering analysis (Chapter5) and another for evaluation/model training (Chapter7 & Chapter8).
- Finally, highlight the role of “Visualization & Reporting” in consuming outputs from both the clustering and learning modules.
- Also, show that intermediate results are stored (see “PythonCode/intermediate_datafiles”) which may be reused or passed between stages.

##### Architectural Patterns and Design Principles
- Pipeline Architecture – Emphasize the clear sequential and modular steps (data ingestion, cleaning, feature extraction, and model training) that follow a pipeline pattern.

##### Relevant Technologies and Frameworks
- Python – The entire code base (scripts and notebooks) is in Python.
- Jupyter Notebooks – For exploratory analysis and demonstration of different data processing and learning steps.
- Machine Learning Libraries – Implicitly referenced by modules (e.g., clustering, learning algorithms) though specific libraries aren’t named. It’s likely that common libraries (numpy, pandas, scikit-learn, etc.) are used.
- Conda and Pip – Represent the deployment/runtime environment where dependencies are managed via “conda_requirements.txt” and “pip_requirements.txt”.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top Level: Data Sources and Environment
    DS["Raw Sensor Data"]:::data
    ENV["Python Environment\n(Jupyter Notebooks, Conda&Pip)"]:::env

    %% Data Ingestion & Preprocessing
    DIP["Data Ingestion & Preprocessing"]:::processing

    %% Data Transformation & Cleaning (Chapter3)
    subgraph "Data Transformation & Cleaning (Chapter3)"
        DT1["DataTransformation.py"]:::transformation
        DT2["ImputationMissingValues.py"]:::transformation
        DT3["KalmanFilters.py"]:::transformation
        DT4["OutlierDetection.py"]:::transformation
    end

    %% Feature Extraction (Chapter4)
    subgraph "Feature Extraction (Abstraction) (Chapter4)"
        FE1["FrequencyAbstraction.py"]:::extraction
        FE2["TemporalAbstraction.py"]:::extraction
        FE3["TextAbstraction.py"]:::extraction
    end

    %% Intermediate Data Storage
    IDS["Intermediate Data Storage"]:::processing

    %% Clustering & Distance Metrics (Chapter5)
    subgraph "Clustering & Distance Metrics (Chapter5)"
        CL1["Clustering.py"]:::processing
        CL2["DistanceMetrics.py"]:::processing
    end

    %% Evaluation & Model Training (Chapters7 & 8)
    subgraph "Evaluation & Model Training (Chapters7 & 8)"
        EV1["Evaluation.py"]:::ml
        EV2["FeatureSelection.py"]:::ml
        EV3["LearningAlgorithms.py"]:::ml
        EV4["PrepareDatasetForLearning.py"]:::ml
        LA1["LearningAlgorithmsTemporal.py"]:::ml
        LA2["Evaluator.py"]:::ml
        LA3["Model.py"]:::ml
    end

    %% Visualization & Reporting
    subgraph "Visualization & Reporting"
        VIS1["VisualizeDataset.py"]:::visual
        VIS2["ClassificationReport.py"]:::visual
        VIS3["Example Graphs"]:::visual
    end

    %% Data Flow Connections
    DS -->|"feeds"| DIP
    ENV --- DIP
    DIP --> DT1
    DT1 --> DT2
    DT2 --> DT3
    DT3 --> DT4
    DT4 --> FE1
    FE1 --> FE2
    FE2 --> FE3
    FE3 --> IDS

    %% Branching into Clustering and Evaluation
    IDS --> CL1
    CL1 --> CL2
    IDS --> EV1
    EV1 --> EV2
    EV2 --> EV3
    EV3 --> EV4
    EV4 --> LA1
    LA1 --> LA2
    LA2 --> LA3

    %% Merging into Visualization & Reporting
    CL2 --> VIS3
    LA3 --> VIS3
    VIS3 --> VIS1
    VIS3 --> VIS2

    %% Additional dotted connections from Environment
    ENV --- EV1
    ENV --- VIS3

    %% Click Events for Component Mapping
    click DS "https://github.com/daveebbelaar/tracking-barbell-exercises/tree/master/PythonCode/data"
    click DIP "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter2/CreateDataset.py"
    click DT1 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter3/DataTransformation.py"
    click DT2 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter3/ImputationMissingValues.py"
    click DT3 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter3/KalmanFilters.py"
    click DT4 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter3/OutlierDetection.py"
    click FE1 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter4/FrequencyAbstraction.py"
    click FE2 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter4/TemporalAbstraction.py"
    click FE3 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter4/TextAbstraction.py"
    click CL1 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter5/Clustering.py"
    click CL2 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter5/DistanceMetrics.py"
    click EV1 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter7/Evaluation.py"
    click EV2 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter7/FeatureSelection.py"
    click EV3 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter7/LearningAlgorithms.py"
    click EV4 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter7/PrepareDatasetForLearning.py"
    click LA1 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter8/LearningAlgorithmsTemporal.py"
    click LA2 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter8/dynsys/Evaluator.py"
    click LA3 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/Chapter8/dynsys/Model.py"
    click VIS1 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/util/VisualizeDataset.py"
    click VIS2 "https://github.com/daveebbelaar/tracking-barbell-exercises/blob/master/PythonCode/util/ClassificationReport.py"
    click VIS3 "https://github.com/daveebbelaar/tracking-barbell-exercises/tree/master/PythonCode/images"

    %% Styles
    classDef data fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef processing fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef transformation fill:#F5B7B1,stroke:#922B21,stroke-width:2px;
    classDef extraction fill:#FAD7A0,stroke:#B9770E,stroke-width:2px;
    classDef ml fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef visual fill:#D6EAF8,stroke:#2471A3,stroke-width:2px;
    classDef env fill:#E8DAEF,stroke:#6C3483,stroke-width:2px;
```
