# el-kizmi/wpp711 architecture

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

- Interactive diagram: https://gitdiagram.com/el-kizmi/wpp711
- Repository: https://github.com/el-kizmi/wpp711

## Overview

Batch cMSY++ is an R/Shiny application for multi-species stock assessment. The main user workflow imports catch and stock metadata, optionally derives an abundance index, validates stocks, configures MCMC parameters, runs CMSY++ jobs, and presents per-stock results and group summaries. The README documents a headless CLI as an alternate entry point, plus CPUE standardization and CSV exports. The graph follows the documented module flow; source excerpts were limited, so uncertain internal wiring is omitted.

Main entry points: [`R/mod_batch_cpue.R`](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_cpue.R) (Abundance Index), [`R/mod_batch_validate.R`](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_validate.R) (Stock Validation), [`R/mod_batch_run.R`](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_run.R) (Batch Execution), [`R/mod_batch_results.R`](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_results.R) (Stock Results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_wizard["Wizard Workflow"]
  node_import["Import Data<br/>[mod_batch_import.R]"]
  node_cpue["Abundance Index<br/>[mod_batch_cpue.R]"]
  node_validate["Stock Validation"]
  node_params["MCMC Parameters<br/>[mod_batch_params.R]"]
  node_run["Batch Execution<br/>[mod_batch_run.R]"]
end

subgraph group_analysis["Analysis Runtime"]
  node_cpue_helpers["CPUE Standardization<br/>[cpue_helpers.R]"]
  node_batch_helpers["Batch Helpers<br/>[batch_helpers.R]"]
  node_runner["CMSY Job Runner<br/>[cmsy_runner.R]"]
  node_engine["CMSY++ Engine<br/>[CMSY++16.R]"]
end

subgraph group_presentation["Results &amp; Reporting"]
  node_results["Stock Results"]
  node_summary["Group Summary"]
end

subgraph group_interfaces["Execution Interfaces"]
  node_app["Shiny App<br/>[app_batch.R]"]
  node_cli["Batch CLI<br/>[run_batch_cli.R]"]
end

node_user(("Analyst"))
node_csv_in["Catch &amp; Metadata CSV"]
node_raw_cpue["Raw CPUE Data"]
node_exports["CSV Exports"]

node_user -->|"uses"| node_app
node_user -.->|"runs"| node_cli
node_csv_in -->|"uploads"| node_import
node_app -->|"hosts"| node_import
node_import -->|"passes data"| node_cpue
node_raw_cpue -.->|"provides data"| node_cpue
node_cpue -.->|"standardizes"| node_cpue_helpers
node_cpue -->|"passes index"| node_validate
node_validate -->|"validates with"| node_batch_helpers
node_validate -->|"passes stocks"| node_params
node_params -->|"sets options"| node_run
node_run -->|"dispatches jobs"| node_runner
node_runner -->|"runs model"| node_engine
node_run -->|"passes results"| node_results
node_results -->|"classifies with"| node_batch_helpers
node_results -->|"passes metrics"| node_summary
node_summary -->|"aggregates with"| node_batch_helpers
node_summary -->|"writes CSV"| node_exports
node_cli -.->|"dispatches jobs"| node_runner

click node_app "https://github.com/el-kizmi/wpp711/blob/master/app_batch.R"
click node_cli "https://github.com/el-kizmi/wpp711/blob/master/scripts/run_batch_cli.R"
click node_import "https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_import.R"
click node_cpue "https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_cpue.R"
click node_cpue_helpers "https://github.com/el-kizmi/wpp711/blob/master/R/cpue_helpers.R"
click node_validate "https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_validate.R"
click node_batch_helpers "https://github.com/el-kizmi/wpp711/blob/master/R/batch_helpers.R"
click node_params "https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_params.R"
click node_run "https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_run.R"
click node_runner "https://github.com/el-kizmi/wpp711/blob/master/R/cmsy_runner.R"
click node_engine "https://github.com/el-kizmi/wpp711/blob/master/engine/CMSY%2B%2B16.R"
click node_results "https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_results.R"
click node_summary "https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_summary.R"

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_import,node_cpue,node_validate,node_params,node_run toneBlue
class node_cpue_helpers,node_batch_helpers,node_runner,node_engine toneAmber
class node_results,node_summary toneMint
class node_app,node_cli toneRose
class node_user,node_csv_in,node_raw_cpue,node_exports toneIndigo
```

## Components

### Wizard Workflow

- [Import Data](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_import.R): `R/mod_batch_import.R`
- [Abundance Index](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_cpue.R): `R/mod_batch_cpue.R`
- [Stock Validation](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_validate.R): `R/mod_batch_validate.R`
- [MCMC Parameters](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_params.R): `R/mod_batch_params.R`
- [Batch Execution](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_run.R): `R/mod_batch_run.R`

### Analysis Runtime

- [CPUE Standardization](https://github.com/el-kizmi/wpp711/blob/master/R/cpue_helpers.R): `R/cpue_helpers.R`
- [Batch Helpers](https://github.com/el-kizmi/wpp711/blob/master/R/batch_helpers.R): `R/batch_helpers.R`
- [CMSY Job Runner](https://github.com/el-kizmi/wpp711/blob/master/R/cmsy_runner.R): `R/cmsy_runner.R`
- [CMSY++ Engine](https://github.com/el-kizmi/wpp711/blob/master/engine/CMSY%2B%2B16.R): `engine/CMSY++16.R`

### Results & Reporting

- [Stock Results](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_results.R): `R/mod_batch_results.R`
- [Group Summary](https://github.com/el-kizmi/wpp711/blob/master/R/mod_batch_summary.R): `R/mod_batch_summary.R`

### Execution Interfaces

- [Shiny App](https://github.com/el-kizmi/wpp711/blob/master/app_batch.R): `app_batch.R`
- [Batch CLI](https://github.com/el-kizmi/wpp711/blob/master/scripts/run_batch_cli.R): `scripts/run_batch_cli.R`

### Other components

- **Analyst**
- **Catch & Metadata CSV**
- **Raw CPUE Data**
- **CSV Exports**

## Connections

- Analyst → Shiny App: uses
- Analyst → Batch CLI: runs
- Catch & Metadata CSV → Import Data: uploads
- Shiny App → Import Data: hosts
- Import Data → Abundance Index: passes data
- Raw CPUE Data → Abundance Index: provides data
- Abundance Index → CPUE Standardization: standardizes
- Abundance Index → Stock Validation: passes index
- Stock Validation → Batch Helpers: validates with
- Stock Validation → MCMC Parameters: passes stocks
- MCMC Parameters → Batch Execution: sets options
- Batch Execution → CMSY Job Runner: dispatches jobs
- CMSY Job Runner → CMSY++ Engine: runs model
- Batch Execution → Stock Results: passes results
- Stock Results → Batch Helpers: classifies with
- Stock Results → Group Summary: passes metrics
- Group Summary → Batch Helpers: aggregates with
- Group Summary → CSV Exports: writes CSV
- Batch CLI → CMSY Job Runner: dispatches jobs
