# harshalakkaraju/adaptive_resource_management_with_google_drive_support-public- architecture

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

- Interactive diagram: https://gitdiagram.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-
- Repository: https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-

## Overview

Based on our analysis of the file tree and README, the project is a hybrid system for video processing and person detection that integrates two separate components:
- A Java application for analyzing video streams (monitoring the ‘videos’ folder, processing videos, detecting persons, and saving frames with detections).
- A Node.js application that monitors the ‘frames’ folder and automatically syncs/ uploads any frames containing detected persons to a specified Google Drive folder.

##### Main Components
a. Java Video Processing Module:
– Monitors the ‘videos’ folder for new video files.
– Uses classes like AnalyzeVideo.java, DetectPerson.java, and others (e.g., Camera.java, CameraPlacement.java) to process videos and extract frames when persons are detected.
– Leverages external libraries (like OpenCV via opencv-249.jar for computer vision and JFreeChart for visualization, if needed) and Haar cascades (haarcascade_frontalface_alt.xml) for person detection.
b. Node.js Synchronization Module:
– The Node.js application (app.js, along with package.json and package-lock.json) listens for changes in the ‘frames’ folder.
– Triggers an upload process to a specified Google Drive folder using Google Drive API credentials (credentials.json) for authentication.
c. Supporting Infrastructure:
– Local file system components: ‘videos’ folder (input for Java) and ‘frames’ folder (where video frames are saved and then monitored by the Node.js module).
– External integration with Google Drive (via setup instructions, credentials configuration) for file uploads.
– Build and deployment support (run.bat for starting both systems, configuration for classpath, and dependency libraries in the lib folder).

##### Relationships and Interactions
– Finally, indicate an outbound connection from the Node.js module to “Google Drive” (an external system) to represent the upload of detected person frames.
– Include any error handling or time synchronization mechanisms (as noted in the README) as annotations or side components.

##### Architectural Patterns and Design Principles
– Emphasize the separation of concerns: one component is responsible for video processing (Java), and another component handles cloud synchronization (Node.js).
– Note the loose coupling between modules – the two separate applications communicate indirectly through the file system (with the ‘frames’ folder as the integration point).
– Illustrate any monitoring or event-driven design patterns, showing how changes in the frames directory trigger actions in the Node.js module.
– Document usage of external libraries and APIs (e.g., OpenCV, JFreeChart, Google Drive API) as sub-components/annotations within each module.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Supporting Infrastructure
    subgraph "Supporting Infrastructure"
        Videos["Videos Folder"]:::infra
        Frames["Frames Folder"]:::infra
        RunBat["run.bat"]:::infra
    end

    %% Java Video Processing Module
    subgraph "Java Video Processing Module"
        JavaMain["Main.java"]:::java
        Analyze["AnalyzeVideo.java<br/>(Video Analysis)"]:::java
        Detect["DetectPerson.java<br/>(Person Detection)"]:::java
        Camera["Camera.java<br/>(Camera Management)"]:::java
        CameraPl["CameraPlacement.java<br/>(Camera Placement)"]:::java
        SendData["SendData.java<br/>(Data Transmission)"]:::java
        ShowNetwork["ShowNetwork.java<br/>(Network Visualization)"]:::java
        Simulator["Simulator.java<br/>(Simulation)"]:::java
        Lib["Dependency Libraries<br/>(lib)"]:::java
        Haar["Haar Cascade<br/>(haarcascade_frontalface_alt.xml)"]:::java
    end

    %% Node.js Synchronization Module
    subgraph "Node.js Synchronization Module"
        App["app.js<br/>(Uploader)"]:::node
        Package["package.json<br/>(Configuration)"]:::node
        PackageLock["package-lock.json<br/>(Lock File)"]:::node
        Cred["Google Drive Credentials<br/>(cred.json)"]:::node
    end

    %% External Services
    subgraph "External Services"
        GoogleDrive["Google Drive Integration"]:::external
    end

    %% Connections from Infrastructure to Java Module
    Videos -->|"monitored by"| JavaMain
    RunBat ---|"initiates"| JavaMain
    RunBat ---|"initiates"| App

    %% Java Processing Pipeline
    JavaMain -->|"triggers"| Analyze
    Analyze -->|"feeds"| Detect
    Detect -->|"outputs frames to"| Frames

    %% Camera integration within Java Module
    Detect ---|"uses"| Camera
    Camera -->|"configured by"| CameraPl

    %% Additional Java functionalities
    JavaMain -->|"sends info via"| SendData
    SendData -->|"updates"| ShowNetwork
    ShowNetwork -->|"driven by"| Simulator

    %% External Dependencies
    Lib ---|"provides support to"| JavaMain
    Haar ---|"used for detection by"| Detect

    %% Node.js pipeline and integration
    Frames -->|"monitored by"| App
    App -->|"uploads to"| GoogleDrive

    %% Click Events
    click Analyze "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/AnalyzeVideo.java"
    click Detect "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/DetectPerson.java"
    click Camera "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/Camera.java"
    click CameraPl "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/CameraPlacement.java"
    click JavaMain "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/Main.java"
    click SendData "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/SendData.java"
    click ShowNetwork "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/ShowNetwork.java"
    click Simulator "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/Simulator.java"
    click Lib "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/tree/main/lib"
    click Haar "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/haarcascade_frontalface_alt.xml"
    click App "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/app.js"
    click Package "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/package.json"
    click PackageLock "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/package-lock.json"
    click Cred "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/cred.json"
    click Videos "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/tree/main/videos"
    click RunBat "https://github.com/harshalakkaraju/adaptive_resource_management_with_google_drive_support-public-/blob/main/run.bat"

    %% Styles
    classDef java fill:#AED6F1,stroke:#21618C,stroke-width:2px;
    classDef node fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef infra fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef external fill:#D5D8DC,stroke:#566573,stroke-width:2px;
```
