Skip to content

Fixing #300 by giving default values for fields #306

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

- name: Upload test results
if: failure()
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
Expand Down
4 changes: 2 additions & 2 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
linters: linters_with_defaults(
line_length_linter(120),
cyclocomp_linter = NULL,
object_length_linter(length = 40L)
object_length_linter(length = 40L),
return_linter = NULL
)
exclusions: list(
"renv",
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: epidatr
Title: Client for Delphi's 'Epidata' API
Version: 1.2.0
Version: 1.2.1
Authors@R: c(
person("Logan", "Brooks", , "[email protected]", role = "aut"),
person("Dmitry", "Shemetov", , "[email protected]", role = "aut"),
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# epidatr 1.2.1
## Patches
- Fix so that `covidcast_epidata()` will still print if fields are missing.

# epidatr 1.2.0

## Changes
Expand Down
33 changes: 16 additions & 17 deletions R/covidcast.R
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,18 @@ parse_source <- function(source, base_url) {
#' @export
as_tibble.covidcast_data_signal_list <- function(x, ...) {
tib <- list()
tib$source <- unname(map_chr(x, "source"))
tib$signal <- unname(map_chr(x, "signal"))
tib$name <- unname(map_chr(x, "name"))
tib$active <- unname(map_lgl(x, "active"))
tib$short_description <- unname(map_chr(x, "short_description"))
tib$description <- unname(map_chr(x, "description"))
tib$time_type <- unname(map_chr(x, "time_type"))
tib$time_label <- unname(map_chr(x, "time_label"))
tib$value_label <- unname(map_chr(x, "value_label"))
tib$format <- unname(map_chr(x, "format"))
tib$category <- unname(map_chr(x, "category"))
tib$high_values_are <- unname(map_chr(x, "high_values_are"))
chr_fields <- c(
"source", "signal", "name", "short_description",
"description", "time_type", "time_label", "value_label",
"format", "category", "high_values_are"
)
for (field in chr_fields) {
tib[[field]] <- unname(map_chr(x, field, .default = ""))
}
lgl_fields <- c("active")
for (field in lgl_fields) {
tib[[field]] <- unname(map_lgl(x, field, .default = ""))
}
as_tibble(tib)
}

Expand Down Expand Up @@ -184,11 +184,10 @@ covidcast_epidata <- function(base_url = global_base_url, timeout_seconds = 30)
#' @export
as_tibble.covidcast_data_source_list <- function(x, ...) {
tib <- list()
tib$source <- unname(map_chr(x, "source"))
tib$name <- unname(map_chr(x, "name"))
tib$description <- unname(map_chr(x, "description"))
tib$reference_signal <- unname(map_chr(x, "reference_signal"))
tib$license <- unname(map_chr(x, "license"))
fields <- c("source", "name", "description", "reference_signal", "license")
for (field in fields) {
tib[[field]] <- unname(map_chr(x, field, .default = ""))
}
as_tibble(tib)
}

Expand Down
12 changes: 6 additions & 6 deletions man/covidcast_epidata.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.