# ale8ander/opensrc_team4 architecture

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

- Interactive diagram: https://gitdiagram.com/ale8ander/opensrc_team4
- Repository: https://github.com/ale8ander/opensrc_team4

## Overview

##### Project type and purpose
- This is a full-stack, cross-platform “Hand Gesture Remote” application combining:
- A Flutter-based mobile/desktop client (front_app)
- A Python-based back-end that captures webcam video, runs computer-vision/gesture-recognition pipelines, and exposes a socket or HTTP interface to Flutter
- Purpose: recognize hand gestures via OpenCV (and/or custom ML) and send commands to the UI or other external devices.

##### File structure
Top-level components:
- front_app/      → Flutter front-end (Dart code, Android/iOS projects, pubspec.yaml, tests)
- connecting/    → glue code between Python server & Flutter client (Flask test server, socket/HTTP client, gesture_handler)
- integrated_tracker/ → main Python back-end service (gesture_core, recognizer, emoji mapping, my_socket, optional GUI)
- recognition/    → standalone gesture_recognizer prototype & tests
- run_all.{sh,bat} → helper scripts to launch front + back simultaneously
- requirements.txt → Python dependencies (OpenCV, Flask, numpy, etc.)

##### README for additional insights
- Confirms: “python main.py” launches the server
- No external databases—entirely real-time CV and socket communication
- Users must grant camera permissions (macOS note)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Hardware
    Camera["Webcam & OS Permissions"]:::external

    %% Gesture Recognition Server
    subgraph "Gesture Recognition Server"
        subgraph "Business Logic / CV"
            ServerMain["main.py"]:::logic
            GCore["gesture_core.py"]:::logic
            Recognizer["recognizer.py"]:::logic
            EmojiMapper["emoji.py"]:::logic
            Emojis["emojis/"]:::logic
        end
        subgraph "API / Connection Layer"
            FlaskAPI["flask_testserver.py"]:::api
            FlutterConnect["flutter_connect.py"]:::api
            GestureHandler["gesture_handler.py"]:::api
            SocketAdapter["my_socket.py"]:::api
        end
        OptionalGUI["my_gui.py"]:::optional
    end

    %% Flutter Client
    subgraph "Flutter Client"
        Pubspec["pubspec.yaml"]:::frontend
        FlutterUI["main.dart"]:::frontend
    end

    %% Recognition Prototype & Tests
    subgraph "Recognition Prototype & Tests"
        Prototype["gesture_recognizer.py"]:::logic
        RecogTest["recogtest.py"]:::logic
    end

    %% Helper Scripts
    subgraph "Launch Scripts"
        RunUnix["run_all.sh"]:::external
        RunWin["run_all.bat"]:::external
    end

    %% Data Flows
    Camera -->|"frame data"| GCore
    GCore -->|"process()"| Recognizer
    Recognizer -->|"map_emojis()"| EmojiMapper
    EmojiMapper -->|"gesture command"| GestureHandler

    GestureHandler -->|HTTP/WebSocket| FlaskAPI
    FlaskAPI -->|"JSON payload"| FlutterConnect
    SocketAdapter -->|"socket msg"| FlutterConnect
    FlutterConnect <-->|"gesture data"| FlutterUI

    OptionalGUI -.->|"debug view"| GCore

    Prototype -.-> GCore
    RecogTest -.-> Recognizer

    RunUnix --> ServerMain
    RunWin --> ServerMain
    RunUnix --> FlutterUI
    RunWin --> FlutterUI

    %% Click Events
    click FlutterUI "https://github.com/ale8ander/opensrc_team4/blob/main/front_app/lib/main.dart"
    click Pubspec "https://github.com/ale8ander/opensrc_team4/blob/main/front_app/pubspec.yaml"
    click FlaskAPI "https://github.com/ale8ander/opensrc_team4/blob/main/connecting/flask_testserver.py"
    click FlutterConnect "https://github.com/ale8ander/opensrc_team4/blob/main/connecting/flutter_connect.py"
    click GestureHandler "https://github.com/ale8ander/opensrc_team4/blob/main/connecting/gesture_handler.py"
    click SocketAdapter "https://github.com/ale8ander/opensrc_team4/blob/main/integrated_tracker/my_socket.py"
    click ServerMain "https://github.com/ale8ander/opensrc_team4/blob/main/integrated_tracker/main.py"
    click GCore "https://github.com/ale8ander/opensrc_team4/blob/main/integrated_tracker/gesture_core.py"
    click Recognizer "https://github.com/ale8ander/opensrc_team4/blob/main/integrated_tracker/recognizer.py"
    click EmojiMapper "https://github.com/ale8ander/opensrc_team4/blob/main/integrated_tracker/emoji.py"
    click Emojis "https://github.com/ale8ander/opensrc_team4/tree/main/integrated_tracker/emojis/"
    click OptionalGUI "https://github.com/ale8ander/opensrc_team4/blob/main/integrated_tracker/my_gui.py"
    click Prototype "https://github.com/ale8ander/opensrc_team4/blob/main/recognition/gesture_recognizer.py"
    click RecogTest "https://github.com/ale8ander/opensrc_team4/blob/main/recognition/recogtest.py"
    click RunUnix "https://github.com/ale8ander/opensrc_team4/blob/main/run_all.sh"
    click RunWin "https://github.com/ale8ander/opensrc_team4/blob/main/run_all.bat"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#3399ff,color:#000
    classDef api fill:#d4edda,stroke:#28a745,color:#000
    classDef logic fill:#ffe5b4,stroke:#ff9933,color:#000
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#000
    classDef optional fill:#f8d7da,stroke:#dc3545,color:#000,stroke-dasharray: 5 5
```
