# yugamdeepgoyal/predictive_maintenance architecture

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

- Interactive diagram: https://gitdiagram.com/yugamdeepgoyal/predictive_maintenance
- Repository: https://github.com/yugamdeepgoyal/predictive_maintenance

## Overview

This educational Streamlit product estimates jet-engine remaining useful life from NASA C-MAPSS FD001 data. The main workflow loads engine histories, accepts uploaded, manually entered, or example readings, prepares per-engine features, runs a selected XGBoost or LSTM model, and presents estimates and status; multi-engine results can be downloaded. The analyst dashboard adds replay, fault injection, fleet scoring, and an OOP view, while a separate in-app manual explains usage. The app is a monolith, so several interface responsibilities share app.py. Dashboard details beyond the sampled excerpts are represented from the README.

Main entry points: [`app.py`](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py) (App entry point), [`src/base.py`](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/base.py) (Model and prep contracts), [`src/models.py`](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/models.py) (XGBoost model), [`src/handle_data.py`](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/handle_data.py) (C-MAPSS loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Streamlit interface"]
  node_app["App entry point<br/>[app.py]"]
  node_input_modes["Prediction inputs<br/>[app.py]"]
  node_prediction_results["Prediction results<br/>[app.py]"]
  node_analyst_dashboard["Analyst dashboard<br/>[app.py]"]
  node_user_manual["In-app manual<br/>[app.py]"]
end

subgraph group_data["Data preparation"]
  node_dataset[("FD001 data")]
  node_data_loader["C-MAPSS loader<br/>[handle_data.py]"]
  node_input_parser["Input parsing<br/>[app.py]"]
  node_tabular_prep["Tabular features<br/>[models.py]"]
  node_sequence_prep["Sequence features<br/>[models.py]"]
end

subgraph group_prediction["RUL prediction"]
  node_model_contracts["Model and prep contracts<br/>[base.py]"]
  node_xgb_model["XGBoost model<br/>[models.py]"]
  node_lstm_model["LSTM model<br/>[models.py]"]
  node_xgb_artifact["Saved XGBoost<br/>[xgb_model.json]"]
  node_lstm_artifact["Saved LSTM<br/>[lstm_model.keras]"]
  node_regression_metrics["Regression metrics<br/>[base.py]"]
end

subgraph group_analysis["Analysis and guidance"]
  node_replay["Live replay<br/>[app.py]"]
  node_fault_injection["Fault injection<br/>[app.py]"]
  node_fleet_view["Fleet view<br/>[app.py]"]
  node_oop_view["OOP view<br/>[app.py]"]
end

node_operator(("Engine analyst"))

node_operator -->|"uses"| node_app
node_app -->|"loads data"| node_data_loader
node_data_loader -->|"reads files"| node_dataset
node_operator -->|"provides readings"| node_input_modes
node_input_modes -->|"parses input"| node_input_parser
node_input_parser -.->|"prepares inputs"| node_tabular_prep
node_app -->|"prepares data"| node_tabular_prep
node_app -->|"prepares data"| node_sequence_prep
node_app -->|"loads or trains"| node_xgb_model
node_app -->|"loads model"| node_lstm_model
node_tabular_prep -->|"implements contract"| node_model_contracts
node_sequence_prep -->|"implements contract"| node_model_contracts
node_xgb_model -->|"implements contract"| node_model_contracts
node_lstm_model -->|"implements contract"| node_model_contracts
node_app -->|"loads or saves"| node_xgb_artifact
node_app -->|"loads"| node_lstm_artifact
node_app -->|"shows estimates"| node_prediction_results
node_operator -->|"opens"| node_analyst_dashboard
node_analyst_dashboard -->|"offers replay"| node_replay
node_analyst_dashboard -->|"offers injection"| node_fault_injection
node_analyst_dashboard -->|"offers fleet view"| node_fleet_view
node_analyst_dashboard -->|"offers OOP view"| node_oop_view
node_operator -->|"opens"| node_user_manual
node_xgb_model -.->|"evaluates with"| node_regression_metrics
node_lstm_model -.->|"evaluates with"| node_regression_metrics

click node_app "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py"
click node_input_modes "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py"
click node_prediction_results "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py"
click node_analyst_dashboard "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py"
click node_user_manual "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py"
click node_dataset "https://github.com/yugamdeepgoyal/predictive_maintenance/tree/main/CMaps"
click node_data_loader "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/handle_data.py"
click node_input_parser "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py"
click node_tabular_prep "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/models.py"
click node_sequence_prep "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/models.py"
click node_model_contracts "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/base.py"
click node_xgb_model "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/models.py"
click node_lstm_model "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/models.py"
click node_xgb_artifact "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/xgb_model.json"
click node_lstm_artifact "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/lstm_model.keras"
click node_regression_metrics "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/base.py"
click node_replay "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py"
click node_fault_injection "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py"
click node_fleet_view "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py"
click node_oop_view "https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.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_app,node_input_modes,node_prediction_results,node_analyst_dashboard,node_user_manual toneBlue
class node_dataset,node_data_loader,node_input_parser,node_tabular_prep,node_sequence_prep toneAmber
class node_model_contracts,node_xgb_model,node_lstm_model,node_xgb_artifact,node_lstm_artifact,node_regression_metrics toneMint
class node_replay,node_fault_injection,node_fleet_view,node_oop_view toneRose
class node_operator toneIndigo
```

## Components

### Streamlit interface

- [App entry point](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`
- [Prediction inputs](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`
- [Prediction results](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`
- [Analyst dashboard](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`
- [In-app manual](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`

### Data preparation

- [FD001 data](https://github.com/yugamdeepgoyal/predictive_maintenance/tree/main/CMaps): `CMaps`
- [C-MAPSS loader](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/handle_data.py): `src/handle_data.py`
- [Input parsing](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`
- [Tabular features](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/models.py): `src/models.py`
- [Sequence features](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/models.py): `src/models.py`

### RUL prediction

- [Model and prep contracts](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/base.py): `src/base.py`
- [XGBoost model](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/models.py): `src/models.py`
- [LSTM model](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/models.py): `src/models.py`
- [Saved XGBoost](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/xgb_model.json): `xgb_model.json`
- [Saved LSTM](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/lstm_model.keras): `lstm_model.keras`
- [Regression metrics](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/src/base.py): `src/base.py`

### Analysis and guidance

- [Live replay](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`
- [Fault injection](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`
- [Fleet view](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`
- [OOP view](https://github.com/yugamdeepgoyal/predictive_maintenance/blob/main/app.py): `app.py`

### Other components

- **Engine analyst**

## Connections

- Engine analyst → App entry point: uses (evidence: `README.md`)
- App entry point → C-MAPSS loader: loads data (evidence: `app.py`)
- C-MAPSS loader → FD001 data: reads files (evidence: `src/handle_data.py`)
- Engine analyst → Prediction inputs: provides readings (evidence: `README.md`)
- Prediction inputs → Input parsing: parses input (evidence: `README.md`)
- Input parsing → Tabular features: prepares inputs (evidence: `app.py`)
- App entry point → Tabular features: prepares data (evidence: `app.py`)
- App entry point → Sequence features: prepares data (evidence: `app.py`)
- App entry point → XGBoost model: loads or trains (evidence: `app.py`)
- App entry point → LSTM model: loads model (evidence: `app.py`)
- Tabular features → Model and prep contracts: implements contract (evidence: `src/models.py`)
- Sequence features → Model and prep contracts: implements contract (evidence: `src/models.py`)
- XGBoost model → Model and prep contracts: implements contract (evidence: `src/models.py`)
- LSTM model → Model and prep contracts: implements contract (evidence: `src/models.py`)
- App entry point → Saved XGBoost: loads or saves (evidence: `README.md`)
- App entry point → Saved LSTM: loads (evidence: `README.md`)
- App entry point → Prediction results: shows estimates (evidence: `README.md`)
- Engine analyst → Analyst dashboard: opens (evidence: `README.md`)
- Analyst dashboard → Live replay: offers replay (evidence: `README.md`)
- Analyst dashboard → Fault injection: offers injection (evidence: `README.md`)
- Analyst dashboard → Fleet view: offers fleet view (evidence: `README.md`)
- Analyst dashboard → OOP view: offers OOP view (evidence: `README.md`)
- Engine analyst → In-app manual: opens (evidence: `README.md`)
- XGBoost model → Regression metrics: evaluates with (evidence: `src/models.py`)
- LSTM model → Regression metrics: evaluates with (evidence: `src/models.py`)
