# anshm42/f26-nuclearchallenge architecture

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

- Interactive diagram: https://gitdiagram.com/anshm42/f26-nuclearchallenge
- Repository: https://github.com/anshm42/f26-nuclearchallenge

## Overview

This research prototype turns whole NPPAD simulation CSVs into leakage-controlled train, validation, and test splits, then trains calibrated binary leak and optional leak-type models. The main workflow is split runs, summarize early sensor histories, train and select a binary alert threshold on validation data, and evaluate the frozen artifact on held-out runs. A separate conditional branch classifies leak type. Edges reflect the shown CLI calls and README workflow; evaluation outputs and several type-model details are documented but only partly excerpted.

Main entry points: [`src/leak_detection/cli.py`](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/cli.py) (Model CLI), [`src/leak_detection/features.py`](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/features.py) (Split loader), [`nuclear_dataset_splitter.py`](https://github.com/anshm42/f26-nuclearchallenge/blob/main/nuclear_dataset_splitter.py) (Run splitter), [`src/leak_detection/model.py`](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py) (Binary metrics)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_partition["Data partitioning"]
  node_splitter["Run splitter"]
  node_split_data[("Split CSV runs")]
end

subgraph group_features["Feature preparation"]
  node_split_loader["Split loader<br/>[features.py]"]
  node_run_discovery["Run discovery<br/>[features.py]"]
  node_feature_extraction["Run features<br/>[features.py]"]
end

subgraph group_binary["Binary leak model"]
  node_binary_fit["Calibrated fitting<br/>[model.py]"]
  node_threshold["Threshold selection<br/>[model.py]"]
  node_binary_metrics["Binary metrics<br/>[model.py]"]
  node_binary_artifact["Binary artifact"]
end

subgraph group_types["Leak-type model"]
  node_type_fit["Type fitting<br/>[model.py]"]
  node_type_metrics["Type metrics<br/>[model.py]"]
  node_type_artifact["Type artifact"]
end

subgraph group_interface["CLI and results"]
  node_cli["Model CLI<br/>[cli.py]"]
  node_eval_predictions["Evaluation outputs"]
end

node_researcher(("Researcher"))

node_researcher -->|"runs split"| node_splitter
node_splitter -->|"copies runs"| node_split_data
node_researcher -->|"runs commands"| node_cli
node_split_data -->|"provides splits"| node_cli
node_cli -->|"loads splits"| node_split_loader
node_split_loader -->|"discovers runs"| node_run_discovery
node_split_loader -->|"extracts features"| node_feature_extraction
node_cli -->|"fits model"| node_binary_fit
node_cli -->|"selects threshold"| node_threshold
node_cli -->|"computes metrics"| node_binary_metrics
node_cli -->|"saves artifact"| node_binary_artifact
node_cli -->|"fits type model"| node_type_fit
node_cli -->|"computes type metrics"| node_type_metrics
node_cli -->|"saves type artifact"| node_type_artifact
node_binary_artifact -->|"loads for evaluation"| node_cli
node_type_artifact -->|"loads for evaluation"| node_cli
node_cli -->|"writes predictions"| node_eval_predictions
node_cli -->|"evaluates held-out runs"| node_binary_metrics
node_cli -->|"evaluates leak types"| node_type_metrics

click node_splitter "https://github.com/anshm42/f26-nuclearchallenge/blob/main/nuclear_dataset_splitter.py"
click node_cli "https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/cli.py"
click node_split_loader "https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/features.py"
click node_run_discovery "https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/features.py"
click node_feature_extraction "https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/features.py"
click node_binary_fit "https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py"
click node_threshold "https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py"
click node_binary_metrics "https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py"
click node_type_fit "https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py"
click node_type_metrics "https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.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_splitter,node_split_data toneBlue
class node_split_loader,node_run_discovery,node_feature_extraction toneAmber
class node_binary_fit,node_threshold,node_binary_metrics,node_binary_artifact toneMint
class node_type_fit,node_type_metrics,node_type_artifact toneRose
class node_cli,node_eval_predictions,node_researcher toneIndigo
```

## Components

### Data partitioning

- [Run splitter](https://github.com/anshm42/f26-nuclearchallenge/blob/main/nuclear_dataset_splitter.py): `nuclear_dataset_splitter.py`
- **Split CSV runs**

### Feature preparation

- [Split loader](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/features.py): `src/leak_detection/features.py`
- [Run discovery](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/features.py): `src/leak_detection/features.py`
- [Run features](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/features.py): `src/leak_detection/features.py`

### Binary leak model

- [Calibrated fitting](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py): `src/leak_detection/model.py`
- [Threshold selection](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py): `src/leak_detection/model.py`
- [Binary metrics](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py): `src/leak_detection/model.py`
- **Binary artifact**

### Leak-type model

- [Type fitting](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py): `src/leak_detection/model.py`
- [Type metrics](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/model.py): `src/leak_detection/model.py`
- **Type artifact**

### CLI and results

- [Model CLI](https://github.com/anshm42/f26-nuclearchallenge/blob/main/src/leak_detection/cli.py): `src/leak_detection/cli.py`
- **Evaluation outputs**

### Other components

- **Researcher**

## Connections

- Researcher → Run splitter: runs split (evidence: `README.md`)
- Run splitter → Split CSV runs: copies runs (evidence: `nuclear_dataset_splitter.py`)
- Researcher → Model CLI: runs commands (evidence: `README.md`)
- Split CSV runs → Model CLI: provides splits (evidence: `README.md`)
- Model CLI → Split loader: loads splits (evidence: `src/leak_detection/cli.py`)
- Split loader → Run discovery: discovers runs (evidence: `src/leak_detection/features.py`)
- Split loader → Run features: extracts features (evidence: `src/leak_detection/features.py`)
- Model CLI → Calibrated fitting: fits model (evidence: `src/leak_detection/cli.py`)
- Model CLI → Threshold selection: selects threshold (evidence: `src/leak_detection/cli.py`)
- Model CLI → Binary metrics: computes metrics (evidence: `src/leak_detection/cli.py`)
- Model CLI → Binary artifact: saves artifact (evidence: `src/leak_detection/cli.py`)
- Model CLI → Type fitting: fits type model (evidence: `src/leak_detection/cli.py`)
- Model CLI → Type metrics: computes type metrics (evidence: `README.md`)
- Model CLI → Type artifact: saves type artifact (evidence: `src/leak_detection/cli.py`)
- Binary artifact → Model CLI: loads for evaluation (evidence: `src/leak_detection/cli.py`)
- Type artifact → Model CLI: loads for evaluation (evidence: `src/leak_detection/cli.py`)
- Model CLI → Evaluation outputs: writes predictions (evidence: `src/leak_detection/cli.py`)
- Model CLI → Binary metrics: evaluates held-out runs (evidence: `src/leak_detection/cli.py`)
- Model CLI → Type metrics: evaluates leak types (evidence: `README.md`)
