How shcaba/ss-dl-tool works
Project Type and Purpose
• This is a full-stack R/Shiny application (“The Stock Assessment Continuum Tool”) whose UI (ui.r + www/) and server logic (server.r, global.r, Functions.r) run inside an R session (optionally inside the provided devcontainer).
• Its purpose is to build Stock Synthesis (SS3) input files, call SS3 executables, parse SS3 outputs with the r4ss package, and present interactive plots, tables, and bookmarked scenarios to fisheries scientists via a web interface.
Top-Level File Structure and Architectural Patterns
• .devcontainer/ – Docker dev environment (VS Code Remote)
• ui.r, server.r, global.r, Functions.r – Shiny’s MVC pattern:
• global.r loads libraries & shared data
• ui.r defines inputs, panels and placeholder outputs
• server.r + Functions.r contain reactive logic, file I/O, process-spawning
• Example data files/, SSS_files/, SS_LB_files/, SS_LO_F_files/ – file-system “data store”
• Scenarios/ – runtime folders for user model runs (SS3 input, output, bookmarks, plots, tables)
• www/ – static assets (HTML docs, CSS, Phasing/PDFs) served by Shiny
• rsconnect/ – deployment metadata for shinyapps.io
Core Components & Interactions
a. Frontend (Shiny UI)
• Elements in ui.r + www/ (HTML/CSS assets) present controls (data upload, sliders, buttons) and view panels for plots/tables.
b. Backend (Shiny Server logic)
• Reactive handlers in server.r orchestrate workflows:
1. Read user inputs or example data (.csv/.rds)
2. Call SS3 executables (spawn process in SSS_files/ or SS_LB_files/) with generated control/dat files
3. Monitor completion, read Report.sso and scenario_input/input.rds
4. Use r4ss to parse outputs and generate ggplot2/flextable results
5. Write plots/tables to Scenarios/<run>/plots and Scenarios/<run>/tables
6. Feed results back to the UI for rendering (HTMLwidgets or images)
c. External Services & Tools
• SS3 (C++ executables) invoked as child processes
• r4ss package to parse SS3 results
• Optional parallel/future backends for concurrent runs
• shinyapps.io or local Shiny Server for hosting
Architectural Patterns & Principles
• MVC separation: global (model), server (controller), ui (view)
• File-system oriented persistence: no database; directories per scenario + bookmarking via .rds
• Process-isolation: each SS3 run in its own subdirectory under Scenarios
• Extensibility: SS3 configuration templates in SSS_files and example data in Example data files
• Containerization support via .devcontainer for reproducible environments