# gledguri/smart-edna-sampling architecture

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

- Interactive diagram: https://gitdiagram.com/gledguri/smart-edna-sampling
- Repository: https://github.com/gledguri/smart-edna-sampling
- Video tour (about a minute): https://gitdiagram.com/gledguri/smart-edna-sampling/video

## Overview

This repository supports two related products: an interactive eDNA survey planner and an analysis workflow studying how sampling effort affects Gaussian Process (GP) prediction and spatial-parameter recovery. The documented analysis runs from archived inputs through simulated and empirical-data model fitting, compiled results, and manuscript figures. The README describes the planner’s user-facing behavior, but no source excerpts were provided, so its internal implementation and connections to the analysis are not inferred.

Main entry points: [`Code/00_Download_data.R`](https://github.com/gledguri/smart-edna-sampling/blob/main/Code/00_Download_data.R) (Download inputs), [`Code/01_GP_sim.R`](https://github.com/gledguri/smart-edna-sampling/blob/main/Code/01_GP_sim.R) (Spatial GP simulations), [`Output`](https://github.com/gledguri/smart-edna-sampling/tree/main/Output) (Simulation outputs), [`Data/edna_data.rds`](https://github.com/gledguri/smart-edna-sampling/blob/main/Data/edna_data.rds) (Empirical eDNA)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_planner["Survey planner"]
  node_planner_app["Interactive planner"]
end

subgraph group_analysis["Sampling analysis"]
  node_download["Download inputs<br/>[00_Download_data.R]"]
  node_empirical[("Empirical eDNA<br/>[edna_data.rds]")]
  node_prediction_grid[("Prediction grid<br/>[pred_data.rds]")]
end

subgraph group_modeling["GP modeling"]
  node_gp_sim["Spatial GP simulations<br/>[01_GP_sim.R]"]
  node_stan_model["Stan GP model<br/>[GP.stan]"]
  node_simulation_output[("Simulation outputs")]
end

subgraph group_results["Results and figures"]
  node_compile_results["Compile results<br/>[02_Data_manip.R]"]
  node_compiled_data[("Compiled results")]
  node_plot_figures["Manuscript figures<br/>[03_Plots.R]"]
  node_plots["Figure files"]
end

node_user(("Survey planner user"))
node_data_archive[("Zenodo archive")]

node_user -->|"uses"| node_planner_app
node_data_archive -->|"provides archive"| node_download
node_download -->|"downloads data"| node_empirical
node_download -->|"downloads data"| node_prediction_grid
node_download -->|"downloads output"| node_simulation_output
node_empirical -->|"thins and fits"| node_gp_sim
node_prediction_grid -->|"defines prediction grid"| node_gp_sim
node_gp_sim -->|"fits model"| node_stan_model
node_gp_sim -->|"saves results"| node_simulation_output
node_simulation_output -->|"collects outputs"| node_compile_results
node_compile_results -->|"writes data"| node_compiled_data
node_compiled_data -->|"reads data"| node_plot_figures
node_plot_figures -->|"saves figures"| node_plots

click node_planner_app "https://github.com/gledguri/smart-edna-sampling/blob/main/Code/eDNA_survey_planner_v4.R"
click node_download "https://github.com/gledguri/smart-edna-sampling/blob/main/Code/00_Download_data.R"
click node_empirical "https://github.com/gledguri/smart-edna-sampling/blob/main/Data/edna_data.rds"
click node_prediction_grid "https://github.com/gledguri/smart-edna-sampling/blob/main/Data/pred_data.rds"
click node_gp_sim "https://github.com/gledguri/smart-edna-sampling/blob/main/Code/01_GP_sim.R"
click node_stan_model "https://github.com/gledguri/smart-edna-sampling/blob/main/Code/GP.stan"
click node_simulation_output "https://github.com/gledguri/smart-edna-sampling/tree/main/Output"
click node_compile_results "https://github.com/gledguri/smart-edna-sampling/blob/main/Code/02_Data_manip.R"
click node_compiled_data "https://github.com/gledguri/smart-edna-sampling/tree/main/Output/Complete_db"
click node_plot_figures "https://github.com/gledguri/smart-edna-sampling/blob/main/Code/03_Plots.R"
click node_plots "https://github.com/gledguri/smart-edna-sampling/tree/main/Plots"

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_planner_app,node_user toneBlue
class node_download,node_empirical,node_prediction_grid,node_data_archive toneAmber
class node_gp_sim,node_stan_model,node_simulation_output toneMint
class node_compile_results,node_compiled_data,node_plot_figures,node_plots toneRose
```

## Components

### Survey planner

- [Interactive planner](https://github.com/gledguri/smart-edna-sampling/blob/main/Code/eDNA_survey_planner_v4.R): `Code/eDNA_survey_planner_v4.R`

### Sampling analysis

- [Download inputs](https://github.com/gledguri/smart-edna-sampling/blob/main/Code/00_Download_data.R): `Code/00_Download_data.R`
- [Empirical eDNA](https://github.com/gledguri/smart-edna-sampling/blob/main/Data/edna_data.rds): `Data/edna_data.rds`
- [Prediction grid](https://github.com/gledguri/smart-edna-sampling/blob/main/Data/pred_data.rds): `Data/pred_data.rds`

### GP modeling

- [Spatial GP simulations](https://github.com/gledguri/smart-edna-sampling/blob/main/Code/01_GP_sim.R): `Code/01_GP_sim.R`
- [Stan GP model](https://github.com/gledguri/smart-edna-sampling/blob/main/Code/GP.stan): `Code/GP.stan`
- [Simulation outputs](https://github.com/gledguri/smart-edna-sampling/tree/main/Output): `Output`

### Results and figures

- [Compile results](https://github.com/gledguri/smart-edna-sampling/blob/main/Code/02_Data_manip.R): `Code/02_Data_manip.R`
- [Compiled results](https://github.com/gledguri/smart-edna-sampling/tree/main/Output/Complete_db): `Output/Complete_db`
- [Manuscript figures](https://github.com/gledguri/smart-edna-sampling/blob/main/Code/03_Plots.R): `Code/03_Plots.R`
- [Figure files](https://github.com/gledguri/smart-edna-sampling/tree/main/Plots): `Plots`

### Other components

- **Survey planner user**
- **Zenodo archive**

## Connections

- Survey planner user → Interactive planner: uses (evidence: `README.md`)
- Zenodo archive → Download inputs: provides archive (evidence: `README.md`)
- Download inputs → Empirical eDNA: downloads data (evidence: `README.md`)
- Download inputs → Prediction grid: downloads data (evidence: `README.md`)
- Download inputs → Simulation outputs: downloads output (evidence: `README.md`)
- Empirical eDNA → Spatial GP simulations: thins and fits (evidence: `README.md`)
- Prediction grid → Spatial GP simulations: defines prediction grid (evidence: `README.md`)
- Spatial GP simulations → Stan GP model: fits model (evidence: `README.md`)
- Spatial GP simulations → Simulation outputs: saves results (evidence: `README.md`)
- Simulation outputs → Compile results: collects outputs (evidence: `README.md`)
- Compile results → Compiled results: writes data (evidence: `README.md`)
- Compiled results → Manuscript figures: reads data (evidence: `README.md`)
- Manuscript figures → Figure files: saves figures (evidence: `README.md`)
