# shaanvirs/camp-qmind-qnx architecture

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

- Interactive diagram: https://gitdiagram.com/shaanvirs/camp-qmind-qnx
- Repository: https://github.com/shaanvirs/camp-qmind-qnx

## Overview

This MVP demonstrates predictive motor maintenance: an operator chooses a simulated fault, onset, and severity; the app runs vibration windows through feature extraction and fault detection, shuts the motor off after consecutive anomalous windows, then presents the recorded run and response time. A separate data-generation and training path builds the two-stage anomaly detector and fault classifier used by the runtime. The graph follows documented pipeline links and shown imports; dashboard embedding details and unsampled app wiring are not inferred beyond the README and excerpts.

Main entry points: [`main.py`](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/main.py) (Window pipeline), [`app.py`](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/app.py) (Experiment dashboard), [`train_model.py`](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/train_model.py) (Model training and evaluation), [`stream.py`](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/stream.py) (Motor signal generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Experiment interface"]
  node_dashboard["Experiment dashboard<br/>[app.py]"]
  node_playback["Run playback<br/>[dashboard.html]"]
end

subgraph group_signals["Signal simulation"]
  node_generator["Motor signal generator<br/>[stream.py]"]
end

subgraph group_runtime["Detection and shutdown"]
  node_features["Vibration features<br/>[features.py]"]
  node_pipeline["Window pipeline<br/>[main.py]"]
  node_detector["Fault detector and classifier<br/>[model.py]"]
end

subgraph group_training["Model training"]
  node_dataset["Training data generation<br/>[make_data.py]"]
  node_trainer["Model training and evaluation<br/>[train_model.py]"]
end

node_operator(("Operator"))

node_operator -->|"configures run"| node_dashboard
node_dashboard -->|"runs experiment"| node_pipeline
node_pipeline -->|"reads windows"| node_generator
node_pipeline -->|"extracts features"| node_features
node_pipeline -->|"requests prediction"| node_detector
node_dashboard -->|"plays recorded run"| node_playback
node_dataset -->|"collects windows"| node_generator
node_trainer -->|"extracts training features"| node_features
node_trainer -->|"writes model bundle"| node_detector

click node_dashboard "https://github.com/shaanvirs/camp-qmind-qnx/blob/main/app.py"
click node_playback "https://github.com/shaanvirs/camp-qmind-qnx/blob/main/ui/dashboard.html"
click node_generator "https://github.com/shaanvirs/camp-qmind-qnx/blob/main/stream.py"
click node_features "https://github.com/shaanvirs/camp-qmind-qnx/blob/main/features.py"
click node_pipeline "https://github.com/shaanvirs/camp-qmind-qnx/blob/main/main.py"
click node_detector "https://github.com/shaanvirs/camp-qmind-qnx/blob/main/model.py"
click node_dataset "https://github.com/shaanvirs/camp-qmind-qnx/blob/main/make_data.py"
click node_trainer "https://github.com/shaanvirs/camp-qmind-qnx/blob/main/train_model.py"

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_playback toneBlue
class node_generator toneAmber
class node_features,node_pipeline,node_detector toneMint
class node_dataset,node_trainer toneRose
class node_operator toneIndigo
```

## Components

### Experiment interface

- [Experiment dashboard](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/app.py): `app.py`
- [Run playback](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/ui/dashboard.html): `ui/dashboard.html`

### Signal simulation

- [Motor signal generator](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/stream.py): `stream.py`

### Detection and shutdown

- [Vibration features](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/features.py): `features.py`
- [Window pipeline](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/main.py): `main.py`
- [Fault detector and classifier](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/model.py): `model.py`

### Model training

- [Training data generation](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/make_data.py): `make_data.py`
- [Model training and evaluation](https://github.com/shaanvirs/camp-qmind-qnx/blob/main/train_model.py): `train_model.py`

### Other components

- **Operator**

## Connections

- Operator → Experiment dashboard: configures run (evidence: `app.py`)
- Experiment dashboard → Window pipeline: runs experiment (evidence: `README.md`)
- Window pipeline → Motor signal generator: reads windows (evidence: `main.py`)
- Window pipeline → Vibration features: extracts features (evidence: `main.py`)
- Window pipeline → Fault detector and classifier: requests prediction (evidence: `main.py`)
- Experiment dashboard → Run playback: plays recorded run (evidence: `app.py`)
- Training data generation → Motor signal generator: collects windows (evidence: `make_data.py`)
- Model training and evaluation → Vibration features: extracts training features (evidence: `train_model.py`)
- Model training and evaluation → Fault detector and classifier: writes model bundle (evidence: `train_model.py`)
