# dpr23/anomaly_project architecture

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

- Interactive diagram: https://gitdiagram.com/dpr23/anomaly_project
- Repository: https://github.com/dpr23/anomaly_project

## Overview

This is a small cold-store IoT temperature anomaly detector. The documented workflows are training an LSTM autoencoder on synthetic normal readings with MLflow tracking, and submitting 24 readings through a Gradio interface for reconstruction-error classification. The graph separates training, serving, and the model artifact. Note: the tree contains `lstm_autoencoder (1).pth`, while the serving code loads `lstm_autoencoder.pth`; the excerpts do not establish that the listed artifact is the one the app loads.

Main entry points: [`train.py`](https://github.com/dpr23/anomaly_project/blob/main/train.py) (Training script), [`app.py`](https://github.com/dpr23/anomaly_project/blob/main/app.py) (Anomaly detector), [`lstm_autoencoder (1).pth`](https://github.com/dpr23/anomaly_project/blob/main/lstm_autoencoder%20(1).pth) (Weights file)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_training["Model training"]
  node_train["Training script<br/>[train.py]"]
  node_synthetic["Normal sequences<br/>[train.py]"]
  node_training_model["LSTM autoencoder<br/>[train.py]"]
  node_mlflow["MLflow tracking"]
end

subgraph group_serving["Detection service"]
  node_ui["Gradio interface<br/>[app.py]"]
  node_detector["Anomaly detector<br/>[app.py]"]
  node_serving_model["LSTM autoencoder<br/>[app.py]"]
end

subgraph group_artifact["Model artifact"]
  node_artifact_file["Weights file"]
end

node_operator(("Operator"))

node_train -->|"generates"| node_synthetic
node_train -->|"trains"| node_training_model
node_train -->|"logs metrics"| node_mlflow
node_train -->|"saves weights"| node_artifact_file
node_operator -->|"enters readings"| node_ui
node_ui -->|"submits input"| node_detector
node_detector -->|"reconstructs"| node_serving_model
node_detector -->|"returns status"| node_ui
node_serving_model -.->|"loads weights"| node_artifact_file

click node_train "https://github.com/dpr23/anomaly_project/blob/main/train.py"
click node_synthetic "https://github.com/dpr23/anomaly_project/blob/main/train.py"
click node_training_model "https://github.com/dpr23/anomaly_project/blob/main/train.py"
click node_ui "https://github.com/dpr23/anomaly_project/blob/main/app.py"
click node_detector "https://github.com/dpr23/anomaly_project/blob/main/app.py"
click node_serving_model "https://github.com/dpr23/anomaly_project/blob/main/app.py"
click node_artifact_file "https://github.com/dpr23/anomaly_project/blob/main/lstm_autoencoder%20(1).pth"

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_train,node_synthetic,node_training_model,node_mlflow toneBlue
class node_ui,node_detector,node_serving_model toneAmber
class node_artifact_file toneMint
class node_operator toneIndigo
```

## Components

### Model training

- [Training script](https://github.com/dpr23/anomaly_project/blob/main/train.py): `train.py`
- [Normal sequences](https://github.com/dpr23/anomaly_project/blob/main/train.py): `train.py`
- [LSTM autoencoder](https://github.com/dpr23/anomaly_project/blob/main/train.py): `train.py`
- **MLflow tracking**

### Detection service

- [Gradio interface](https://github.com/dpr23/anomaly_project/blob/main/app.py): `app.py`
- [Anomaly detector](https://github.com/dpr23/anomaly_project/blob/main/app.py): `app.py`
- [LSTM autoencoder](https://github.com/dpr23/anomaly_project/blob/main/app.py): `app.py`

### Model artifact

- [Weights file](https://github.com/dpr23/anomaly_project/blob/main/lstm_autoencoder%20(1).pth): `lstm_autoencoder (1).pth`

### Other components

- **Operator**

## Connections

- Training script → Normal sequences: generates (evidence: `train.py`)
- Training script → LSTM autoencoder: trains (evidence: `train.py`)
- Training script → MLflow tracking: logs metrics (evidence: `train.py`)
- Training script → Weights file: saves weights (evidence: `train.py`)
- Operator → Gradio interface: enters readings (evidence: `app.py`)
- Gradio interface → Anomaly detector: submits input (evidence: `app.py`)
- Anomaly detector → LSTM autoencoder: reconstructs (evidence: `app.py`)
- Anomaly detector → Gradio interface: returns status (evidence: `app.py`)
- LSTM autoencoder → Weights file: loads weights
