# brawzzz/ml-shm architecture

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

- Interactive diagram: https://gitdiagram.com/brawzzz/ml-shm
- Repository: https://github.com/brawzzz/ml-shm

## Overview

This repository implements a command-line structural-health-monitoring workflow: load configuration, prepare UTAH or OGW signals, train a convolutional autoencoder, and save model artifacts and metrics. A plotting mode summarizes saved training metrics; a test mode is present but its execution is commented out in the sampled entry point. The graph also shows dataset-specific analysis and generic data inspection. Source excerpts and the README (empty) provide limited evidence for some internals, so only documented or visible relationships are connected.

Main entry points: [`src/main.py`](https://github.com/brawzzz/ml-shm/blob/main/src/main.py) (Command entry), [`src/setup.py`](https://github.com/brawzzz/ml-shm/blob/main/src/setup.py) (Configuration), [`src/tools.py`](https://github.com/brawzzz/ml-shm/blob/main/src/tools.py) (Shared utilities), [`src/data/__init__.py`](https://github.com/brawzzz/ml-shm/blob/main/src/data/__init__.py) (Data facade)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Command Workflow"]
  node_main["Command entry<br/>[main.py]"]
  node_config["Configuration<br/>[setup.py]"]
end

subgraph group_data["Signal Data"]
  node_data_facade["Data facade<br/>[__init__.py]"]
  node_utah["UTAH loader<br/>[UTAH.py]"]
  node_ogw["OGW loader and analysis<br/>[OGW.py]"]
  node_file_inspection["File inspection<br/>[base.py]"]
end

subgraph group_model["Model and Artifacts"]
  node_tools["Shared utilities<br/>[tools.py]"]
  node_cae["Convolutional autoencoder<br/>[CAE.py]"]
  node_model_artifacts[("Model and scaler files<br/>[tools.py]")]
end

subgraph group_analysis["Evaluation and Analysis"]
  node_metric_analysis["Metric analysis<br/>[metrics.py]"]
  node_metric_files["Saved metric archive<br/>[main.py]"]
end

node_user(("CLI user"))

node_user -->|"runs commands"| node_main
node_main -->|"parses arguments"| node_tools
node_main -->|"loads configuration"| node_config
node_config -->|"provides settings"| node_main
node_main -->|"selects dataset"| node_data_facade
node_data_facade -->|"exports loader"| node_utah
node_data_facade -->|"exports loader"| node_ogw
node_main -->|"trains model"| node_cae
node_cae -->|"uses settings"| node_config
node_main -->|"saves model"| node_tools
node_tools -->|"writes model and scaler"| node_model_artifacts
node_main -->|"writes metrics"| node_metric_files
node_main -->|"loads metrics"| node_metric_files
node_main -->|"builds report"| node_metric_analysis
node_metric_analysis -->|"returns analysis"| node_main
node_utah -->|"uses utilities"| node_tools
node_utah -->|"reads data settings"| node_config
node_ogw -->|"uses utilities"| node_tools
node_ogw -->|"reads data settings"| node_config

click node_main "https://github.com/brawzzz/ml-shm/blob/main/src/main.py"
click node_config "https://github.com/brawzzz/ml-shm/blob/main/src/setup.py"
click node_data_facade "https://github.com/brawzzz/ml-shm/blob/main/src/data/__init__.py"
click node_utah "https://github.com/brawzzz/ml-shm/blob/main/src/data/UTAH.py"
click node_ogw "https://github.com/brawzzz/ml-shm/blob/main/src/data/OGW.py"
click node_file_inspection "https://github.com/brawzzz/ml-shm/blob/main/src/data/base.py"
click node_tools "https://github.com/brawzzz/ml-shm/blob/main/src/tools.py"
click node_cae "https://github.com/brawzzz/ml-shm/blob/main/src/CAE.py"
click node_model_artifacts "https://github.com/brawzzz/ml-shm/blob/main/src/tools.py"
click node_metric_analysis "https://github.com/brawzzz/ml-shm/blob/main/src/metrics.py"
click node_metric_files "https://github.com/brawzzz/ml-shm/blob/main/src/main.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_main,node_config,node_user toneBlue
class node_data_facade,node_utah,node_ogw,node_file_inspection toneAmber
class node_tools,node_cae,node_model_artifacts toneMint
class node_metric_analysis,node_metric_files toneRose
```

## Components

### Command Workflow

- [Command entry](https://github.com/brawzzz/ml-shm/blob/main/src/main.py): `src/main.py`
- [Configuration](https://github.com/brawzzz/ml-shm/blob/main/src/setup.py): `src/setup.py`

### Signal Data

- [Data facade](https://github.com/brawzzz/ml-shm/blob/main/src/data/__init__.py): `src/data/__init__.py`
- [UTAH loader](https://github.com/brawzzz/ml-shm/blob/main/src/data/UTAH.py): `src/data/UTAH.py`
- [OGW loader and analysis](https://github.com/brawzzz/ml-shm/blob/main/src/data/OGW.py): `src/data/OGW.py`
- [File inspection](https://github.com/brawzzz/ml-shm/blob/main/src/data/base.py): `src/data/base.py`

### Model and Artifacts

- [Shared utilities](https://github.com/brawzzz/ml-shm/blob/main/src/tools.py): `src/tools.py`
- [Convolutional autoencoder](https://github.com/brawzzz/ml-shm/blob/main/src/CAE.py): `src/CAE.py`
- [Model and scaler files](https://github.com/brawzzz/ml-shm/blob/main/src/tools.py): `src/tools.py`

### Evaluation and Analysis

- [Metric analysis](https://github.com/brawzzz/ml-shm/blob/main/src/metrics.py): `src/metrics.py`
- [Saved metric archive](https://github.com/brawzzz/ml-shm/blob/main/src/main.py): `src/main.py`

### Other components

- **CLI user**

## Connections

- CLI user → Command entry: runs commands (evidence: `src/main.py`)
- Command entry → Shared utilities: parses arguments (evidence: `src/main.py`)
- Command entry → Configuration: loads configuration (evidence: `src/main.py`)
- Configuration → Command entry: provides settings (evidence: `src/main.py`)
- Command entry → Data facade: selects dataset (evidence: `src/main.py`)
- Data facade → UTAH loader: exports loader (evidence: `src/data/__init__.py`)
- Data facade → OGW loader and analysis: exports loader (evidence: `src/data/__init__.py`)
- Command entry → Convolutional autoencoder: trains model (evidence: `src/main.py`)
- Convolutional autoencoder → Configuration: uses settings (evidence: `src/CAE.py`)
- Command entry → Shared utilities: saves model (evidence: `src/main.py`)
- Shared utilities → Model and scaler files: writes model and scaler (evidence: `src/tools.py`)
- Command entry → Saved metric archive: writes metrics (evidence: `src/main.py`)
- Command entry → Saved metric archive: loads metrics (evidence: `src/main.py`)
- Command entry → Metric analysis: builds report (evidence: `src/main.py`)
- Metric analysis → Command entry: returns analysis (evidence: `src/main.py`)
- UTAH loader → Shared utilities: uses utilities (evidence: `src/data/UTAH.py`)
- UTAH loader → Configuration: reads data settings (evidence: `src/data/UTAH.py`)
- OGW loader and analysis → Shared utilities: uses utilities (evidence: `src/data/OGW.py`)
- OGW loader and analysis → Configuration: reads data settings (evidence: `src/data/OGW.py`)
