# dudavskyi-dev/anomaly-detection-in-production-lstm architecture

> Architecture diagram of the GitHub repository dudavskyi-dev/anomaly-detection-in-production-lstm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dudavskyi-dev/anomaly-detection-in-production-lstm
- Repository: https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm

## Overview

PdM-Sentinel takes industrial telemetry from dataset ingestion or replay through preprocessing, RUL and anomaly-model training, evaluation, and model-bundle creation. Bundles are served through an API for RUL prediction and anomaly detection; drift checks compare traffic with frozen training references and can trigger candidate retraining, while promotion remains a separate gated registry action. The graph follows README-documented capabilities and sampled orchestration; some subsystem paths are directories because their internal wiring was not sampled.

Main entry points: [`pdm/cli.py`](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/cli.py) (CLI orchestration), [`pdm/preprocessing`](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/preprocessing) (Preprocessing), [`pdm/models/torch`](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/models/torch) (PyTorch models), [`pdm/models/tf`](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/models/tf) (TensorFlow models)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Telemetry preparation"]
  node_ingestion["Ingestion and replay"]
  node_preprocessing["Preprocessing"]
end

subgraph group_models["Model development"]
  node_baseline["Classical models"]
  node_torch["PyTorch models"]
  node_tensorflow["TensorFlow models"]
  node_evaluation["Evaluation"]
  node_bundle["Model bundles<br/>[bundle.py]"]
end

subgraph group_runtime["Inference service"]
  node_serving["Inference API<br/>[app.py]"]
end

subgraph group_operations["Tracking and operations"]
  node_cli["CLI orchestration<br/>[cli.py]"]
  node_tracking["MLflow tracking<br/>[mlflow_client.py]"]
  node_registry["Model registry<br/>[registry.py]"]
  node_promotion["Promotion gates<br/>[promotion.py]"]
  node_monitoring["Drift analysis<br/>[drift.py]"]
  node_reports["Drift reports<br/>[reports.py]"]
  node_trigger["Retraining trigger<br/>[trigger.py]"]
end

node_user(("Operator"))
node_data_sources(("Telemetry datasets"))
node_api_client(("API client"))
node_prometheus(("Prometheus"))

node_user -->|"runs commands"| node_cli
node_data_sources -->|"supplies data"| node_ingestion
node_cli -->|"downloads or replays"| node_ingestion
node_cli -->|"prepares windows"| node_preprocessing
node_ingestion -->|"provides telemetry"| node_preprocessing
node_preprocessing -->|"provides windows"| node_baseline
node_preprocessing -->|"provides windows"| node_torch
node_preprocessing -->|"provides windows"| node_tensorflow
node_cli -->|"runs training"| node_baseline
node_cli -->|"runs training"| node_torch
node_cli -->|"runs benchmarks"| node_tensorflow
node_baseline -->|"scores predictions"| node_evaluation
node_torch -->|"scores predictions"| node_evaluation
node_tensorflow -->|"scores predictions"| node_evaluation
node_cli -->|"logs training"| node_tracking
node_baseline -->|"logs runs"| node_tracking
node_torch -->|"logs runs"| node_tracking
node_tensorflow -->|"logs runs"| node_tracking
node_torch -->|"writes artifacts"| node_bundle
node_tensorflow -->|"writes artifacts"| node_bundle
node_cli -->|"loads bundles"| node_bundle
node_api_client -->|"sends requests"| node_serving
node_serving -->|"loads model"| node_bundle
node_serving -->|"returns predictions"| node_api_client
node_prometheus -.->|"scrapes metrics"| node_serving
node_cli -->|"runs drift checks"| node_monitoring
node_monitoring -->|"reads reference stats"| node_bundle
node_cli -->|"loads replay windows"| node_preprocessing
node_monitoring -->|"provides drift results"| node_reports
node_monitoring -->|"checks thresholds"| node_trigger
node_trigger -->|"requests retraining"| node_cli
node_cli -->|"administers versions"| node_registry
node_registry -->|"evaluates candidates"| node_promotion
node_promotion -->|"promotes candidate"| node_registry

click node_ingestion "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/ingestion"
click node_preprocessing "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/preprocessing"
click node_baseline "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/models/baseline"
click node_torch "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/models/torch"
click node_tensorflow "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/models/tf"
click node_evaluation "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/evaluation"
click node_bundle "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/models/bundle.py"
click node_cli "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/cli.py"
click node_tracking "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/tracking/mlflow_client.py"
click node_registry "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/tracking/registry.py"
click node_promotion "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/tracking/promotion.py"
click node_serving "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/serving/app.py"
click node_monitoring "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/monitoring/drift.py"
click node_reports "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/monitoring/reports.py"
click node_trigger "https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/monitoring/trigger.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_ingestion,node_preprocessing,node_api_client toneBlue
class node_baseline,node_torch,node_tensorflow,node_evaluation,node_bundle toneAmber
class node_serving toneMint
class node_cli,node_tracking,node_registry,node_promotion,node_monitoring,node_reports,node_trigger toneRose
class node_user,node_data_sources,node_prometheus toneIndigo
```

## Components

### Telemetry preparation

- [Ingestion and replay](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/ingestion): `pdm/ingestion`
- [Preprocessing](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/preprocessing): `pdm/preprocessing`

### Model development

- [Classical models](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/models/baseline): `pdm/models/baseline`
- [PyTorch models](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/models/torch): `pdm/models/torch`
- [TensorFlow models](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/models/tf): `pdm/models/tf`
- [Evaluation](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/tree/main/pdm/evaluation): `pdm/evaluation`
- [Model bundles](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/models/bundle.py): `pdm/models/bundle.py`

### Inference service

- [Inference API](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/serving/app.py): `pdm/serving/app.py`

### Tracking and operations

- [CLI orchestration](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/cli.py): `pdm/cli.py`
- [MLflow tracking](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/tracking/mlflow_client.py): `pdm/tracking/mlflow_client.py`
- [Model registry](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/tracking/registry.py): `pdm/tracking/registry.py`
- [Promotion gates](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/tracking/promotion.py): `pdm/tracking/promotion.py`
- [Drift analysis](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/monitoring/drift.py): `pdm/monitoring/drift.py`
- [Drift reports](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/monitoring/reports.py): `pdm/monitoring/reports.py`
- [Retraining trigger](https://github.com/dudavskyi-dev/anomaly-detection-in-production-lstm/blob/main/pdm/monitoring/trigger.py): `pdm/monitoring/trigger.py`

### Other components

- **Operator**
- **Telemetry datasets**
- **API client**
- **Prometheus**

## Connections

- Operator → CLI orchestration: runs commands
- Telemetry datasets → Ingestion and replay: supplies data
- CLI orchestration → Ingestion and replay: downloads or replays
- CLI orchestration → Preprocessing: prepares windows
- Ingestion and replay → Preprocessing: provides telemetry
- Preprocessing → Classical models: provides windows
- Preprocessing → PyTorch models: provides windows
- Preprocessing → TensorFlow models: provides windows
- CLI orchestration → Classical models: runs training
- CLI orchestration → PyTorch models: runs training
- CLI orchestration → TensorFlow models: runs benchmarks
- Classical models → Evaluation: scores predictions
- PyTorch models → Evaluation: scores predictions
- TensorFlow models → Evaluation: scores predictions
- CLI orchestration → MLflow tracking: logs training
- Classical models → MLflow tracking: logs runs
- PyTorch models → MLflow tracking: logs runs
- TensorFlow models → MLflow tracking: logs runs
- PyTorch models → Model bundles: writes artifacts
- TensorFlow models → Model bundles: writes artifacts
- CLI orchestration → Model bundles: loads bundles
- API client → Inference API: sends requests
- Inference API → Model bundles: loads model
- Inference API → API client: returns predictions
- Prometheus → Inference API: scrapes metrics
- CLI orchestration → Drift analysis: runs drift checks
- Drift analysis → Model bundles: reads reference stats
- CLI orchestration → Preprocessing: loads replay windows
- Drift analysis → Drift reports: provides drift results
- Drift analysis → Retraining trigger: checks thresholds
- Retraining trigger → CLI orchestration: requests retraining
- CLI orchestration → Model registry: administers versions
- Model registry → Promotion gates: evaluates candidates
- Promotion gates → Model registry: promotes candidate
