# darpa-criticalmaas/beak-ta3 architecture

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

- Interactive diagram: https://gitdiagram.com/darpa-criticalmaas/beak-ta3
- Repository: https://github.com/darpa-criticalmaas/beak-ta3

## Overview

Beak-TA3 is a mineral-predictive-mapping package. Its documented user workflow is to provide evidence and label data, run a SOM or Bayesian neural network (BNN) prediction, and inspect/export prediction products; the StatMaGIC integration modules provide orchestration for both methods. Supporting branches cover evaluation, geospatial data preparation, and first-phase model definitions. Edges reflect the README, excerpts, and SOURCE INDEX references; unsampled implementation details are not expanded.

Main entry points: [`src/beak/integration/statmagic/call_bnn.py`](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/integration/statmagic/call_bnn.py) (BNN runner), [`src/beak/integration/statmagic/call_som.py`](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/integration/statmagic/call_som.py) (SOM runner), [`src/beak/utilities/file_io.py`](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/file_io.py) (Raster and file I/O), [`src/beak/methods/som/do_nextsomcore_save_results.py`](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/do_nextsomcore_save_results.py) (SOM result export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["StatMaGIC integration"]
  node_som_run["SOM runner<br/>[call_som.py]"]
  node_bnn_run["BNN runner<br/>[call_bnn.py]"]
  node_integration_utils["Integration utilities<br/>[utils.py]"]
end

subgraph group_som["SOM prediction"]
  node_som_config["SOM arguments<br/>[argsSOM.py]"]
  node_som_core["SOM training<br/>[nextsomcore.py]"]
  node_som_loader["SOM data loading<br/>[loadfile.py]"]
  node_som_save["SOM result export"]
  node_som_labels["SOM label analysis<br/>[label_analysis.py]"]
  node_som_plot["SOM visualization"]
  node_som_plot_helpers["Plot helpers"]
end

subgraph group_bnn["BNN prediction"]
  node_bnn_model["Bayesian network<br/>[fastBNN.py]"]
  node_bnn_utils["BNN utilities<br/>[utils.py]"]
end

subgraph group_geodata["Geospatial processing"]
  node_file_io["Raster and file I/O<br/>[file_io.py]"]
  node_vector["Vector processing"]
  node_raster["Raster processing"]
  node_sampling["Spatial sampling<br/>[sampling.py]"]
  node_transform["Data transforms<br/>[transform.py]"]
  node_experimental["Experimental geospatial tools"]
end

subgraph group_support["Evaluation and models"]
  node_metrics["Classification metrics"]
  node_metric_defs["Metric definitions"]
  node_model_defs["Phase-one models"]
end

node_user(("Analyst"))

node_user -->|"runs SOM"| node_som_run
node_user -->|"runs BNN"| node_bnn_run
node_som_run -->|"configures"| node_som_config
node_som_run -->|"runs SOM"| node_som_core
node_som_run -->|"exports results"| node_som_save
node_som_run -->|"plots results"| node_som_plot
node_som_run -->|"uses utilities"| node_integration_utils
node_som_core -->|"loads data"| node_som_loader
node_som_save -->|"saves outputs"| node_som_core
node_som_save -->|"analyzes labels"| node_som_labels
node_som_plot -->|"uses annotations"| node_som_labels
node_som_plot -->|"uses helpers"| node_som_plot_helpers
node_bnn_run -->|"trains and predicts"| node_bnn_model
node_bnn_run -->|"uses utilities"| node_bnn_utils
node_bnn_run -->|"samples data"| node_sampling
node_bnn_run -->|"processes rasters"| node_raster
node_bnn_run -->|"loads and saves"| node_file_io
node_bnn_run -->|"evaluates predictions"| node_metrics
node_metrics -->|"predicts with"| node_bnn_model
node_metrics -->|"uses definitions"| node_metric_defs
node_sampling -->|"uses processing"| node_vector
node_raster -->|"uses file I/O"| node_file_io
node_vector -->|"uses file I/O"| node_file_io
node_transform -->|"uses file I/O"| node_file_io
node_experimental -.->|"supports preparation"| node_user

click node_som_run "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/integration/statmagic/call_som.py"
click node_bnn_run "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/integration/statmagic/call_bnn.py"
click node_integration_utils "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/integration/statmagic/utils.py"
click node_som_config "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/argsSOM.py"
click node_som_core "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/nextsomcore/nextsomcore.py"
click node_som_loader "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/nextsomcore/loadfile.py"
click node_som_save "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/do_nextsomcore_save_results.py"
click node_som_labels "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/label_analysis.py"
click node_som_plot "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/plot_som_results.py"
click node_som_plot_helpers "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/plotting_functions.py"
click node_bnn_model "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/bnn/fastBNN.py"
click node_bnn_utils "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/bnn/utils.py"
click node_metrics "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/evaluation/calculate_metrics.py"
click node_metric_defs "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/evaluation/metrics_definitions.py"
click node_file_io "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/file_io.py"
click node_vector "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/vector_processing.py"
click node_raster "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/raster_processing.py"
click node_sampling "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/sampling.py"
click node_transform "https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/transform.py"
click node_experimental "https://github.com/darpa-criticalmaas/beak-ta3/tree/main/src/beak/experimental"
click node_model_defs "https://github.com/darpa-criticalmaas/beak-ta3/tree/main/src/beak/models"

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_som_run,node_bnn_run,node_integration_utils toneBlue
class node_som_config,node_som_core,node_som_loader,node_som_save,node_som_labels,node_som_plot,node_som_plot_helpers toneAmber
class node_bnn_model,node_bnn_utils toneMint
class node_file_io,node_vector,node_raster,node_sampling,node_transform,node_experimental toneRose
class node_metrics,node_metric_defs,node_model_defs,node_user toneIndigo
```

## Components

### StatMaGIC integration

- [SOM runner](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/integration/statmagic/call_som.py): `src/beak/integration/statmagic/call_som.py`
- [BNN runner](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/integration/statmagic/call_bnn.py): `src/beak/integration/statmagic/call_bnn.py`
- [Integration utilities](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/integration/statmagic/utils.py): `src/beak/integration/statmagic/utils.py`

### SOM prediction

- [SOM arguments](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/argsSOM.py): `src/beak/methods/som/argsSOM.py`
- [SOM training](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/nextsomcore/nextsomcore.py): `src/beak/methods/som/nextsomcore/nextsomcore.py`
- [SOM data loading](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/nextsomcore/loadfile.py): `src/beak/methods/som/nextsomcore/loadfile.py`
- [SOM result export](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/do_nextsomcore_save_results.py): `src/beak/methods/som/do_nextsomcore_save_results.py`
- [SOM label analysis](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/label_analysis.py): `src/beak/methods/som/label_analysis.py`
- [SOM visualization](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/plot_som_results.py): `src/beak/methods/som/plot_som_results.py`
- [Plot helpers](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/som/plotting_functions.py): `src/beak/methods/som/plotting_functions.py`

### BNN prediction

- [Bayesian network](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/bnn/fastBNN.py): `src/beak/methods/bnn/fastBNN.py`
- [BNN utilities](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/methods/bnn/utils.py): `src/beak/methods/bnn/utils.py`

### Geospatial processing

- [Raster and file I/O](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/file_io.py): `src/beak/utilities/file_io.py`
- [Vector processing](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/vector_processing.py): `src/beak/utilities/vector_processing.py`
- [Raster processing](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/raster_processing.py): `src/beak/utilities/raster_processing.py`
- [Spatial sampling](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/sampling.py): `src/beak/utilities/sampling.py`
- [Data transforms](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/utilities/transform.py): `src/beak/utilities/transform.py`
- [Experimental geospatial tools](https://github.com/darpa-criticalmaas/beak-ta3/tree/main/src/beak/experimental): `src/beak/experimental`

### Evaluation and models

- [Classification metrics](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/evaluation/calculate_metrics.py): `src/beak/evaluation/calculate_metrics.py`
- [Metric definitions](https://github.com/darpa-criticalmaas/beak-ta3/blob/main/src/beak/evaluation/metrics_definitions.py): `src/beak/evaluation/metrics_definitions.py`
- [Phase-one models](https://github.com/darpa-criticalmaas/beak-ta3/tree/main/src/beak/models): `src/beak/models`

### Other components

- **Analyst**

## Connections

- Analyst → SOM runner: runs SOM (evidence: `README.md`)
- Analyst → BNN runner: runs BNN (evidence: `README.md`)
- SOM runner → SOM arguments: configures (evidence: `src/beak/integration/statmagic/call_som.py`)
- SOM runner → SOM training: runs SOM (evidence: `src/beak/integration/statmagic/call_som.py`)
- SOM runner → SOM result export: exports results (evidence: `src/beak/integration/statmagic/call_som.py`)
- SOM runner → SOM visualization: plots results (evidence: `src/beak/integration/statmagic/call_som.py`)
- SOM runner → Integration utilities: uses utilities (evidence: `src/beak/integration/statmagic/call_som.py`)
- SOM training → SOM data loading: loads data (evidence: `src/beak/methods/som/nextsomcore/nextsomcore.py`)
- SOM result export → SOM training: saves outputs (evidence: `src/beak/methods/som/do_nextsomcore_save_results.py`)
- SOM result export → SOM label analysis: analyzes labels (evidence: `src/beak/methods/som/do_nextsomcore_save_results.py`)
- SOM visualization → SOM label analysis: uses annotations (evidence: `src/beak/methods/som/plot_som_results.py`)
- SOM visualization → Plot helpers: uses helpers (evidence: `src/beak/methods/som/plot_som_results.py`)
- BNN runner → Bayesian network: trains and predicts (evidence: `src/beak/integration/statmagic/call_bnn.py`)
- BNN runner → BNN utilities: uses utilities (evidence: `src/beak/integration/statmagic/call_bnn.py`)
- BNN runner → Spatial sampling: samples data (evidence: `src/beak/integration/statmagic/call_bnn.py`)
- BNN runner → Raster processing: processes rasters (evidence: `src/beak/integration/statmagic/call_bnn.py`)
- BNN runner → Raster and file I/O: loads and saves (evidence: `src/beak/integration/statmagic/call_bnn.py`)
- BNN runner → Classification metrics: evaluates predictions (evidence: `src/beak/integration/statmagic/call_bnn.py`)
- Classification metrics → Bayesian network: predicts with (evidence: `src/beak/evaluation/calculate_metrics.py`)
- Classification metrics → Metric definitions: uses definitions (evidence: `src/beak/evaluation/calculate_metrics.py`)
- Spatial sampling → Vector processing: uses processing (evidence: `src/beak/utilities/sampling.py`)
- Raster processing → Raster and file I/O: uses file I/O (evidence: `src/beak/utilities/raster_processing.py`)
- Vector processing → Raster and file I/O: uses file I/O (evidence: `src/beak/utilities/vector_processing.py`)
- Data transforms → Raster and file I/O: uses file I/O (evidence: `src/beak/utilities/transform.py`)
- Experimental geospatial tools → Analyst: supports preparation (evidence: `README.md`)
