# jamesjoshua-k/nssc2026-dataanalytics-orbitiq architecture

> Architecture diagram of the GitHub repository jamesjoshua-k/nssc2026-dataanalytics-orbitiq, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq
- Repository: https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq

## Overview

This repository is a research pipeline for unsupervised anomaly detection in Mars HiRISE crops. Its main workflow preprocesses imagery, learns scene and residual latents with convolutional autoencoders, scores those latents with an Isolation Forest, applies a robust threshold, and interprets flagged crops with reconstruction-error heatmaps and metadata. It also includes a planted-fakes benchmark and a post-submission v7 experimentation branch. The README documents the overall flow; detailed internal wiring is shown only for sampled files, so uncertain links are omitted.

Main entry points: [`outputs/flagged_anomalies.csv`](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/outputs/flagged_anomalies.csv) (Flagged crops), [`nssc_core.py`](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py) (Autoencoder training), [`run_version.py`](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/run_version.py) (Version runner), [`post_submission_improvements/iteration_v7/code/r2lib.py`](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/post_submission_improvements/iteration_v7/code/r2lib.py) (V7 experiment library)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_data["Imagery preparation"]
  node_prep["Mask and preprocess<br/>[nssc_core.py]"]
end

subgraph group_detection["Anomaly detection"]
  node_autoencoder["Autoencoder training<br/>[nssc_core.py]"]
  node_version_runner["Version runner<br/>[run_version.py]"]
  node_latent["Latent extraction<br/>[nssc_core.py]"]
  node_forest["Isolation Forest<br/>[nssc_core.py]"]
  node_threshold["Robust threshold<br/>[nssc_core.py]"]
end

subgraph group_analysis["Evaluation and interpretation"]
  node_flags["Flagged crops"]
  node_heatmaps["Error heatmaps"]
  node_metadata["Crop metadata"]
  node_benchmark["Planted-fakes benchmark<br/>[benchmark.py]"]
end

subgraph group_followup["V7 experiments"]
  node_v7_harness["V7 search harness<br/>[p3.py]"]
  node_v7_library["V7 experiment library<br/>[r2lib.py]"]
  node_v7_evaluation["Latent evaluation<br/>[evaluate.py]"]
end

node_analyst(("Analyst"))
node_crops[("HiRISE crops")]

node_crops -->|"provides images"| node_prep
node_prep -->|"prepares inputs"| node_autoencoder
node_analyst -->|"runs version"| node_version_runner
node_version_runner -->|"trains model"| node_autoencoder
node_autoencoder -->|"encodes crops"| node_latent
node_latent -->|"scores latents"| node_forest
node_forest -->|"produces scores"| node_threshold
node_threshold -->|"flags crops"| node_flags
node_flags -->|"interprets errors"| node_heatmaps
node_flags -->|"joins metadata"| node_metadata
node_crops -->|"compares versions"| node_benchmark
node_v7_harness -->|"uses experiments"| node_v7_library
node_v7_evaluation -->|"scores latents"| node_v7_library

click node_prep "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py"
click node_autoencoder "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py"
click node_version_runner "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/run_version.py"
click node_latent "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py"
click node_forest "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py"
click node_threshold "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py"
click node_flags "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/outputs/flagged_anomalies.csv"
click node_heatmaps "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/NSSC_DA_HiRISE.ipynb"
click node_metadata "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/outputs/novelty_scores_with_metadata.csv"
click node_benchmark "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/benchmark.py"
click node_v7_harness "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/post_submission_improvements/iteration_v7/code/p3.py"
click node_v7_library "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/post_submission_improvements/iteration_v7/code/r2lib.py"
click node_v7_evaluation "https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/post_submission_improvements/iteration_v7/code/evaluate.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_prep toneBlue
class node_autoencoder,node_version_runner,node_latent,node_forest,node_threshold,node_crops toneAmber
class node_flags,node_heatmaps,node_metadata,node_benchmark toneMint
class node_v7_harness,node_v7_library,node_v7_evaluation toneRose
class node_analyst toneIndigo
```

## Components

### Imagery preparation

- [Mask and preprocess](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py): `nssc_core.py`

### Anomaly detection

- [Autoencoder training](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py): `nssc_core.py`
- [Version runner](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/run_version.py): `run_version.py`
- [Latent extraction](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py): `nssc_core.py`
- [Isolation Forest](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py): `nssc_core.py`
- [Robust threshold](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/nssc_core.py): `nssc_core.py`

### Evaluation and interpretation

- [Flagged crops](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/outputs/flagged_anomalies.csv): `outputs/flagged_anomalies.csv`
- [Error heatmaps](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/NSSC_DA_HiRISE.ipynb): `NSSC_DA_HiRISE.ipynb`
- [Crop metadata](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/outputs/novelty_scores_with_metadata.csv): `outputs/novelty_scores_with_metadata.csv`
- [Planted-fakes benchmark](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/benchmark.py): `benchmark.py`

### V7 experiments

- [V7 search harness](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/post_submission_improvements/iteration_v7/code/p3.py): `post_submission_improvements/iteration_v7/code/p3.py`
- [V7 experiment library](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/post_submission_improvements/iteration_v7/code/r2lib.py): `post_submission_improvements/iteration_v7/code/r2lib.py`
- [Latent evaluation](https://github.com/jamesjoshua-k/nssc2026-dataanalytics-orbitiq/blob/main/post_submission_improvements/iteration_v7/code/evaluate.py): `post_submission_improvements/iteration_v7/code/evaluate.py`

### Other components

- **Analyst**
- **HiRISE crops**

## Connections

- HiRISE crops → Mask and preprocess: provides images (evidence: `README.md`)
- Mask and preprocess → Autoencoder training: prepares inputs (evidence: `README.md`)
- Analyst → Version runner: runs version (evidence: `README.md`)
- Version runner → Autoencoder training: trains model (evidence: `run_version.py`)
- Autoencoder training → Latent extraction: encodes crops (evidence: `README.md`)
- Latent extraction → Isolation Forest: scores latents (evidence: `README.md`)
- Isolation Forest → Robust threshold: produces scores (evidence: `README.md`)
- Robust threshold → Flagged crops: flags crops (evidence: `README.md`)
- Flagged crops → Error heatmaps: interprets errors (evidence: `README.md`)
- Flagged crops → Crop metadata: joins metadata (evidence: `README.md`)
- HiRISE crops → Planted-fakes benchmark: compares versions (evidence: `README.md`)
- V7 search harness → V7 experiment library: uses experiments (evidence: `post_submission_improvements/iteration_v7/code/p3.py`)
- Latent evaluation → V7 experiment library: scores latents (evidence: `post_submission_improvements/iteration_v7/code/evaluate.py`)
