# stepanchikk/velox-car-product architecture

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

- Interactive diagram: https://gitdiagram.com/stepanchikk/velox-car-product
- Repository: https://github.com/stepanchikk/velox-car-product

## Overview

Velox is an iOS driving-telemetry and safety-scoring app, accompanied by a Python analyzer for its trip CSVs. The main workflow is to calibrate phone orientation, record motion and location, detect maneuvers and distraction, score and save a trip, then inspect history or analyze exported CSVs into summaries, plots, and HTML reports. The graph includes documented capabilities and source-index-supported dependencies; unsampled implementation details and uncertain call paths are omitted.

Main entry points: [`Velox-car product/SensorManager.swift`](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager.swift) (Recording manager), [`Analytics/velox_analytics/cli.py`](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/cli.py) (Analytics CLI), [`Analytics/velox_analytics/loader.py`](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/loader.py) (Trip loader), [`Analytics/velox_analytics/summary.py`](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/summary.py) (Trip summaries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_capture["Trip capture"]
  node_manager["Recording manager"]
  node_calibration["Orientation calibration"]
  node_motion["Motion processing"]
  node_location["GPS tracking"]
  node_session["Session lifecycle"]
  node_detectors["Distraction detection"]
  node_antifraud["Anti-fraud signals"]
  node_scoring["Safety scoring<br/>[Safetyscore.swift]"]
  node_csv["Trip CSV writer"]
end

subgraph group_experience["Driver experience"]
  node_history["Trip history<br/>[TripHistory.swift]"]
  node_tracker["Live tracker UI<br/>[TrackerView.swift]"]
  node_home["Home and ratings<br/>[Homeview.swift]"]
  node_live["Live Activity"]
  node_attributes["Activity state"]
  node_account["Account and achievements<br/>[Achievements.swift]"]
end

subgraph group_analysis["CSV analytics"]
  node_cli["Analytics CLI<br/>[cli.py]"]
  node_config["Shared parameters<br/>[config.py]"]
  node_loader["Trip loader<br/>[loader.py]"]
  node_trip["Trip model<br/>[trip.py]"]
  node_events["Event analysis<br/>[events.py]"]
  node_filtering["Signal filtering<br/>[filtering.py]"]
  node_summary["Trip summaries<br/>[summary.py]"]
  node_scorecalc["Score calculations<br/>[scoring.py]"]
  node_tripplots["Trip plots<br/>[trip_plots.py]"]
  node_overview["Fleet overview plots<br/>[overview.py]"]
  node_report["HTML reports<br/>[report.py]"]
end

node_driver(("Driver"))
node_csvfiles["Trip CSV files"]

node_driver -->|"starts recording"| node_manager
node_manager -->|"calibrates orientation"| node_calibration
node_manager -.->|"processes motion"| node_motion
node_manager -.->|"tracks location"| node_location
node_manager -.->|"manages session"| node_session
node_manager -->|"delegates detection"| node_detectors
node_manager -->|"uses signals"| node_antifraud
node_manager -->|"computes score"| node_scoring
node_manager -->|"writes trip data"| node_csv
node_manager -.->|"publishes state"| node_tracker
node_manager -->|"updates activity"| node_live
node_live -->|"renders state"| node_attributes
node_csv -->|"saves CSV"| node_csvfiles
node_driver -->|"views and exports"| node_history
node_history -->|"exports trips"| node_csvfiles
node_driver -->|"runs analysis"| node_cli
node_cli -->|"loads parameters"| node_config
node_cli -->|"loads CSVs"| node_loader
node_loader -->|"reads CSVs"| node_csvfiles
node_loader -->|"parses events"| node_events
node_loader -->|"uses filters"| node_filtering
node_loader -->|"builds trip"| node_trip
node_cli -->|"generates plots"| node_tripplots
node_cli -->|"generates overview"| node_overview
node_cli -->|"generates reports"| node_report
node_cli -->|"builds summary"| node_summary
node_summary -->|"counts events"| node_events
node_summary -->|"counts maneuvers"| node_filtering
node_summary -->|"recalculates scores"| node_scorecalc
node_tripplots -->|"plots score"| node_scorecalc
node_tripplots -->|"plots events"| node_events
node_overview -->|"counts sensitivity"| node_summary
node_account -->|"uses rating parameters"| node_config
node_home -.->|"shows driver rating"| node_account

click node_manager "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager.swift"
click node_calibration "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/OrientationCalibrator.swift"
click node_motion "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager%2BMotion.swift"
click node_location "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager%2BLocation.swift"
click node_session "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager%2BSession.swift"
click node_detectors "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/EventDetectors.swift"
click node_antifraud "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager%2BAntiFraud.swift"
click node_scoring "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/Safetyscore.swift"
click node_csv "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/TripCSVWriter.swift"
click node_history "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/TripHistory.swift"
click node_tracker "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/TrackerView.swift"
click node_home "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/Homeview.swift"
click node_live "https://github.com/stepanchikk/velox-car-product/blob/main/VeloxWidgets/VeloxTripLiveActivity.swift"
click node_attributes "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/VeloxTripAttributes.swift"
click node_cli "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/cli.py"
click node_config "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/config.py"
click node_loader "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/loader.py"
click node_trip "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/trip.py"
click node_events "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/events.py"
click node_filtering "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/filtering.py"
click node_summary "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/summary.py"
click node_scorecalc "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/scoring.py"
click node_tripplots "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/plots/trip_plots.py"
click node_overview "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/plots/overview.py"
click node_report "https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/report.py"
click node_account "https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/Achievements.swift"

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_manager,node_calibration,node_motion,node_location,node_session,node_detectors,node_antifraud,node_scoring,node_csv toneBlue
class node_history,node_tracker,node_home,node_live,node_attributes,node_account toneAmber
class node_cli,node_config,node_loader,node_trip,node_events,node_filtering,node_summary,node_scorecalc,node_tripplots,node_overview,node_report toneMint
class node_driver,node_csvfiles toneIndigo
```

## Components

### Trip capture

- [Recording manager](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager.swift): `Velox-car product/SensorManager.swift`
- [Orientation calibration](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/OrientationCalibrator.swift): `Velox-car product/OrientationCalibrator.swift`
- [Motion processing](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager%2BMotion.swift): `Velox-car product/SensorManager+Motion.swift`
- [GPS tracking](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager%2BLocation.swift): `Velox-car product/SensorManager+Location.swift`
- [Session lifecycle](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager%2BSession.swift): `Velox-car product/SensorManager+Session.swift`
- [Distraction detection](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/EventDetectors.swift): `Velox-car product/EventDetectors.swift`
- [Anti-fraud signals](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/SensorManager%2BAntiFraud.swift): `Velox-car product/SensorManager+AntiFraud.swift`
- [Safety scoring](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/Safetyscore.swift): `Velox-car product/Safetyscore.swift`
- [Trip CSV writer](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/TripCSVWriter.swift): `Velox-car product/TripCSVWriter.swift`

### Driver experience

- [Trip history](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/TripHistory.swift): `Velox-car product/TripHistory.swift`
- [Live tracker UI](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/TrackerView.swift): `Velox-car product/TrackerView.swift`
- [Home and ratings](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/Homeview.swift): `Velox-car product/Homeview.swift`
- [Live Activity](https://github.com/stepanchikk/velox-car-product/blob/main/VeloxWidgets/VeloxTripLiveActivity.swift): `VeloxWidgets/VeloxTripLiveActivity.swift`
- [Activity state](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/VeloxTripAttributes.swift): `Velox-car product/VeloxTripAttributes.swift`
- [Account and achievements](https://github.com/stepanchikk/velox-car-product/blob/main/Velox-car%20product/Achievements.swift): `Velox-car product/Achievements.swift`

### CSV analytics

- [Analytics CLI](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/cli.py): `Analytics/velox_analytics/cli.py`
- [Shared parameters](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/config.py): `Analytics/velox_analytics/config.py`
- [Trip loader](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/loader.py): `Analytics/velox_analytics/loader.py`
- [Trip model](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/trip.py): `Analytics/velox_analytics/trip.py`
- [Event analysis](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/events.py): `Analytics/velox_analytics/events.py`
- [Signal filtering](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/filtering.py): `Analytics/velox_analytics/filtering.py`
- [Trip summaries](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/summary.py): `Analytics/velox_analytics/summary.py`
- [Score calculations](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/scoring.py): `Analytics/velox_analytics/scoring.py`
- [Trip plots](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/plots/trip_plots.py): `Analytics/velox_analytics/plots/trip_plots.py`
- [Fleet overview plots](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/plots/overview.py): `Analytics/velox_analytics/plots/overview.py`
- [HTML reports](https://github.com/stepanchikk/velox-car-product/blob/main/Analytics/velox_analytics/report.py): `Analytics/velox_analytics/report.py`

### Other components

- **Driver**
- **Trip CSV files**

## Connections

- Driver → Recording manager: starts recording
- Recording manager → Orientation calibration: calibrates orientation (evidence: `Velox-car product/SensorManager.swift`)
- Recording manager → Motion processing: processes motion (evidence: `Velox-car product/SensorManager+Motion.swift`)
- Recording manager → GPS tracking: tracks location (evidence: `Velox-car product/SensorManager+Location.swift`)
- Recording manager → Session lifecycle: manages session (evidence: `Velox-car product/SensorManager+Session.swift`)
- Recording manager → Distraction detection: delegates detection (evidence: `Velox-car product/SensorManager.swift`)
- Recording manager → Anti-fraud signals: uses signals (evidence: `Velox-car product/SensorManager+AntiFraud.swift`)
- Recording manager → Safety scoring: computes score
- Recording manager → Trip CSV writer: writes trip data (evidence: `Velox-car product/SensorManager.swift`)
- Recording manager → Live tracker UI: publishes state (evidence: `Velox-car product/TrackerView.swift`)
- Recording manager → Live Activity: updates activity (evidence: `Velox-car product/SensorManager.swift`)
- Live Activity → Activity state: renders state (evidence: `VeloxWidgets/VeloxTripLiveActivity.swift`)
- Trip CSV writer → Trip CSV files: saves CSV
- Driver → Trip history: views and exports
- Trip history → Trip CSV files: exports trips
- Driver → Analytics CLI: runs analysis
- Analytics CLI → Shared parameters: loads parameters (evidence: `Analytics/velox_analytics/cli.py`)
- Analytics CLI → Trip loader: loads CSVs (evidence: `Analytics/velox_analytics/cli.py`)
- Trip loader → Trip CSV files: reads CSVs
- Trip loader → Event analysis: parses events (evidence: `Analytics/velox_analytics/loader.py`)
- Trip loader → Signal filtering: uses filters (evidence: `Analytics/velox_analytics/loader.py`)
- Trip loader → Trip model: builds trip (evidence: `Analytics/velox_analytics/loader.py`)
- Analytics CLI → Trip plots: generates plots (evidence: `Analytics/velox_analytics/cli.py`)
- Analytics CLI → Fleet overview plots: generates overview (evidence: `Analytics/velox_analytics/cli.py`)
- Analytics CLI → HTML reports: generates reports (evidence: `Analytics/velox_analytics/cli.py`)
- Analytics CLI → Trip summaries: builds summary (evidence: `Analytics/velox_analytics/cli.py`)
- Trip summaries → Event analysis: counts events (evidence: `Analytics/velox_analytics/summary.py`)
- Trip summaries → Signal filtering: counts maneuvers (evidence: `Analytics/velox_analytics/summary.py`)
- Trip summaries → Score calculations: recalculates scores (evidence: `Analytics/velox_analytics/summary.py`)
- Trip plots → Score calculations: plots score (evidence: `Analytics/velox_analytics/plots/trip_plots.py`)
- Trip plots → Event analysis: plots events (evidence: `Analytics/velox_analytics/plots/trip_plots.py`)
- Fleet overview plots → Trip summaries: counts sensitivity (evidence: `Analytics/velox_analytics/plots/overview.py`)
- Account and achievements → Shared parameters: uses rating parameters (evidence: `Velox-car product/Achievements.swift`)
- Home and ratings → Account and achievements: shows driver rating
