Skip to content

Commit edea320

Browse files
committed
all data internal and create ci build for county data
1 parent 5c1f2d3 commit edea320

File tree

13 files changed

+90
-11
lines changed

13 files changed

+90
-11
lines changed

.github/workflows/build.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
- master
6+
schedule:
7+
- cron: "0 0 * * *"
8+
9+
name: build
10+
11+
jobs:
12+
render:
13+
name: build
14+
runs-on: ubuntu-latest
15+
env:
16+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
- uses: r-lib/actions/setup-r@v2
20+
with:
21+
extra-repositories: 'https://tbep-tech.r-universe.dev'
22+
- name: Setup R dependencies
23+
uses: r-lib/actions/setup-r-dependencies@v2
24+
with:
25+
packages: |
26+
here
27+
tbeptools
28+
29+
- name: Pull data
30+
run: Rscript -e 'source("R/build.R")'
31+
- name: Commit results
32+
run: |
33+
git config --local user.email "actions@github.com"
34+
git config --local user.name "GitHub Actions"
35+
git add -A
36+
git commit -m 'Re-build data' || echo "No changes to commit"
37+
git push origin || echo "No changes to commit"

R/build.R

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
library(tbeptools)
2+
3+
# EPC
4+
cat('EPC\n')
5+
xlsx <- tempfile(fileext = '.xlsx')
6+
fibdata <- read_importfib(xlsx, download_latest = TRUE)
7+
save(fibdata, file = here::here('data/fibdata.RData'), compress = 'xz')
8+
9+
# ESC
10+
cat('ESC\n')
11+
hcesdfibdata <- read_importwqp('21FLHESD_WQX', type = 'fib')
12+
save(hcesdfibdata, file = here::here('data/hcesdfibdata.RData'), compress = 'xz')
13+
14+
# Manatee County
15+
cat('manco\n')
16+
mancofibdata <- read_importwqp('21FLMANA_WQX', type = 'fib')
17+
save(mancofibdata, file = here::here('data/mancofibdata.RData'), compress = 'xz')
18+
19+
# Pasco County
20+
cat('pasco\n')
21+
pascofibdata <- read_importwqp('21FLPASC_WQX', type = 'fib')
22+
save(pascofibdata, file = here::here('data/pascofibdata.RData'), compress = 'xz')
23+
24+
# Polk County
25+
cat('polco\n')
26+
polcofibdata <- read_importwqp('21FLPOLK_WQX', type = 'fib')
27+
save(polcofibdata, file = here::here('data/polcofibdata.RData'), compress = 'xz')

R/global.R

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ box::use(
22
dplyr[`%>%`]
33
)
44

5-
data('enterodata', package = 'tbeptools')
6-
data('fibdata', package = 'tbeptools')
7-
data('hcesdfibdata', package = 'tbeptools')
8-
data('mancofibdata', package = 'tbeptools')
9-
data('pascofibdata', package = 'tbeptools')
10-
data('polcofibdata', package = 'tbeptools')
11-
data('catchprecip', package = 'tbeptools')
12-
data('tbsegdetail', package = 'tbeptools')
5+
6+
# all files from tbeptools, but saved locally so the image doesnt have to be recreated with data updates
7+
8+
# updated annually
9+
load(url('https://tbep-tech.github.io/fib-dash/data/enterodata.RData'))
10+
load(url('https://tbep-tech.github.io/fib-dash/data/catchprecip.RData'))
11+
12+
# updated by github actions
13+
load(url('https://tbep-tech.github.io/fib-dash/data/fibdata.RData'))
14+
load(url('https://tbep-tech.github.io/fib-dash/data/hcesdfibdata.RData'))
15+
load(url('https://tbep-tech.github.io/fib-dash/data/mancofibdata.RData'))
16+
load(url('https://tbep-tech.github.io/fib-dash/data/pascofibdata.RData'))
17+
load(url('https://tbep-tech.github.io/fib-dash/data/polcofibdata.RData'))
18+
19+
# never updated
20+
load(url('https://tbep-tech.github.io/data/tbsegdetail.RData'))
1321

1422
enterowetdry <- tbeptools::anlz_fibwetdry(enterodata, catchprecip, temporal_window = 2, wet_threshold = 0.5)
1523

@@ -22,6 +30,7 @@ yrmin4 <- 2018
2230
yrmin5 <- 2017
2331
yrmin6 <- 2017
2432
maxyr <- 2023
33+
epcmaxyr <- max(fibdata$yr)
2534

2635
lwid <- 1.5
2736

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# fib-dash
22

3+
[![build](https://github.com/tbep-tech/fib-dash/workflows/build/badge.svg)](https://github.com/tbep-tech/fib-dash/actions)
34
[![DOI](https://zenodo.org/badge/841089887.svg)](https://doi.org/10.5281/zenodo.13881473)
45

5-
Materials for the TBEP FIB dashboard
6+
Materials for the TBEP FIB dashboard
7+
8+
## Automated and regular updates
9+
10+
* Data under the baywide reporting tab are updated annually
11+
* County datasets are updated as they become available from the sources, with most updates occurring monthly or quarterly.

app.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ ui <- page_navbar(
148148
div(
149149
style = "display: flex; flex-direction: column;",
150150
div(style = "height: 25px;", "Select year:"),
151-
sliderInput('yrsel2', NULL, min = yrmin2, max = maxyr, value = maxyr, step = 1, sep = '', width = '90%')
151+
sliderInput('yrsel2', NULL, min = yrmin2, max = epcmaxyr, value = epcmaxyr, step = 1, sep = '', width = '90%')
152152
)
153153
),
154154
div(
@@ -727,7 +727,7 @@ server <- function(input, output, session) {
727727
dplyr::distinct() %>%
728728
dplyr::pull()
729729

730-
p <- try(tbeptools::show_fibmatrix(fibdata, stas = stas, yrrng = c(yrmin2, maxyr),
730+
p <- try(tbeptools::show_fibmatrix(fibdata, stas = stas, yrrng = c(yrmin2, epcmaxyr),
731731
warn = F))
732732

733733
validate(

data/catchprecip.RData

738 KB
Binary file not shown.

data/enterodata.RData

26.1 KB
Binary file not shown.

data/fibdata.RData

192 KB
Binary file not shown.

data/hcesdfibdata.RData

11.6 KB
Binary file not shown.

data/mancofibdata.RData

15 KB
Binary file not shown.

0 commit comments

Comments
 (0)