Skip to content

Commit

Permalink
Merge pull request #18 from Metropolitan-Council/refresh-2022
Browse files Browse the repository at this point in the history
Refresh 2022
  • Loading branch information
ashleyasmus authored Oct 27, 2022
2 parents 2167add + 7957599 commit 72d47f4
Show file tree
Hide file tree
Showing 28 changed files with 226 additions and 323 deletions.
3 changes: 3 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
^Meta$
^README\.Rmd$
^vignettes/calculate_speed_delay_cache$
^vignettes/data_cache/$
^vignettes/data_cache$
^vignettes/compare_congestion_metrics_cache$
68 changes: 18 additions & 50 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
branches: [main, master]
pull_request:
branches:
- main
branches: [main, master]

name: R-CMD-check

Expand All @@ -18,61 +18,29 @@ jobs:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: macOS-latest, r: 'release'}
- {os: ubuntu-latest, r: 'release', container: rocker/geospatial, rspm: "https://packagemanager.rstudio.com/cran/__linux__/xenial/latest"}

env:
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@master

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}

- name: Cache R packages
if: runner.os != 'Windows'
uses: actions/cache@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install system dependencies
if: runner.os == 'Linux'
env:
RHUB_PLATFORM: linux-x86_64-ubuntu-gcc
run: |
Rscript -e "remotes::install_github('r-hub/sysreqs')"
sysreqs=$(Rscript -e "cat(sysreqs::sysreq_commands('DESCRIPTION'))")
sudo -s eval "$sysreqs"
- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
shell: Rscript {0}

- name: Check
env:
_R_CHECK_CRAN_INCOMING_REMOTE_: false
run: rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error", check_dir = "check")
shell: Rscript {0}
extra-packages: any::rcmdcheck
needs: check

- name: Upload check results
if: failure()
uses: actions/upload-artifact@main
- uses: r-lib/actions/check-r-package@v2
with:
name: ${{ runner.os }}-r${{ matrix.config.r }}-results
path: check
upload-snapshots: true
58 changes: 29 additions & 29 deletions .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: main
branches: [main, master]
pull_request:
branches: [main, master]
release:
types: [published]
workflow_dispatch:

name: pkgdown

jobs:
pkgdown:
runs-on: macOS-latest
runs-on: ubuntu-latest
# Only restrict concurrency for non-PR jobs
concurrency:
group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }}
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: r-lib/actions/setup-r@master
- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-pandoc@master

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- name: Cache R packages
uses: actions/cache@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
extra-packages: any::pkgdown, local::.
needs: website

- name: Install dependencies
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown")
- name: Build site
run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE)
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .

- name: Deploy package
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
Rscript -e 'pkgdown::deploy_to_branch(new_process = FALSE)'
- name: Deploy to GitHub pages 🚀
if: github.event_name != 'pull_request'
uses: JamesIves/[email protected]
with:
clean: false
branch: gh-pages
folder: docs
128 changes: 0 additions & 128 deletions CODE_OF_CONDUCT.md

This file was deleted.

13 changes: 6 additions & 7 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
Type: Package
Package: tc.sensors
Title: Retrieve Loop Detector Data from the MnDOT JSON Feed
Version: 0.2.0.9002
Date: 2021-12-14
Version: 0.2.1
Date: 2022-10-26
Authors@R: c(
person("Metropolitan Council", role = "cph"),
person("Liz", "Roten", , "[email protected]", role = c("cre", "aut")),
person("Liz", "Roten", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0002-5346-3549")),
person("Nicole", "Sullivan", , "[email protected]", role = "aut"),
person("Ashley", "Asmus", , "[email protected]", role = "ctb",
comment = c(ORCID = "0000-0001-5505-1372"))
Expand All @@ -18,12 +19,12 @@ Description: Process data collected from Minnesota Department of
License: MIT + file LICENSE
BugReports: https://github.com/Metropolitan-Council/tc.sensors/issues
Imports:
cli (>= 3.3.0),
curl (>= 4.3),
data.table (>= 1.12.8),
dplyr (>= 1.0.0),
geosphere (>= 1.5.10),
jsonlite (>= 1.6.1),
lwgeom (>= 0.2.5),
magrittr (>= 1.5),
purrr (>= 0.3.4),
rlang (>= 0.4.6),
Expand All @@ -35,8 +36,6 @@ Imports:
xml2 (>= 1.3.2)
Suggests:
cowplot (>= 1.0.0),
doParallel (>= 1.0.15),
foreach (>= 1.5.0),
furrr (>= 0.1.0),
ggplot2 (>= 3.3.2),
knitr (>= 1.28),
Expand All @@ -52,4 +51,4 @@ VignetteBuilder:
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE, roclets = c("rd", "namespace", "collate"))
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MIT License

Copyright (c) 2021 Metropolitan Council
Copyright (c) 2022 Metropolitan Council

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
13 changes: 12 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,18 @@ export(pull_sensor_ids)
export(replace_impossible)
export(scrub_sensor)
import(data.table)
importFrom(curl,has_internet)
importFrom(cli,cli_abort)
importFrom(cli,cli_alert)
importFrom(curl,nslookup)
importFrom(data.table,":=")
importFrom(data.table,.BY)
importFrom(data.table,.EACHI)
importFrom(data.table,.GRP)
importFrom(data.table,.I)
importFrom(data.table,.N)
importFrom(data.table,.NGRP)
importFrom(data.table,.SD)
importFrom(data.table,data.table)
importFrom(data.table,fwrite)
importFrom(dplyr,bind_cols)
importFrom(dplyr,bind_rows)
Expand Down
6 changes: 3 additions & 3 deletions R/add_distance.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ add_distance <- function(config,

# input checks ---------------------------------------------------------------
if (nrow(.config) < 1) {
stop("There must be more than one sensor in the configuration")
cli::cli_abort("There must be more than one sensor in the configuration")
}

if (min(.config[, .(n = .N), keyby = .(corridor_route)][, n]) < 2) {
stop("There must be at least two sensors for each corridor in the configuration")
cli::cli_abort("There must be at least two sensors for each corridor in the configuration")
}

# Select stations (want distance between stations, not between ramps etc.)
config_stations <- as.data.table(.config)[r_node_n_type == "Station", ]

if (nrow(config_stations) == 0) {
stop("There must be station node types in the configuration")
cli::cli_abort("There must be station node types in the configuration")
}


Expand Down
Loading

0 comments on commit 72d47f4

Please sign in to comment.