# rat-pac/ratpac2-tutorial architecture

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

- Interactive diagram: https://gitdiagram.com/rat-pac/ratpac2-tutorial
- Repository: https://github.com/rat-pac/ratpac2-tutorial

## Overview

#### Purpose and Published Artifact
This repository is a Carpentries Workbench Markdown lesson on RAT (RAT/GEANT-style simulation topics), organized as a sequential instructional curriculum rather than an application. Its primary deliverable is a static lesson website, with the lesson landing page at `index.md` and site-wide metadata in `config.yaml`.

#### Lesson Entry Points and Navigation
Learners enter through `index.md`, then follow numbered Markdown episodes under `episodes/`. Supporting navigation and reference material is separated from the core lesson: `learners/reference.md`, `links.md`, and `profiles/learner-profiles.md`. Instructor-specific delivery guidance is isolated in `instructors/instructor-notes.md`.

#### Curriculum Pipeline
The core architecture is the ordered episode sequence, which progressively moves from simulation setup and domain concepts to execution, validation, and analysis:
- Setup and RAT macro use: `episodes/00-setup.md`, `episodes/01-rat-macro.md`
- Simulation construction: `episodes/02-generators.md`, `episodes/03-detector-geometry.md`, `episodes/04-photon-production.md`
- Photon transport and detection: `episodes/05-photon-propagation.md`, `episodes/06-photon-detection.md`
- Processing, fitting, I/O, databases, testing, and analysis: `episodes/07-processors.md`, `episodes/08-fitters.md`, `episodes/09-output.md`, `episodes/10-input.md`, `episodes/11-ratdb.md`, `episodes/13-rattests.md`, `episodes/14-analysis.md`

This ordering is the primary control flow: each document is a lesson stage rather than executable production code.

#### Domain and Extension Boundaries
The lesson distinguishes general RAT workflow material from locally restricted or experiment-specific content. `episodes/12-private-experiment.md` is an explicit boundary for private-experiment material, while `episodes/15-misc.md` captures content outside the main progressive pipeline. The RAT database is treated as a dedicated conceptual subsystem in `episodes/11-ratdb.md`; input/output are separately modeled in `episodes/09-output.md` and `episodes/10-input.md`.

#### Build Runtime and Site Generation
The repository uses The Carpentries Workbench/Sandpaper publishing stack, evidenced by `config.yaml`, `FIXME.Rproj`, and the Sandpaper workflows. The material runtime is therefore an R-project-backed lesson build that transforms Markdown and configuration into a static site. Generated-site expectations and local site context are documented in `site/README.md`.

#### Automation and Deployment
GitHub Actions is the operational boundary for repository events and site lifecycle. The principal publishing workflow is `.github/workflows/sandpaper-main.yaml`; workflow maintenance and cache refresh are handled by `.github/workflows/update-workflows.yaml` and `.github/workflows/update-cache.yaml`. Pull-request automation is split into receive, preflight, comment, close-signal, and branch-removal workflows under `.github/workflows/`, providing CI feedback and repository hygiene rather than application runtime behavior.

#### Governance and Reuse
The repository is derived from a Workbench lesson template and is intended to be configured and published via GitHub Pages. Contribution, citation, conduct, and licensing boundaries are represented by `CONTRIBUTING.md`, `CITATION.cff`, `CODE_OF_CONDUCT.md`, and `LICENSE.md`; these govern the educational artifact rather than its lesson content pipeline.

Main entry points: [`.github/workflows/sandpaper-main.yaml`](https://github.com/rat-pac/ratpac2-tutorial/blob/main/.github/workflows/sandpaper-main.yaml) (Sandpaper publish workflow), [`episodes/11-ratdb.md`](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/11-ratdb.md) (RAT database), [`episodes/00-setup.md`](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/00-setup.md) (Setup), [`episodes/01-rat-macro.md`](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/01-rat-macro.md) (RAT macros)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_curriculum["Lesson Curriculum"]
  node_landing["Lesson landing page<br/>lesson entry<br/>[index.md]"]
  node_setup["Setup<br/>episode<br/>[00-setup.md]"]
  node_macro["RAT macros<br/>episode<br/>[01-rat-macro.md]"]
  node_generators["Generators<br/>episode<br/>[02-generators.md]"]
  node_geometry["Detector geometry<br/>episode"]
  node_production["Photon production<br/>episode"]
  node_propagation["Photon propagation<br/>episode"]
  node_detection["Photon detection<br/>episode"]
  node_processors["Processors<br/>episode<br/>[07-processors.md]"]
  node_fitters["Fitters<br/>episode<br/>[08-fitters.md]"]
  node_output["Output<br/>episode<br/>[09-output.md]"]
  node_input["Input<br/>episode<br/>[10-input.md]"]
  node_ratdb[("RAT database<br/>episode<br/>[11-ratdb.md]")]
  node_tests["RAT tests<br/>episode<br/>[13-rattests.md]"]
  node_analysis["Analysis<br/>episode<br/>[14-analysis.md]"]
  node_private["Private experiment<br/>restricted episode"]
  node_misc["Miscellaneous topics<br/>supplementary episode<br/>[15-misc.md]"]
end

subgraph group_publishing["Site Publishing"]
  node_metadata["Lesson metadata<br/>Workbench config<br/>[config.yaml]"]
  node_rproject["R build project<br/>R project<br/>[FIXME.Rproj]"]
  node_publisher{{"Sandpaper publish workflow<br/>GitHub Actions"}}
  node_site["Generated site guidance<br/>site documentation<br/>[README.md]"]
end

node_governance["Contribution and licensing<br/>governance documents<br/>[CONTRIBUTING.md]"]

node_landing -->|"begins curriculum"| node_setup
node_setup -->|"then"| node_macro
node_macro -->|"then"| node_generators
node_generators -->|"then"| node_geometry
node_geometry -->|"then"| node_production
node_production -->|"then"| node_propagation
node_propagation -->|"then"| node_detection
node_detection -->|"then"| node_processors
node_processors -->|"then"| node_fitters
node_fitters -->|"then"| node_output
node_output -->|"then"| node_input
node_input -->|"then"| node_ratdb
node_ratdb -->|"then"| node_tests
node_tests -->|"then"| node_analysis
node_ratdb -.->|"restricted extension"| node_private
node_analysis -.->|"supplementary topics"| node_misc
node_metadata -->|"configures"| node_publisher
node_rproject -->|"build runtime"| node_publisher
node_publisher -->|"publishes static site"| node_site
node_governance -.->|"governs repository delivery"| node_publisher

click node_landing "https://github.com/rat-pac/ratpac2-tutorial/blob/main/index.md"
click node_setup "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/00-setup.md"
click node_macro "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/01-rat-macro.md"
click node_generators "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/02-generators.md"
click node_geometry "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/03-detector-geometry.md"
click node_production "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/04-photon-production.md"
click node_propagation "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/05-photon-propagation.md"
click node_detection "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/06-photon-detection.md"
click node_processors "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/07-processors.md"
click node_fitters "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/08-fitters.md"
click node_output "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/09-output.md"
click node_input "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/10-input.md"
click node_ratdb "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/11-ratdb.md"
click node_tests "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/13-rattests.md"
click node_analysis "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/14-analysis.md"
click node_private "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/12-private-experiment.md"
click node_misc "https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/15-misc.md"
click node_metadata "https://github.com/rat-pac/ratpac2-tutorial/blob/main/config.yaml"
click node_rproject "https://github.com/rat-pac/ratpac2-tutorial/blob/main/FIXME.Rproj"
click node_publisher "https://github.com/rat-pac/ratpac2-tutorial/blob/main/.github/workflows/sandpaper-main.yaml"
click node_site "https://github.com/rat-pac/ratpac2-tutorial/blob/main/site/README.md"
click node_governance "https://github.com/rat-pac/ratpac2-tutorial/blob/main/CONTRIBUTING.md"

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_landing,node_setup,node_macro,node_generators,node_geometry,node_production,node_propagation,node_detection,node_processors,node_fitters,node_output,node_input,node_ratdb,node_tests,node_analysis,node_private,node_misc toneBlue
class node_metadata,node_rproject,node_publisher,node_site toneAmber
class node_governance toneNeutral
```

## Components

### Lesson Curriculum

Ordered Markdown episodes form the instructional flow.

- [Lesson landing page](https://github.com/rat-pac/ratpac2-tutorial/blob/main/index.md): lesson entry · Starting point for learners and supporting lesson navigation. · `index.md`
- [Setup](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/00-setup.md): episode · `episodes/00-setup.md`
- [RAT macros](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/01-rat-macro.md): episode · `episodes/01-rat-macro.md`
- [Generators](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/02-generators.md): episode · `episodes/02-generators.md`
- [Detector geometry](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/03-detector-geometry.md): episode · `episodes/03-detector-geometry.md`
- [Photon production](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/04-photon-production.md): episode · `episodes/04-photon-production.md`
- [Photon propagation](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/05-photon-propagation.md): episode · `episodes/05-photon-propagation.md`
- [Photon detection](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/06-photon-detection.md): episode · `episodes/06-photon-detection.md`
- [Processors](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/07-processors.md): episode · `episodes/07-processors.md`
- [Fitters](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/08-fitters.md): episode · `episodes/08-fitters.md`
- [Output](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/09-output.md): episode · `episodes/09-output.md`
- [Input](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/10-input.md): episode · `episodes/10-input.md`
- [RAT database](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/11-ratdb.md): episode · Dedicated database conceptual subsystem. · `episodes/11-ratdb.md`
- [RAT tests](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/13-rattests.md): episode · `episodes/13-rattests.md`
- [Analysis](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/14-analysis.md): episode · `episodes/14-analysis.md`
- [Private experiment](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/12-private-experiment.md): restricted episode · Boundary for experiment-specific material. · `episodes/12-private-experiment.md`
- [Miscellaneous topics](https://github.com/rat-pac/ratpac2-tutorial/blob/main/episodes/15-misc.md): supplementary episode · Material outside the primary progression. · `episodes/15-misc.md`

### Site Publishing

Workbench build and GitHub Actions publishing boundary.

- [Lesson metadata](https://github.com/rat-pac/ratpac2-tutorial/blob/main/config.yaml): Workbench config · Site-wide lesson metadata and publishing configuration. · `config.yaml`
- [R build project](https://github.com/rat-pac/ratpac2-tutorial/blob/main/FIXME.Rproj): R project · R-backed Workbench lesson build context. · `FIXME.Rproj`
- [Sandpaper publish workflow](https://github.com/rat-pac/ratpac2-tutorial/blob/main/.github/workflows/sandpaper-main.yaml): GitHub Actions · Builds Markdown lesson material into the static published site. · `.github/workflows/sandpaper-main.yaml`
- [Generated site guidance](https://github.com/rat-pac/ratpac2-tutorial/blob/main/site/README.md): site documentation · Documents local generated-site expectations. · `site/README.md`

### Other components

- [Contribution and licensing](https://github.com/rat-pac/ratpac2-tutorial/blob/main/CONTRIBUTING.md): governance documents · Defines contribution, citation, conduct, and license boundaries. · `CONTRIBUTING.md`

## Connections

- Lesson landing page → Setup: begins curriculum
- Setup → RAT macros: then
- RAT macros → Generators: then
- Generators → Detector geometry: then
- Detector geometry → Photon production: then
- Photon production → Photon propagation: then
- Photon propagation → Photon detection: then
- Photon detection → Processors: then
- Processors → Fitters: then
- Fitters → Output: then
- Output → Input: then
- Input → RAT database: then
- RAT database → RAT tests: then
- RAT tests → Analysis: then
- RAT database → Private experiment: restricted extension
- Analysis → Miscellaneous topics: supplementary topics
- Lesson metadata → Sandpaper publish workflow: configures
- R build project → Sandpaper publish workflow: build runtime
- Sandpaper publish workflow → Generated site guidance: publishes static site
- Contribution and licensing → Sandpaper publish workflow: governs repository delivery
