Skip to content

Commit d335f98

Browse files
Merge pull request #44 from cct-datascience/fixes
Make last changes
2 parents 70deb25 + ba310e9 commit d335f98

File tree

2 files changed

+55
-15
lines changed

2 files changed

+55
-15
lines changed

.github/workflows/links.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# action: https://github.com/lycheeverse/lychee-action
2+
# lychee: https://github.com/lycheeverse/lychee
3+
4+
name: Links
5+
6+
on:
7+
pull_request:
8+
workflow_dispatch:
9+
schedule:
10+
#first of every month
11+
- cron: "0 0 1 * *"
12+
13+
jobs:
14+
linkChecker:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Link Checker
20+
id: lychee
21+
uses: lycheeverse/lychee-action@v1
22+
23+
- name: Create Issue From File
24+
if: ${{ failure() && github.event_name != 'pull_request' }}
25+
uses: peter-evans/create-issue-from-file@v5
26+
with:
27+
title: Link Checker Report
28+
content-filepath: ./lychee/out.md
29+
labels: report, automated issue

app/app.R

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,9 @@ metrics <- read_csv('standardized_fish_data.csv') %>%
5454
factor(levels = c("S-Q", "Q-P", "P-M", "M-T", "T"))) %>%
5555
mutate(method = str_replace_all(method, " ", "_"),
5656
waterbody_type = str_replace_all(waterbody_type, " ", "_"),
57-
metric = str_replace_all(metric, "CPUE distance", "CPUE"))
57+
metric = str_replace_all(metric, "CPUE distance", "CPUE")) %>%
58+
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"))
59+
5860
# Develop vectors of unique entries
5961
uni.type <- c("North America", "Ecoregion", "State/Province")
6062
uni.area <- sort(unique(metrics$area))
@@ -238,7 +240,7 @@ We used this information to achieve our goals of maximizing use and providing si
238240
p("Relative weight by proportional size distribution categories. Points indicate means and lines indicate standard error."),
239241
hr(),
240242
plotDownloadUI("CPUE_plot", height = "200px"),
241-
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.")
243+
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².")
242244
)
243245
)
244246
),
@@ -268,14 +270,17 @@ We used this information to achieve our goals of maximizing use and providing si
268270
uiOutput("instructions"),
269271
DTOutput("example")),
270272
tabPanel("Comparisons",
273+
br(),
274+
h6("If no plots are displayed, upload a dataset to generate comparison plots."),
275+
br(),
271276
plotDownloadUI("LF_plot_UU"),
272277
p("Proportional size distribution length frequency. Black lines indicate standard error."),
273278
hr(),
274279
plotDownloadUI("RW_plot_UU"),
275280
p("Relative weight by proportional size distribution categories. Points indicate means and lines indicate standard error."),
276281
hr(),
277282
plotDownloadUI("CPUE_plot_UU", height = "200px"),
278-
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. "))
283+
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²."))
279284
)
280285
)
281286

@@ -348,6 +353,12 @@ server <- function(input, output) {
348353
inFile <- input$upload
349354
uu <- read_csv(inFile$datapath)
350355

356+
invalid_species_names <- uu %>% select(common_name) %>% filter(common_name %nin% unique(metrics$common_name)) %>% pull()
357+
358+
if(any(is.na(uu))){
359+
validate("Uploaded dataset must have no empty rows")
360+
}
361+
351362
# Return informative messages if uu data format is incorrect
352363
validate(
353364
need("state" %in% colnames(uu), "Uploaded dataset is missing state column"),
@@ -357,14 +368,14 @@ server <- function(input, output) {
357368
need("year" %in% colnames(uu), "Uploaded dataset is missing year column"),
358369
need(n_distinct(uu$state) == 1, "State column should contain only one state"),
359370
need(n_distinct(uu$waterbody_name) == 1, "Waterbody column should contain only one name"),
360-
#need(uu$common_name %in% FSA::PSDlit$species, "Species name must match one in the provided list in instructions tab")
371+
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))
361372
)
362373

363374
# Duplicate records for all types
364-
uu_state <- uu %>%
365-
select(-one_of("ecoregion")) %>%
366-
mutate(type = "state") %>%
367-
rename(area = state)
375+
uu_state <- uu %>%
376+
select(-one_of("ecoregion")) %>%
377+
mutate(type = "state") %>%
378+
rename(area = state)
368379

369380
if ("ecoregion" %in% names(uu)) {
370381
uu_ecoregion <- uu %>%
@@ -388,7 +399,7 @@ server <- function(input, output) {
388399
if(exists("uu_ecoregion")){
389400
rm(uu_ecoregion)
390401
}
391-
402+
392403
print(uu_all)
393404

394405
})
@@ -405,7 +416,7 @@ server <- function(input, output) {
405416
type == "state" ~ "State/Province")) %>%
406417
slice(match(c("North America", "Ecoregion", "State/Province"), types)) %>%
407418
pull(types)
408-
419+
409420
radioGroupButtons(inputId = "typechoice3",
410421
label = "Show data by:",
411422
choices = temp,
@@ -711,18 +722,18 @@ server <- function(input, output) {
711722
print(uu)
712723

713724
# Duplicate records for all types
714-
uu_state <- uu %>%
715-
select(-one_of("ecoregion")) %>%
716-
mutate(type = "state") %>%
717-
rename(area = state)
725+
uu_state <- uu %>%
726+
select(-one_of("ecoregion")) %>%
727+
mutate(type = "state") %>%
728+
rename(area = state)
718729

719730
if ("ecoregion" %in% names(uu)) {
720731
uu_ecoregion <- uu %>%
721732
select(-state) %>%
722733
mutate(type = "ecoregion") %>%
723734
rename(area = ecoregion)
724735
}
725-
736+
726737
uu_all <- uu %>%
727738
select(-state) %>%
728739
select(-one_of("ecoregion")) %>%

0 commit comments

Comments
 (0)