# ganga07-code/drowse-guard---driver-distraction-detection-system architecture

> Architecture diagram of the GitHub repository ganga07-code/drowse-guard---driver-distraction-detection-system, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ganga07-code/drowse-guard---driver-distraction-detection-system
- Repository: https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system

## Overview

DrowseGuard is a browser-based drowsiness-monitoring prototype. The user starts detection, grants camera access, and the app loads MediaPipe, analyzes webcam frames for eye closure and gaze, updates live metrics and alerts, and can export in-memory session logs as CSV. The graph preserves the documented UI, tracking, alert, and export capabilities. The source excerpt is partial, so links for unsampled internal behavior are omitted; README-described external model loading is shown as documented.

Main entry points: [`app.js`](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js) (Detection engine), [`index.html`](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/index.html) (Dashboard and controls), [`style.css`](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/style.css) (Responsive presentation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Dashboard interface"]
  node_dashboard["Dashboard and controls<br/>[index.html]"]
  node_styling["Responsive presentation<br/>[style.css]"]
end

subgraph group_detection["Detection and analysis"]
  node_engine["Detection engine<br/>[app.js]"]
  node_mediapipe{{"MediaPipe model"}}
  node_camera{{"Webcam"}}
  node_landmarks["Landmark analysis<br/>[app.js]"]
end

subgraph group_session["Session feedback"]
  node_metrics["Session metrics<br/>[app.js]"]
  node_alerts["Alerts and prompts<br/>[app.js]"]
  node_csv["CSV export<br/>[app.js]"]
  node_sessionlogs[("In-memory session logs<br/>[app.js]")]
end

node_user(("User"))

node_user -->|"operates"| node_dashboard
node_dashboard -->|"loads"| node_engine
node_dashboard -->|"loads"| node_styling
node_user -->|"starts detection"| node_engine
node_engine -->|"requests frames"| node_camera
node_engine -->|"loads model"| node_mediapipe
node_engine -.->|"processes frames"| node_landmarks
node_landmarks -.->|"updates"| node_metrics
node_landmarks -.->|"triggers"| node_alerts
node_engine -->|"records samples"| node_sessionlogs
node_engine -.->|"records alerts"| node_sessionlogs
node_user -->|"exports"| node_csv
node_csv -->|"reads"| node_sessionlogs
node_metrics -.->|"displays"| node_dashboard
node_alerts -.->|"displays"| node_dashboard

click node_dashboard "https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/index.html"
click node_styling "https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/style.css"
click node_engine "https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js"
click node_landmarks "https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js"
click node_metrics "https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js"
click node_alerts "https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js"
click node_csv "https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js"
click node_sessionlogs "https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_dashboard,node_styling,node_user toneBlue
class node_engine,node_mediapipe,node_camera,node_landmarks toneAmber
class node_metrics,node_alerts,node_csv,node_sessionlogs toneMint
```

## Components

### Dashboard interface

- [Dashboard and controls](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/index.html): `index.html`
- [Responsive presentation](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/style.css): `style.css`

### Detection and analysis

- [Detection engine](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js): `app.js`
- **MediaPipe model**
- **Webcam**
- [Landmark analysis](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js): `app.js`

### Session feedback

- [Session metrics](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js): `app.js`
- [Alerts and prompts](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js): `app.js`
- [CSV export](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js): `app.js`
- [In-memory session logs](https://github.com/ganga07-code/drowse-guard---driver-distraction-detection-system/blob/main/app.js): `app.js`

### Other components

- **User**

## Connections

- User → Dashboard and controls: operates (evidence: `README.md`)
- Dashboard and controls → Detection engine: loads (evidence: `README.md`)
- Dashboard and controls → Responsive presentation: loads (evidence: `README.md`)
- User → Detection engine: starts detection (evidence: `app.js`)
- Detection engine → Webcam: requests frames (evidence: `app.js`)
- Detection engine → MediaPipe model: loads model (evidence: `README.md`)
- Detection engine → Landmark analysis: processes frames (evidence: `app.js`)
- Landmark analysis → Session metrics: updates (evidence: `app.js`)
- Landmark analysis → Alerts and prompts: triggers (evidence: `app.js`)
- Detection engine → In-memory session logs: records samples (evidence: `app.js`)
- Detection engine → In-memory session logs: records alerts (evidence: `app.js`)
- User → CSV export: exports (evidence: `app.js`)
- CSV export → In-memory session logs: reads (evidence: `app.js`)
- Session metrics → Dashboard and controls: displays
- Alerts and prompts → Dashboard and controls: displays
