Skip to content

Commit

Permalink
Create working example and resources for users (#54)
Browse files Browse the repository at this point in the history
* feat(README): change example to petrale

Changing to a working example in read me that mimic that of a current stock assessment. The files resulting from the example and rendered report need to be added as their own example in a folder

* update(example): change README so users can run  petrale example

# Summary

- add raw and converted petrale output to data folder
- ran usethis::use_data() creating structure for the example
- updated documentation

* fix:(create_template): add preamble

- read in converted output in chunk
- create place for pre-loaded quantities to reference later in the document

* update(test-add_chunk): correct notes in test

* Fix(readme): example needed csv file

* Update(readme): adjust for new section names

* update(website): change set up of pkgdown website

* Update(pkgdown.yml): include tutorial

* feature(add tutorial): demo in shiny app

Might need to move folders - pushing now in order to switch branches ok

* remove(tutorial): move materials to asar-demo repo and host there

* update(pkgdown): add tutorial link to site

* update(README): add link for tutorial in examples

* Update(pkgdown yml): Reorder top nav bar and have a drop down manual for all vignettes instead

* Remove example data - moved to asar-demo

* fix(create_template): replaced params_chunk with preamble
  • Loading branch information
Schiano-NOAA authored Oct 24, 2024
1 parent 890a0c9 commit d6fcf1f
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 33 deletions.
3 changes: 3 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ Config/testthat/parallel: true
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.2
Depends:
R (>= 2.10)
LazyData: true
21 changes: 13 additions & 8 deletions R/create_template.R
Original file line number Diff line number Diff line change
Expand Up @@ -651,12 +651,17 @@ create_template <- function(

# print("_______Standardized output data________")

# Add in quantities and data R chunk
params_chunk <- add_chunk(
glue::glue(
"output <- read.csv('", resdir, "/", model_results, "') \n \n",
"# Reference quantities \n",
"# sbtgt \n"
# Add preamble
# add in quantities and output data R chunk
preamble <- add_chunk(
paste0(
"output <- utils::read.csv('",
ifelse(convert_output,
paste0(subdir, "/", species, "_", "_std_res_", year, ".csv"),
paste0(resdir, "/", model_results)), "') \n",
"# Call reference points and quantities below \n",
"# sbmsy = 10000 \n",
"# fmsy = 0.3 \n"
),
label = "output_and_quantities"
)
Expand Down Expand Up @@ -784,7 +789,7 @@ create_template <- function(
# Combine template sections
report_template <- paste(
yaml,
params_chunk,
preamble,
citation,
sections,
sep = "\n"
Expand Down Expand Up @@ -940,7 +945,7 @@ create_template <- function(
# Combine template sections
report_template <- paste(
yaml,
# ass_output,
# preamble,
citation,
sections,
sep = "\n"
Expand Down
41 changes: 29 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,43 @@ remotes::install_github("nmfs-ost/satf")

## Example

The following is a basic example to render a stock assessment report for a particular region in the U.S.:
The following code will allow the user to replicate the [2023 petrale sole stock assessment](https://www.pcouncil.org/documents/2024/02/status-of-petrale-sole-eopsetta-jordanialong-the-u-s-west-coast-in-2023.pdf/) produced by the NWFSC and made available by the Pacific Fisheries Management Council. The assessment model files are also available on the PFMC's website. A (DRAFT) tutorial for using `asar` can be found [here](https://connect.fisheries.noaa.gov/asar_tutorial/).

The SS3 Report.sso files was converted using the following code:

```r
asar::convert_output(
output_file = "Report.sso",
outdir = "data",
model = "ss3",
file_save = TRUE,
save_name = "petrale_convert_output")
```

In this function, the users have the option to convert output files to a standardized framework from either SS3 (Report.sso) or BAM (.rdat) output files. The converted output was saved as an Rdata file and can be found in the example folder in this repository.

To proceed, the user should then run the following:

```r
asar::create_template(
new_template = TRUE,
format = "pdf",
office = "NWFSC",
species = "Dover sole",
spp_latin = "Pomatomus saltatrix",
year = 2010,
author = c("John Snow", "Danny Phantom", "Patrick Star"),
region = "U.S. West Coast",
species = "Petrale sole",
spp_latin = "Eopsetta jordani",
year = 2023,
author = c("Ian G. Taylor", "Vladlena Gertseva", "Nick Tolimieri"),
include_affiliation = TRUE,
resdir = "C:/Users/Documents/Example_Files",
model_results = "Report.sso",
simple_affiliation = FALSE,
param_names = c("nf","sf"),
param_values = c("North fleet", "South fleet"),
resdir = "data",
model_results = "Petrale_sole_std_res_2023.csv",
model = "SS3"
)
```

Note: This is only an example. The parameters in the example do not convey accurate stock assessment information.
Note: The output of this report is an example based on a real stock assessment. Please refer to the link in the beginning of this section for the full assessment report.

## Testing

Expand All @@ -65,14 +83,13 @@ This is a modularized template, there is no need to make any edits to the skelet
- Executive Summary
- Introduction
- Data
- Modeling Approach
- Results
- Projections
- Assessment
- Discussion
- Acknowledgments
- References
- Tables
- Figures
- Appendix

Please leave an issue for any bugs or suggestions to improve the package during testing on the [Issues Page](https://github.com/Schiano-NOAA/ASAR/issues). Please remember that this package is currently in development and we do not project to release version 1.0 until December 2024. Thank you for helping us improve this package!

Expand Down
63 changes: 50 additions & 13 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,57 @@
url: nmfs-ost.github.io/asar/

template:
bootstrap: 5
navbar:
structure:
left:
- home
- reference
- sourcecode
- tutorial
- articles
- documents
- news
right:
- issue
- github

development:
mode: auto
components:
home:
icon: fas fa-home fa-lg
href: index.html

home:
title: Automated Stock Assessment Reporting
reference:
text: Functions
icon: far fa-file-code fa-lg
href: reference/index.html

reference:
sourcecode:
text: Source Code
icon: fab fa-github fa-lg
href: https://github.com/nmfs-ost/asar

articles:
- title: Manual
contents:
- manual
- regional_workflows
- markdown_notation
issue:
text: Issues
icon: fas fa-question-circle fa-lg
href: https://github.com/nmfs-fish-tools/pkgdownTemplate/issues/

articles:
text: Articles
icon: fas fa-file-contract fa-lg
menu:
- text: Manual
href: articles/manual.html
- text: Markdown Notation
href: articles/markdown_notation.html
- text: Regional Workflows
href: articles/regional_workflows.html

documents:
text: References
icon: fas fa-book fa-lg
menu:
- text: Petrale Example
href: SAR_USWC_Petrale_sole_skeleton.pdf

tutorial:
text: Tutorial
href: https://connect.fisheries.noaa.gov/asar_tutorial/

0 comments on commit d6fcf1f

Please sign in to comment.