# yash-anpat/predictive-maintenance-platform architecture

> Architecture diagram of the GitHub repository yash-anpat/predictive-maintenance-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yash-anpat/predictive-maintenance-platform
- Repository: https://github.com/yash-anpat/predictive-maintenance-platform

## Overview

The product is a predictive equipment-maintenance platform. Its main workflow registers equipment, ingests telemetry, runs a failure prediction from the latest telemetry, persists the result, and presents prediction history and explanations alongside maintenance records. The graph includes the documented React pages and API capabilities; unsampled modules are represented only where the tree and README establish their role. Arrows are limited to relationships shown by excerpts, SOURCE INDEX references, or README statements.

Main entry points: [`backend/app/api/prediction.py`](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/prediction.py) (Prediction routes), [`backend/app/main.py`](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/main.py) (FastAPI app), [`backend/app/crud/equipment.py`](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/crud/equipment.py) (Equipment records), [`backend/app/api/telemetry.py`](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/telemetry.py) (Telemetry routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["React dashboard"]
  node_pages["Dashboard pages"]
  node_api_client["API client<br/>[client.js]"]
end

subgraph group_api["REST API"]
  node_api_app["FastAPI app<br/>[main.py]"]
  node_equipment_api["Equipment routes<br/>[equipment.py]"]
  node_telemetry_api["Telemetry routes<br/>[telemetry.py]"]
  node_prediction_api["Prediction routes<br/>[prediction.py]"]
  node_maintenance_api["Maintenance routes<br/>[maintenance.py]"]
end

subgraph group_domain["Equipment operations"]
  node_equipment_crud["Equipment records<br/>[equipment.py]"]
  node_telemetry_service["Telemetry operations"]
  node_maintenance_service["Maintenance operations"]
  node_risk_policy["Risk policy<br/>[risk_policy.py]"]
  node_prediction_crud["Prediction records<br/>[prediction.py]"]
  node_maintenance_crud["Maintenance records<br/>[maintenance.py]"]
end

subgraph group_ml["Prediction and explainability"]
  node_feature_engineering["Feature contract"]
  node_model_loader["Model loader<br/>[model_loader.py]"]
  node_predict["Failure inference<br/>[predict.py]"]
  node_explainability["SHAP explanations<br/>[explainability.py]"]
end

subgraph group_persistence["Persistence"]
  node_database[("PostgreSQL<br/>[database.py]")]
  node_equipment_model["Equipment model<br/>[equipment.py]"]
  node_telemetry_crud["Telemetry records<br/>[telemetry.py]"]
  node_telemetry_model["Telemetry model<br/>[telemetry.py]"]
  node_prediction_model["Prediction model<br/>[prediction.py]"]
  node_maintenance_model["Maintenance model<br/>[maintenance.py]"]
end

node_operator(("Platform user"))
node_simulator["Telemetry simulator"]

node_operator -->|"uses"| node_pages
node_pages -->|"requests data"| node_api_client
node_api_client -->|"calls REST"| node_api_app
node_api_app -->|"registers routes"| node_equipment_api
node_api_app -->|"registers routes"| node_telemetry_api
node_api_app -->|"registers routes"| node_prediction_api
node_api_app -->|"registers routes"| node_maintenance_api
node_equipment_api -->|"calls"| node_equipment_crud
node_telemetry_api -->|"calls"| node_telemetry_crud
node_telemetry_api -->|"delegates"| node_telemetry_service
node_prediction_api -->|"validates equipment"| node_equipment_crud
node_prediction_api -->|"loads telemetry"| node_telemetry_crud
node_prediction_api -->|"runs inference"| node_predict
node_prediction_api -->|"saves predictions"| node_prediction_crud
node_prediction_api -->|"requests explanations"| node_explainability
node_maintenance_api -->|"calls"| node_maintenance_crud
node_predict -->|"transforms telemetry"| node_feature_engineering
node_predict -->|"uses model"| node_model_loader
node_explainability -->|"builds features"| node_feature_engineering
node_explainability -->|"uses model"| node_model_loader
node_telemetry_service -->|"reads and writes"| node_telemetry_crud
node_telemetry_service -->|"checks equipment"| node_equipment_crud
node_maintenance_service -->|"uses records"| node_maintenance_crud
node_maintenance_service -->|"checks equipment"| node_equipment_crud
node_equipment_crud -->|"queries"| node_equipment_model
node_telemetry_crud -->|"queries"| node_telemetry_model
node_prediction_crud -->|"queries"| node_prediction_model
node_maintenance_crud -->|"queries"| node_maintenance_model
node_equipment_model -.->|"persists in"| node_database
node_telemetry_model -.->|"persists in"| node_database
node_prediction_model -.->|"persists in"| node_database
node_maintenance_model -.->|"persists in"| node_database
node_simulator -.->|"submits telemetry"| node_telemetry_api

click node_pages "https://github.com/yash-anpat/predictive-maintenance-platform/tree/main/frontend/src/pages"
click node_api_client "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/frontend/src/api/client.js"
click node_api_app "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/main.py"
click node_equipment_api "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/equipment.py"
click node_telemetry_api "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/telemetry.py"
click node_prediction_api "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/prediction.py"
click node_maintenance_api "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/maintenance.py"
click node_equipment_crud "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/crud/equipment.py"
click node_telemetry_service "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/services/telemetry_service.py"
click node_maintenance_service "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/services/maintenance_service.py"
click node_risk_policy "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/services/risk_policy.py"
click node_prediction_crud "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/crud/prediction.py"
click node_maintenance_crud "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/crud/maintenance.py"
click node_feature_engineering "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/ml/feature_engineering.py"
click node_model_loader "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/ml/model_loader.py"
click node_predict "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/ml/predict.py"
click node_explainability "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/ml/explainability.py"
click node_database "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/database/database.py"
click node_equipment_model "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/models/equipment.py"
click node_telemetry_crud "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/crud/telemetry.py"
click node_telemetry_model "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/models/telemetry.py"
click node_prediction_model "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/models/prediction.py"
click node_maintenance_model "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/models/maintenance.py"
click node_simulator "https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/tools/telemetry_simulator.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_pages,node_api_client,node_operator toneBlue
class node_api_app,node_equipment_api,node_telemetry_api,node_prediction_api,node_maintenance_api toneAmber
class node_equipment_crud,node_telemetry_service,node_maintenance_service,node_risk_policy,node_prediction_crud,node_maintenance_crud toneMint
class node_feature_engineering,node_model_loader,node_predict,node_explainability toneRose
class node_database,node_equipment_model,node_telemetry_crud,node_telemetry_model,node_prediction_model,node_maintenance_model toneIndigo
class node_simulator toneTeal
```

## Components

### React dashboard

- [Dashboard pages](https://github.com/yash-anpat/predictive-maintenance-platform/tree/main/frontend/src/pages): `frontend/src/pages`
- [API client](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/frontend/src/api/client.js): `frontend/src/api/client.js`

### REST API

- [FastAPI app](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/main.py): `backend/app/main.py`
- [Equipment routes](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/equipment.py): `backend/app/api/equipment.py`
- [Telemetry routes](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/telemetry.py): `backend/app/api/telemetry.py`
- [Prediction routes](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/prediction.py): `backend/app/api/prediction.py`
- [Maintenance routes](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/api/maintenance.py): `backend/app/api/maintenance.py`

### Equipment operations

- [Equipment records](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/crud/equipment.py): `backend/app/crud/equipment.py`
- [Telemetry operations](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/services/telemetry_service.py): `backend/app/services/telemetry_service.py`
- [Maintenance operations](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/services/maintenance_service.py): `backend/app/services/maintenance_service.py`
- [Risk policy](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/services/risk_policy.py): `backend/app/services/risk_policy.py`
- [Prediction records](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/crud/prediction.py): `backend/app/crud/prediction.py`
- [Maintenance records](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/crud/maintenance.py): `backend/app/crud/maintenance.py`

### Prediction and explainability

- [Feature contract](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/ml/feature_engineering.py): `backend/app/ml/feature_engineering.py`
- [Model loader](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/ml/model_loader.py): `backend/app/ml/model_loader.py`
- [Failure inference](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/ml/predict.py): `backend/app/ml/predict.py`
- [SHAP explanations](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/ml/explainability.py): `backend/app/ml/explainability.py`

### Persistence

- [PostgreSQL](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/database/database.py): `backend/app/database/database.py`
- [Equipment model](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/models/equipment.py): `backend/app/models/equipment.py`
- [Telemetry records](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/crud/telemetry.py): `backend/app/crud/telemetry.py`
- [Telemetry model](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/models/telemetry.py): `backend/app/models/telemetry.py`
- [Prediction model](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/models/prediction.py): `backend/app/models/prediction.py`
- [Maintenance model](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/backend/app/models/maintenance.py): `backend/app/models/maintenance.py`

### Other components

- **Platform user**
- [Telemetry simulator](https://github.com/yash-anpat/predictive-maintenance-platform/blob/main/tools/telemetry_simulator.py): `tools/telemetry_simulator.py`

## Connections

- Platform user → Dashboard pages: uses
- Dashboard pages → API client: requests data (evidence: `frontend/src/pages/Predictions.jsx`)
- API client → FastAPI app: calls REST
- FastAPI app → Equipment routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Telemetry routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Prediction routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI app → Maintenance routes: registers routes (evidence: `backend/app/main.py`)
- Equipment routes → Equipment records: calls (evidence: `backend/app/api/equipment.py`)
- Telemetry routes → Telemetry records: calls (evidence: `backend/app/api/telemetry.py`)
- Telemetry routes → Telemetry operations: delegates (evidence: `backend/app/api/telemetry.py`)
- Prediction routes → Equipment records: validates equipment (evidence: `backend/app/api/prediction.py`)
- Prediction routes → Telemetry records: loads telemetry (evidence: `backend/app/api/prediction.py`)
- Prediction routes → Failure inference: runs inference (evidence: `backend/app/api/prediction.py`)
- Prediction routes → Prediction records: saves predictions (evidence: `backend/app/api/prediction.py`)
- Prediction routes → SHAP explanations: requests explanations (evidence: `backend/app/api/prediction.py`)
- Maintenance routes → Maintenance records: calls (evidence: `backend/app/api/maintenance.py`)
- Failure inference → Feature contract: transforms telemetry (evidence: `backend/app/ml/predict.py`)
- Failure inference → Model loader: uses model (evidence: `backend/app/ml/predict.py`)
- SHAP explanations → Feature contract: builds features (evidence: `backend/app/ml/explainability.py`)
- SHAP explanations → Model loader: uses model (evidence: `backend/app/ml/explainability.py`)
- Telemetry operations → Telemetry records: reads and writes (evidence: `backend/app/services/telemetry_service.py`)
- Telemetry operations → Equipment records: checks equipment (evidence: `backend/app/services/telemetry_service.py`)
- Maintenance operations → Maintenance records: uses records (evidence: `backend/app/services/maintenance_service.py`)
- Maintenance operations → Equipment records: checks equipment (evidence: `backend/app/services/maintenance_service.py`)
- Equipment records → Equipment model: queries (evidence: `backend/app/crud/equipment.py`)
- Telemetry records → Telemetry model: queries (evidence: `backend/app/crud/telemetry.py`)
- Prediction records → Prediction model: queries (evidence: `backend/app/crud/prediction.py`)
- Maintenance records → Maintenance model: queries (evidence: `backend/app/crud/maintenance.py`)
- Equipment model → PostgreSQL: persists in
- Telemetry model → PostgreSQL: persists in
- Prediction model → PostgreSQL: persists in
- Maintenance model → PostgreSQL: persists in
- Telemetry simulator → Telemetry routes: submits telemetry
