# danmoksh/visionedge architecture

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

- Interactive diagram: https://gitdiagram.com/danmoksh/visionedge
- Repository: https://github.com/danmoksh/visionedge

## Overview

##### Project Type and Purpose
- This is a real‐time, full‐stack detection and alert system. The “frontend” is a minimal web UI (Flask app + templates), while the “backend” is responsible for ingesting live video, running a YOLO ML model, capturing telemetry data, logging to a database, and sending alerts. The system coordinates hardware (VTOL drone, camera, transmitter, telemetry module, remote control) with server‐side processing for debris detection and eventual removal.

##### File Structure
- Top Level
- app.py — Main Flask application plus server‐side processing logic
- templates/index.html — Frontend view
- README.md, LICENSE, .gitignore
- No separate “src” or “backend”/“frontend” folders, but the MVC pattern is implied:
- Controller & business logic in app.py
- View in templates/
- No dedicated “tests” or “config” folder, so configuration is likely embedded in app.py or environment variables.

##### README for Additional Insights
- System overview describes:
- VTOL drone flight → live video stream → server processing → YOLO inference → telemetry lookup → database log → alerting.
- Future pick‐and‐place rover component marked as “WIP.”
- Technology stack implied: Python, Flask, YOLO (TensorFlow or PyTorch), relational or time‐series database, potential alerting (email/SMS/WebSocket).

a. Main Components
- Hardware Layer
- VTOL Drone
- GoPro Camera
- VTX/HDMI TX‐RX (video link)
- Telemetry Module
- RX Remote Control
- Software Layer
- Web Server (Flask app.py)
- YOLO AI Model
- Database Storage (e.g., PostgreSQL/SQLite)
- Alerting System (e.g., email/SMS/WebSocket)
- Frontend UI (templates/index.html)
- Future Component
- Autonomous Pick‐and‐Place Rover
b. Relationships & Data Flows
- Drone captures video → Camera → VTX → Server endpoint
- Server forwards each frame to YOLO model → returns detection results
- If debris found → Server queries Telemetry Module for GPS → writes record in Database → triggers Alerting System → updates Frontend UI
- Server feeds annotated frames back to UI or ground‐team dashboard
- Controller loop continues until mission end
- Manual override path: RX Remote → Manual Flight Control → conflict resolution → either resumes auto or manual landing
- Future path: After alert, coordinate forwarded to Rover subsystem
c. Architectural Patterns & Principles
- MVC for the web interface
- Event‐driven pipeline for frame processing
- Single‐process monolith for now; could evolve to microservices (separate inference, API, alerting)
- Separation of concerns: hardware ingestion, AI inference, data storage, user interface, alerting
- Fault tolerance: manual override, safe landing path
d. Key Technologies & Frameworks
- Python + Flask
- YOLO model (likely PyTorch or TensorFlow)
- HTML/CSS for frontend
- VTX/HDMI hardware link
- Telemetry API or serial interface
- Relational DB (configurable)
- Alerting (SMTP, SMS gateway, webhooks)

##### Essential Details
- Don’t omit the manual override branch or the WIP rover path.
- Interactions with external services (e.g., SMTP server, SMS gateway) if in scope.
- Call out real‐time requirements by annotating the video‐inference loop latency constraints.
- Version or environment details only if relevant (e.g., Python 3.8+, Flask version, model framework).

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Hardware Layer"
        Drone["VTOL Drone"]:::hardware
        Camera["GoPro Camera"]:::hardware
        VTX["VTX/HDMI TX-RX"]:::hardware
        TelemetryHW["Telemetry Module"]:::hardware
        Remote["RX Remote Control"]:::hardware
    end

    subgraph "Server Processing"
        Flask["Web Server (Flask App)"]:::software
        YOLO["YOLO Inference Engine"]:::software
    end

    subgraph "Data Management"
        DB["Database Storage"]:::data
        TelemetryAPI["Telemetry Module Interface"]:::software
    end

    subgraph "Presentation & Alerts"
        UI["Frontend UI (templates/index.html)"]:::software
        Alert["Alerting System"]:::alerts
        SMTP["SMTP / SMS Gateway"]:::alerts
    end

    subgraph "Future (WIP)"
        Rover["Autonomous Pick-and-Place Rover"]:::future
    end

    subgraph "Project Documentation"
        README["README.md"]:::future
        LICENSEF["LICENSE"]:::future
        GITIGNORE[".gitignore"]:::future
    end

    Drone -->|"Video Feed"| Camera
    Camera -->|"HDMI Stream"| VTX
    VTX -->|"RTSP Stream"| Flask
    Flask -->|"frame"| YOLO
    YOLO -->|"detection results"| Flask
    Flask -->|"GPS Query"| TelemetryAPI
    TelemetryAPI -->|"telemetry data"| Flask
    Flask -->|"log record"| DB
    Flask -->|"trigger alert"| Alert
    Alert -->|"send alert"| SMTP
    Flask -->|"annotated frames"| UI
    Remote -->|"manual override"| Flask
    Alert -->|"coordinate mission"| Rover

    click Flask "https://github.com/danmoksh/visionedge/blob/main/app.py"
    click YOLO "https://github.com/danmoksh/visionedge/blob/main/app.py"
    click TelemetryAPI "https://github.com/danmoksh/visionedge/blob/main/app.py"
    click DB "https://github.com/danmoksh/visionedge/blob/main/app.py"
    click Alert "https://github.com/danmoksh/visionedge/blob/main/app.py"
    click UI "https://github.com/danmoksh/visionedge/blob/main/templates/index.html"
    click README "https://github.com/danmoksh/visionedge/blob/main/README.md"
    click LICENSEF "https://github.com/danmoksh/visionedge/tree/main/LICENSE"
    click GITIGNORE "https://github.com/danmoksh/visionedge/blob/main/.gitignore"

    classDef hardware fill:#bbdefb,stroke:#1e88e5;
    classDef software fill:#d1c4e9,stroke:#7e57c2;
    classDef data fill:#c8e6c9,stroke:#43a047;
    classDef alerts fill:#ffcdd2,stroke:#e53935;
    classDef future fill:#eeeeee,stroke:#9e9e9e;
```
