From 67e0fdd8a1a79d2fc5e44a52862cf4fece902c3d Mon Sep 17 00:00:00 2001 From: Kristina Riemer Date: Fri, 13 Sep 2024 10:01:44 -0700 Subject: [PATCH 1/3] Update collection methods and CPUE plot figure legend --- app/app.R | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/app/app.R b/app/app.R index 277911a..fcb2156 100644 --- a/app/app.R +++ b/app/app.R @@ -54,7 +54,9 @@ metrics <- read_csv('standardized_fish_data.csv') %>% factor(levels = c("S-Q", "Q-P", "P-M", "M-T", "T"))) %>% mutate(method = str_replace_all(method, " ", "_"), waterbody_type = str_replace_all(waterbody_type, " ", "_"), - metric = str_replace_all(metric, "CPUE distance", "CPUE")) + metric = str_replace_all(metric, "CPUE distance", "CPUE")) %>% + filter(method %in% c("boat_electrofishing", "raft_electrofishing", "gill_net_fall", "gill_net_spring", "drifting_trammel_net", "large_catfish_hoopnet", "bag_seine", "stream_seine", "backpack_electrofishing", "tow_barge_electrofishing")) + # Develop vectors of unique entries uni.type <- c("North America", "Ecoregion", "State/Province") uni.area <- sort(unique(metrics$area)) @@ -238,7 +240,7 @@ We used this information to achieve our goals of maximizing use and providing si p("Relative weight by proportional size distribution categories. Points indicate means and lines indicate standard error."), hr(), plotDownloadUI("CPUE_plot", height = "200px"), - p("Catch per unit effort. The box represents the middle 50% of the standard data with the median value indicated by the line inside. The whiskers extend to the smallest and largest values within 1.5 times the inter quartile range and any individual points outside are outliers.") + p("Catch per unit effort. The box represents the middle 50% of the standard data with the median value indicated by the line inside. The whiskers extend to the smallest and largest values within 1.5 times the inter quartile range and any individual points outside are outliers. CPUE units depend on collection method: boat and raft electrofishing are fish per hour, gill net is fish per net nights, drifting trammel net is fish per 100-m drift, large catfish hoopnet is fish per 24 hour set, bag seine is fish per 0.25 arc (small standing waters) or 0.5 arc (rivers), stream seine is fish per 10-15m haul, and backpack and tow barge electrofishing are fish per 100m².") ) ) ), @@ -275,7 +277,7 @@ We used this information to achieve our goals of maximizing use and providing si p("Relative weight by proportional size distribution categories. Points indicate means and lines indicate standard error."), hr(), plotDownloadUI("CPUE_plot_UU", height = "200px"), - p("Catch per unit effort. The box represents the middle 50% of the standard data with the median value indicated by the line inside. The whiskers extend to the smallest and largest values within 1.5 times the inter quartile range and any individual points outside are outliers. The dashed line represents CPUE for the waterbody. ")) + p("Catch per unit effort. The box represents the middle 50% of the standard data with the median value indicated by the line inside. The whiskers extend to the smallest and largest values within 1.5 times the inter quartile range and any individual points outside are outliers. The dashed line represents CPUE for the waterbody. CPUE units depend on collection method: boat and raft electrofishing are fish per hour, gill net is fish per net nights, drifting trammel net is fish per 100-m drift, large catfish hoopnet is fish per 24 hour set, bag seine is fish per 0.25 arc (small standing waters) or 0.5 arc (rivers), stream seine is fish per 10-15m haul, and backpack and tow barge electrofishing are fish per 100m².")) ) ) @@ -361,10 +363,10 @@ server <- function(input, output) { ) # Duplicate records for all types - uu_state <- uu %>% - select(-one_of("ecoregion")) %>% - mutate(type = "state") %>% - rename(area = state) + uu_state <- uu %>% + select(-one_of("ecoregion")) %>% + mutate(type = "state") %>% + rename(area = state) if ("ecoregion" %in% names(uu)) { uu_ecoregion <- uu %>% @@ -388,7 +390,7 @@ server <- function(input, output) { if(exists("uu_ecoregion")){ rm(uu_ecoregion) } - + print(uu_all) }) @@ -405,7 +407,7 @@ server <- function(input, output) { type == "state" ~ "State/Province")) %>% slice(match(c("North America", "Ecoregion", "State/Province"), types)) %>% pull(types) - + radioGroupButtons(inputId = "typechoice3", label = "Show data by:", choices = temp, @@ -711,10 +713,10 @@ server <- function(input, output) { print(uu) # Duplicate records for all types - uu_state <- uu %>% - select(-one_of("ecoregion")) %>% - mutate(type = "state") %>% - rename(area = state) + uu_state <- uu %>% + select(-one_of("ecoregion")) %>% + mutate(type = "state") %>% + rename(area = state) if ("ecoregion" %in% names(uu)) { uu_ecoregion <- uu %>% @@ -722,7 +724,7 @@ server <- function(input, output) { mutate(type = "ecoregion") %>% rename(area = ecoregion) } - + uu_all <- uu %>% select(-state) %>% select(-one_of("ecoregion")) %>% From c0621aaa508c948c115cb3e33b52d409194c761f Mon Sep 17 00:00:00 2001 From: Kristina Riemer Date: Fri, 13 Sep 2024 11:31:46 -0700 Subject: [PATCH 2/3] Add more text to guide user upload process --- app/app.R | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/app.R b/app/app.R index fcb2156..150e9f1 100644 --- a/app/app.R +++ b/app/app.R @@ -270,6 +270,9 @@ We used this information to achieve our goals of maximizing use and providing si uiOutput("instructions"), DTOutput("example")), tabPanel("Comparisons", + br(), + h6("If no plots are displayed, upload a dataset to generate comparison plots."), + br(), plotDownloadUI("LF_plot_UU"), p("Proportional size distribution length frequency. Black lines indicate standard error."), hr(), @@ -350,6 +353,12 @@ server <- function(input, output) { inFile <- input$upload uu <- read_csv(inFile$datapath) + invalid_species_names <- uu %>% select(common_name) %>% filter(common_name %nin% unique(metrics$common_name)) %>% pull() + + if(any(is.na(uu))){ + validate("Uploaded dataset must have no empty rows") + } + # Return informative messages if uu data format is incorrect validate( need("state" %in% colnames(uu), "Uploaded dataset is missing state column"), @@ -359,7 +368,7 @@ server <- function(input, output) { need("year" %in% colnames(uu), "Uploaded dataset is missing year column"), need(n_distinct(uu$state) == 1, "State column should contain only one state"), need(n_distinct(uu$waterbody_name) == 1, "Waterbody column should contain only one name"), - #need(uu$common_name %in% FSA::PSDlit$species, "Species name must match one in the provided list in instructions tab") + need(length(invalid_species_names) == 0, paste0("Species name must match one in the provided list in instructions tab. These names are not valid: ", invalid_species_names)) ) # Duplicate records for all types From ba310e9acff0ae584422e69f8324bbe1921d1c2d Mon Sep 17 00:00:00 2001 From: Kristina Riemer Date: Fri, 13 Sep 2024 12:23:17 -0700 Subject: [PATCH 3/3] Add link checker GH Action --- .github/workflows/links.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/links.yml diff --git a/.github/workflows/links.yml b/.github/workflows/links.yml new file mode 100644 index 0000000..21c7492 --- /dev/null +++ b/.github/workflows/links.yml @@ -0,0 +1,29 @@ +# action: https://github.com/lycheeverse/lychee-action +# lychee: https://github.com/lycheeverse/lychee + +name: Links + +on: + pull_request: + workflow_dispatch: + schedule: + #first of every month + - cron: "0 0 1 * *" + +jobs: + linkChecker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Link Checker + id: lychee + uses: lycheeverse/lychee-action@v1 + + - name: Create Issue From File + if: ${{ failure() && github.event_name != 'pull_request' }} + uses: peter-evans/create-issue-from-file@v5 + with: + title: Link Checker Report + content-filepath: ./lychee/out.md + labels: report, automated issue \ No newline at end of file