# databricks-industry-solutions/iot-anomaly-detection architecture

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

- Interactive diagram: https://gitdiagram.com/databricks-industry-solutions/iot-anomaly-detection
- Repository: https://github.com/databricks-industry-solutions/iot-anomaly-detection

## Overview

This Databricks solution accelerator demonstrates a manufacturing IoT anomaly-detection workflow: produce or receive sensor events, persist them through Bronze and Silver Delta tables, train and register a classifier, then score new Silver events into Gold. RUNME configures the multi-step job; its task list documents the notebook order. The README also describes alternative message buses and near-real-time dashboards, but the sampled implementation shows Kafka and does not expose dashboard data wiring, so those links are not inferred. Configuration is shared through the notebook utility.

Main entry points: [`RUNME.py`](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/RUNME.py) (Job setup), [`01_introduction_and_bronze.py`](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/01_introduction_and_bronze.py) (Kafka ingestion), [`04_inference.py`](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/04_inference.py) (Stream anomaly scoring), [`02_silver.py`](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/02_silver.py) (Parse and transform)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Event Ingestion"]
  node_generator["Synthetic IoT generator"]
  node_kafka["Kafka topic"]
  node_bronze_job["Kafka ingestion"]
end

subgraph group_lakehouse["Lakehouse Processing"]
  node_bronze[("Bronze Delta table")]
  node_silver_job["Parse and transform<br/>[02_silver.py]"]
  node_silver[("Silver Delta table<br/>[02_silver.py]")]
end

subgraph group_ml["Modeling and Inference"]
  node_features["Label and feature data<br/>[03_train.py]"]
  node_feature_table[("Feature Delta table<br/>[03_train.py]")]
  node_training["Train and tune classifier<br/>[03_train.py]"]
  node_registry[("MLflow model registry")]
  node_scoring["Stream anomaly scoring<br/>[04_inference.py]"]
  node_gold[("Gold predictions table<br/>[04_inference.py]")]
end

subgraph group_operation["Workflow and Insights"]
  node_workflow["Job setup<br/>[RUNME.py]"]
  node_config["Notebook configuration<br/>[notebook-config.py]"]
  node_dashboard["SQL dashboard"]
end

node_operator(("Accelerator user"))

node_operator -->|"runs setup"| node_workflow
node_workflow -->|"configures task"| node_bronze_job
node_workflow -->|"configures task"| node_silver_job
node_workflow -->|"configures task"| node_training
node_workflow -->|"configures task"| node_scoring
node_workflow -->|"deploys dashboard"| node_dashboard
node_bronze_job -->|"loads settings"| node_config
node_silver_job -->|"loads settings"| node_config
node_features -->|"loads settings"| node_config
node_scoring -->|"loads settings"| node_config
node_bronze_job -->|"runs notebook"| node_generator
node_generator -->|"writes events"| node_kafka
node_bronze_job -->|"reads stream"| node_kafka
node_bronze_job -->|"writes records"| node_bronze
node_silver_job -->|"reads stream"| node_bronze
node_silver_job -->|"writes transformed rows"| node_silver
node_features -->|"reads rows"| node_silver
node_features -->|"writes features"| node_feature_table
node_training -->|"uses feature data"| node_feature_table
node_training -->|"registers model"| node_registry
node_scoring -->|"reads stream"| node_silver
node_scoring -->|"loads production model"| node_registry
node_scoring -->|"writes predictions"| node_gold

click node_workflow "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/RUNME.py"
click node_config "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/util/notebook-config.py"
click node_generator "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/util/generate-iot-data.py"
click node_bronze_job "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/01_introduction_and_bronze.py"
click node_bronze "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/01_introduction_and_bronze.py"
click node_silver_job "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/02_silver.py"
click node_silver "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/02_silver.py"
click node_features "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/03_train.py"
click node_feature_table "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/03_train.py"
click node_training "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/03_train.py"
click node_scoring "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/04_inference.py"
click node_gold "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/04_inference.py"
click node_dashboard "https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/dashboards/IoT%20Streaming%20SA%20Anomaly%20Detection.dbdash"

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_generator,node_kafka,node_bronze_job,node_operator toneBlue
class node_bronze,node_silver_job,node_silver toneAmber
class node_features,node_feature_table,node_training,node_registry,node_scoring,node_gold toneMint
class node_workflow,node_config,node_dashboard toneRose
```

## Components

### Event Ingestion

- [Synthetic IoT generator](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/util/generate-iot-data.py): `util/generate-iot-data.py`
- **Kafka topic**
- [Kafka ingestion](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/01_introduction_and_bronze.py): `01_introduction_and_bronze.py`

### Lakehouse Processing

- [Bronze Delta table](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/01_introduction_and_bronze.py): `01_introduction_and_bronze.py`
- [Parse and transform](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/02_silver.py): `02_silver.py`
- [Silver Delta table](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/02_silver.py): `02_silver.py`

### Modeling and Inference

- [Label and feature data](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/03_train.py): `03_train.py`
- [Feature Delta table](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/03_train.py): `03_train.py`
- [Train and tune classifier](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/03_train.py): `03_train.py`
- **MLflow model registry**
- [Stream anomaly scoring](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/04_inference.py): `04_inference.py`
- [Gold predictions table](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/04_inference.py): `04_inference.py`

### Workflow and Insights

- [Job setup](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/RUNME.py): `RUNME.py`
- [Notebook configuration](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/util/notebook-config.py): `util/notebook-config.py`
- [SQL dashboard](https://github.com/databricks-industry-solutions/iot-anomaly-detection/blob/main/dashboards/IoT%20Streaming%20SA%20Anomaly%20Detection.dbdash): `dashboards/IoT Streaming SA Anomaly Detection.dbdash`

### Other components

- **Accelerator user**

## Connections

- Accelerator user → Job setup: runs setup (evidence: `README.md`)
- Job setup → Kafka ingestion: configures task (evidence: `RUNME.py`)
- Job setup → Parse and transform: configures task (evidence: `RUNME.py`)
- Job setup → Train and tune classifier: configures task (evidence: `RUNME.py`)
- Job setup → Stream anomaly scoring: configures task (evidence: `RUNME.py`)
- Job setup → SQL dashboard: deploys dashboard (evidence: `RUNME.py`)
- Kafka ingestion → Notebook configuration: loads settings (evidence: `01_introduction_and_bronze.py`)
- Parse and transform → Notebook configuration: loads settings (evidence: `02_silver.py`)
- Label and feature data → Notebook configuration: loads settings (evidence: `03_train.py`)
- Stream anomaly scoring → Notebook configuration: loads settings (evidence: `04_inference.py`)
- Kafka ingestion → Synthetic IoT generator: runs notebook (evidence: `01_introduction_and_bronze.py`)
- Synthetic IoT generator → Kafka topic: writes events (evidence: `util/generate-iot-data.py`)
- Kafka ingestion → Kafka topic: reads stream (evidence: `01_introduction_and_bronze.py`)
- Kafka ingestion → Bronze Delta table: writes records (evidence: `01_introduction_and_bronze.py`)
- Parse and transform → Bronze Delta table: reads stream (evidence: `02_silver.py`)
- Parse and transform → Silver Delta table: writes transformed rows (evidence: `02_silver.py`)
- Label and feature data → Silver Delta table: reads rows (evidence: `03_train.py`)
- Label and feature data → Feature Delta table: writes features (evidence: `03_train.py`)
- Train and tune classifier → Feature Delta table: uses feature data (evidence: `03_train.py`)
- Train and tune classifier → MLflow model registry: registers model (evidence: `03_train.py`)
- Stream anomaly scoring → Silver Delta table: reads stream (evidence: `04_inference.py`)
- Stream anomaly scoring → MLflow model registry: loads production model (evidence: `04_inference.py`)
- Stream anomaly scoring → Gold predictions table: writes predictions (evidence: `04_inference.py`)
