Skip to content

Commit

Permalink
Merge pull request #22 from Metropolitan-Council/dev
Browse files Browse the repository at this point in the history
Styling, documentation, essential updates (v0.2.4)
  • Loading branch information
eroten authored May 1, 2024
2 parents 227ced3 + 444c87b commit f547543
Show file tree
Hide file tree
Showing 34 changed files with 654 additions and 504 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^renv$
^renv\.lock$
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE\.md$
Expand Down
33 changes: 17 additions & 16 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,40 +1,41 @@
Type: Package
Package: tc.sensors
Title: Retrieve Loop Detector Data from the MnDOT JSON Feed
Version: 0.2.3
Date: 2023-07-21
Version: 0.2.4
Date: 2024-05-01
Authors@R: c(
person("Metropolitan Council", role = "cph"),
person("Liz", "Roten", , "liz.roten@metc.state.mn.us", role = c("cre", "aut"),
comment = c(ORCID = "0000-0002-5346-3549")),
person("Nicole", "Sullivan", , "nicole.sullivan@metc.state.mn.us", role = "aut"),
person("Nicole", "Sullivan", , "nicole.sullivan@metc.state.mn.us", role = "ctb"),
person("Ashley", "Asmus", , "ashley.asmus@metc.state.mn.us", role = "ctb",
comment = c(ORCID = "0000-0001-5505-1372")),
person("Yaxuan", "Zhang", , "yaxuan.zhang@metc.state.mn.us", role = "ctb",
comment = c(ORCID = "0000-0003-2343-8307"))
)
Description: Process data collected from Minnesota Department of
Transportation (MnDOT) loop detectors installed on the Minnesota
Freeway system in 30-second interval measurements of occupancy and
volume, data which are pushed daily to a public JSON feed. Occupancy
and volume data can be used to calculate speed and delay.
Freeway system. Data are published to a public JSON feed in 30-second
interval measurements of occupancy and volume. Occupancy and volume
data can be used to calculate speed and delay.
License: MIT + file LICENSE
BugReports: https://github.com/Metropolitan-Council/tc.sensors/issues
Imports:
cli (>= 3.6.1),
curl (>= 5.0.1),
data.table (>= 1.14.8),
dplyr (>= 1.1.2),
cli (>= 3.6.2),
curl (>= 5.2.1),
data.table (>= 1.15.4),
dplyr (>= 1.1.4),
geosphere (>= 1.5-18),
jsonlite (>= 1.8.7),
jsonlite (>= 1.8.8),
magrittr (>= 2.0.3),
purrr (>= 1.0.1),
sf (>= 1.0-14),
purrr (>= 1.0.2),
sf (>= 1.0-16),
tibble (>= 3.2.1),
tidyr (>= 1.3.0),
tidyr (>= 1.3.1),
tis (>= 1.39),
units (>= 0.8-5),
utils,
xml2 (>= 1.3.5)
xml2 (>= 1.3.6)
Suggests:
cowplot (>= 1.0.0),
furrr (>= 0.1.0),
Expand All @@ -52,4 +53,4 @@ VignetteBuilder:
Encoding: UTF-8
LazyData: true
Roxygen: list(markdown = TRUE, roclets = c("rd", "namespace", "collate"))
RoxygenNote: 7.2.3
RoxygenNote: 7.3.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) 2022 Metropolitan Council
Copyright (c) 2024 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
3 changes: 3 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ importFrom(purrr,map2)
importFrom(sf,st_as_sf)
importFrom(sf,st_cast)
importFrom(sf,st_length)
importFrom(sf,st_make_valid)
importFrom(sf,st_set_crs)
importFrom(stats,median)
importFrom(tibble,as_tibble)
Expand All @@ -55,6 +56,8 @@ importFrom(tidyr,separate)
importFrom(tidyr,unite)
importFrom(tis,day)
importFrom(tis,isHoliday)
importFrom(units,as_units)
importFrom(units,set_units)
importFrom(utils,download.file)
importFrom(utils,read.csv)
importFrom(xml2,read_xml)
Expand Down
30 changes: 17 additions & 13 deletions R/add_day_type.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,21 @@
#' @importFrom dplyr case_when
#'
add_day_type <- function(sensor_data) {
sensor_data[, `:=`(c("day_of_week", "day_type", "holiday", "day_category"), {
day_of_week <- weekdays(date)
day_type <- dplyr::case_when(day_of_week %in% c(
"Saturday",
"Sunday"
) ~ "Weekend", TRUE ~ "Weekday")
holiday <- tis::isHoliday(date)
day_category <- dplyr::case_when(
holiday == TRUE ~ "Holiday",
TRUE ~ day_type
)
.(day_of_week, day_type, holiday, day_category)
})][, holiday := NULL]
sensor_data[
, `:=`(c("day_of_week", "day_type", "holiday", "day_category"), {
day_of_week <- weekdays(date)
day_type <- dplyr::case_when(day_of_week %in% c(
"Saturday",
"Sunday"
) ~ "Weekend", TRUE ~ "Weekday")
holiday <- tis::isHoliday(date)
day_category <- dplyr::case_when(
holiday == TRUE ~ "Holiday",
TRUE ~ day_type
)
.(day_of_week, day_type, holiday, day_category)
})
][
, holiday := NULL
]
}
3 changes: 2 additions & 1 deletion R/add_distance.R
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ add_distance <- function(config,
))
]
}
config_final_joined <- config_final[as.data.table(config),
config_final_joined <- config_final[
as.data.table(config),
on = .(
detector_name, detector_label, detector_category,
detector_lane, detector_field, detector_abandoned, r_node_name,
Expand Down
Loading

0 comments on commit f547543

Please sign in to comment.