# workvaralakshmi-sketch/helmet-app architecture

> Architecture diagram of the GitHub repository workvaralakshmi-sketch/helmet-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/workvaralakshmi-sketch/helmet-app
- Repository: https://github.com/workvaralakshmi-sketch/helmet-app

## Overview

SmartHelmet is a browser-based rider safety dashboard backed by simulated helmet and vehicle sensors. Its core loop initializes the simulation, processes each sampled state for risk, impact, anomalies and fatigue, then updates dashboard visualizations and voice alerts. The app also presents GPS route/geofence information and emergency status. The excerpts establish these runtime links; index.html and unsampled app.js sections may wire additional controls or features, so those relationships are not inferred.

Main entry points: [`app.js`](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/app.js) (Dashboard controller), [`ai.js`](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js) (Safety analytics), [`voice.js`](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/voice.js) (Voice alerts), [`sensors.js`](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/sensors.js) (Sensor simulation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and UI"]
  node_dashboard["Dashboard controller<br/>[app.js]"]
  node_sensors["Sensor simulation<br/>[sensors.js]"]
  node_sensorstate["Sensor state<br/>[sensors.js]"]
end

subgraph group_safety["Safety analysis"]
  node_analysis["Safety analytics<br/>[ai.js]"]
  node_risk["Risk scoring<br/>[ai.js]"]
  node_impact["Impact detection<br/>[ai.js]"]
  node_fatigue["Fatigue detection<br/>[ai.js]"]
  node_events["Safety events<br/>[ai.js]"]
end

subgraph group_presentation["Rider feedback"]
  node_charts["Live charts<br/>[charts.js]"]
  node_map["GPS map and geofence<br/>[map.js]"]
  node_voice["Voice alerts<br/>[voice.js]"]
  node_emergency["Emergency overlay<br/>[app.js]"]
end

node_rider(("Rider"))
node_browser["Browser client"]
node_staticserver["Static file server<br/>[server.js]"]
node_speech["Web Speech API"]
node_tiles["OpenStreetMap tiles"]

node_rider -->|"opens dashboard"| node_browser
node_browser -->|"requests assets"| node_staticserver
node_staticserver -->|"serves files"| node_browser
node_dashboard -->|"initializes"| node_sensors
node_dashboard -->|"initializes"| node_charts
node_dashboard -->|"initializes"| node_voice
node_sensors -->|"updates"| node_sensorstate
node_dashboard -->|"reads"| node_sensorstate
node_dashboard -->|"processes state"| node_analysis
node_analysis -->|"computes"| node_risk
node_analysis -->|"classifies"| node_impact
node_analysis -->|"detects"| node_fatigue
node_analysis -->|"records"| node_events
node_analysis -->|"triggers"| node_emergency
node_dashboard -->|"updates"| node_charts
node_dashboard -.->|"updates GPS"| node_map
node_dashboard -.->|"checks alerts"| node_voice
node_voice -->|"speaks"| node_speech
node_map -->|"loads map tiles"| node_tiles
node_emergency -->|"speaks alert"| node_voice

click node_staticserver "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/server.js"
click node_dashboard "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/app.js"
click node_sensors "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/sensors.js"
click node_sensorstate "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/sensors.js"
click node_analysis "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js"
click node_risk "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js"
click node_impact "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js"
click node_fatigue "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js"
click node_events "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js"
click node_charts "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/charts.js"
click node_map "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/map.js"
click node_voice "https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/voice.js"
click node_emergency "https://github.com/workvaralakshmi-sketch/helmet-app/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_sensors,node_sensorstate,node_browser toneBlue
class node_analysis,node_risk,node_impact,node_fatigue,node_events toneAmber
class node_charts,node_map,node_voice,node_emergency,node_staticserver,node_speech toneMint
class node_rider,node_tiles toneIndigo
```

## Components

### Runtime and UI

- [Dashboard controller](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/app.js): `app.js`
- [Sensor simulation](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/sensors.js): `sensors.js`
- [Sensor state](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/sensors.js): `sensors.js`

### Safety analysis

- [Safety analytics](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js): `ai.js`
- [Risk scoring](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js): `ai.js`
- [Impact detection](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js): `ai.js`
- [Fatigue detection](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js): `ai.js`
- [Safety events](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/ai.js): `ai.js`

### Rider feedback

- [Live charts](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/charts.js): `charts.js`
- [GPS map and geofence](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/map.js): `map.js`
- [Voice alerts](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/voice.js): `voice.js`
- [Emergency overlay](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/app.js): `app.js`

### Other components

- **Rider**
- **Browser client**
- [Static file server](https://github.com/workvaralakshmi-sketch/helmet-app/blob/main/server.js): `server.js`
- **Web Speech API**
- **OpenStreetMap tiles**

## Connections

- Rider → Browser client: opens dashboard
- Browser client → Static file server: requests assets (evidence: `server.js`)
- Static file server → Browser client: serves files (evidence: `server.js`)
- Dashboard controller → Sensor simulation: initializes (evidence: `app.js`)
- Dashboard controller → Live charts: initializes (evidence: `app.js`)
- Dashboard controller → Voice alerts: initializes (evidence: `app.js`)
- Sensor simulation → Sensor state: updates (evidence: `sensors.js`)
- Dashboard controller → Sensor state: reads (evidence: `app.js`)
- Dashboard controller → Safety analytics: processes state (evidence: `app.js`)
- Safety analytics → Risk scoring: computes (evidence: `ai.js`)
- Safety analytics → Impact detection: classifies (evidence: `ai.js`)
- Safety analytics → Fatigue detection: detects (evidence: `ai.js`)
- Safety analytics → Safety events: records (evidence: `ai.js`)
- Safety analytics → Emergency overlay: triggers (evidence: `ai.js`)
- Dashboard controller → Live charts: updates (evidence: `app.js`)
- Dashboard controller → GPS map and geofence: updates GPS
- Dashboard controller → Voice alerts: checks alerts
- Voice alerts → Web Speech API: speaks (evidence: `voice.js`)
- GPS map and geofence → OpenStreetMap tiles: loads map tiles (evidence: `map.js`)
- Emergency overlay → Voice alerts: speaks alert (evidence: `app.js`)
