# adityacrypto-del/havells architecture

> Architecture diagram of the GitHub repository adityacrypto-del/havells, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adityacrypto-del/havells
- Repository: https://github.com/adityacrypto-del/havells

## Overview

This is a protection-preserving industrial motor condition-monitoring reference implementation. Its main workflow takes motor signal windows through deterministic quality checks and feature extraction, diagnoses faults, estimates life or maintenance priority, applies a deterministic safety gate, then records a decision contract. The README also describes work-order drafting and fleet comparison. The sampled source confirms the copilot function and fleet index, but not their wiring into the orchestrator or a CMMS; those links are therefore omitted. The demo is the documented entry point.

Main entry points: [`orchestrator.py`](https://github.com/adityacrypto-del/havells/blob/main/orchestrator.py) (Cycle orchestrator), [`main.py`](https://github.com/adityacrypto-del/havells/blob/main/main.py) (Demo entry point), [`llm_copilot.py`](https://github.com/adityacrypto-del/havells/blob/main/llm_copilot.py) (Local LLM copilot), [`data_quality.py`](https://github.com/adityacrypto-del/havells/blob/main/data_quality.py) (Signal quality gate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Signal preparation"]
  node_demo["Demo entry point<br/>[main.py]"]
  node_quality["Signal quality gate<br/>[data_quality.py]"]
  node_features["Feature extraction"]
end

subgraph group_analysis["Condition analysis"]
  node_fault["Fault classifiers"]
  node_anomaly["Anomaly detection"]
  node_rul["Life and priority<br/>[rul_model.py]"]
  node_fleet["Fleet similarity and drift"]
end

subgraph group_decision["Safety and decisions"]
  node_orchestrator["Cycle orchestrator<br/>[orchestrator.py]"]
  node_safety["Deterministic safety gate<br/>[safety_policy.py]"]
  node_contract["Decision contract<br/>[orchestrator.py]"]
  node_audit[("Audit log<br/>[orchestrator.py]")]
end

subgraph group_operations["Operations support"]
  node_copilot["Local LLM copilot<br/>[llm_copilot.py]"]
end

node_sensors(("Motor signals"))
node_llama["llama.cpp service"]
node_cmms["CMMS / work orders"]

node_sensors -->|"supplies signals"| node_demo
node_demo -->|"runs cycle"| node_orchestrator
node_orchestrator -->|"checks windows"| node_quality
node_orchestrator -->|"extracts features"| node_features
node_orchestrator -->|"classifies faults"| node_fault
node_orchestrator -->|"checks scores"| node_anomaly
node_orchestrator -->|"estimates priority"| node_rul
node_orchestrator -->|"evaluates gates"| node_safety
node_orchestrator -->|"assembles result"| node_contract
node_orchestrator -->|"appends record"| node_audit
node_copilot -.->|"requests explanation"| node_llama

click node_demo "https://github.com/adityacrypto-del/havells/blob/main/main.py"
click node_orchestrator "https://github.com/adityacrypto-del/havells/blob/main/orchestrator.py"
click node_quality "https://github.com/adityacrypto-del/havells/blob/main/data_quality.py"
click node_features "https://github.com/adityacrypto-del/havells/blob/main/feature_engineering.py"
click node_fault "https://github.com/adityacrypto-del/havells/blob/main/models/fault_classifier.py"
click node_anomaly "https://github.com/adityacrypto-del/havells/blob/main/models/anomaly_detector.py"
click node_rul "https://github.com/adityacrypto-del/havells/blob/main/models/rul_model.py"
click node_safety "https://github.com/adityacrypto-del/havells/blob/main/safety_policy.py"
click node_contract "https://github.com/adityacrypto-del/havells/blob/main/orchestrator.py"
click node_audit "https://github.com/adityacrypto-del/havells/blob/main/orchestrator.py"
click node_fleet "https://github.com/adityacrypto-del/havells/blob/main/models/fleet_similarity.py"
click node_copilot "https://github.com/adityacrypto-del/havells/blob/main/llm_copilot.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_demo,node_quality,node_features toneBlue
class node_fault,node_anomaly,node_rul,node_fleet toneAmber
class node_orchestrator,node_safety,node_contract,node_audit toneMint
class node_copilot toneRose
class node_sensors,node_llama,node_cmms toneIndigo
```

## Components

### Signal preparation

- [Demo entry point](https://github.com/adityacrypto-del/havells/blob/main/main.py): `main.py`
- [Signal quality gate](https://github.com/adityacrypto-del/havells/blob/main/data_quality.py): `data_quality.py`
- [Feature extraction](https://github.com/adityacrypto-del/havells/blob/main/feature_engineering.py): `feature_engineering.py`

### Condition analysis

- [Fault classifiers](https://github.com/adityacrypto-del/havells/blob/main/models/fault_classifier.py): `models/fault_classifier.py`
- [Anomaly detection](https://github.com/adityacrypto-del/havells/blob/main/models/anomaly_detector.py): `models/anomaly_detector.py`
- [Life and priority](https://github.com/adityacrypto-del/havells/blob/main/models/rul_model.py): `models/rul_model.py`
- [Fleet similarity and drift](https://github.com/adityacrypto-del/havells/blob/main/models/fleet_similarity.py): `models/fleet_similarity.py`

### Safety and decisions

- [Cycle orchestrator](https://github.com/adityacrypto-del/havells/blob/main/orchestrator.py): `orchestrator.py`
- [Deterministic safety gate](https://github.com/adityacrypto-del/havells/blob/main/safety_policy.py): `safety_policy.py`
- [Decision contract](https://github.com/adityacrypto-del/havells/blob/main/orchestrator.py): `orchestrator.py`
- [Audit log](https://github.com/adityacrypto-del/havells/blob/main/orchestrator.py): `orchestrator.py`

### Operations support

- [Local LLM copilot](https://github.com/adityacrypto-del/havells/blob/main/llm_copilot.py): `llm_copilot.py`

### Other components

- **Motor signals**
- **llama.cpp service**
- **CMMS / work orders**

## Connections

- Motor signals → Demo entry point: supplies signals
- Demo entry point → Cycle orchestrator: runs cycle
- Cycle orchestrator → Signal quality gate: checks windows
- Cycle orchestrator → Feature extraction: extracts features
- Cycle orchestrator → Fault classifiers: classifies faults
- Cycle orchestrator → Anomaly detection: checks scores
- Cycle orchestrator → Life and priority: estimates priority
- Cycle orchestrator → Deterministic safety gate: evaluates gates
- Cycle orchestrator → Decision contract: assembles result
- Cycle orchestrator → Audit log: appends record
- Local LLM copilot → llama.cpp service: requests explanation
