From 8bd100d1451598e88b4e01fedc045838fae56fcf Mon Sep 17 00:00:00 2001 From: Peter Kalverla Date: Mon, 15 Jan 2024 09:17:49 +0100 Subject: [PATCH 1/4] Don't short-circuit in checking return code Prevents loading old data when result is empty. --- R/ppo_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/ppo_data.R b/R/ppo_data.R index 5a1c1c1..a5efe0e 100644 --- a/R/ppo_data.R +++ b/R/ppo_data.R @@ -189,7 +189,7 @@ make_queryURL <- function(params, limit = 100000L) { } process_response <- function(results, keepData = FALSE) { - if (!length(results) || results$status_code != 200) + if (!length(results) | results$status_code != 200) list( "data" = NULL, "readme" = NULL, From a32c22b2e13d5bda056a661149088facd60ea614 Mon Sep 17 00:00:00 2001 From: Peter Kalverla Date: Mon, 15 Jan 2024 09:53:01 +0100 Subject: [PATCH 2/4] New url for npn services see https://github.com/usa-npn/rnpn/issues/33 --- R/ppo_traits.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/ppo_traits.R b/R/ppo_traits.R index c8c1f06..aac8665 100644 --- a/R/ppo_traits.R +++ b/R/ppo_traits.R @@ -26,7 +26,7 @@ ppo_traits <- function(x, sorted = TRUE, flatten_traits = TRUE, flatten_all = FA out <- lapply(gsub("^.*/([0-9]*)$", "\\1", x$data$eventId[1:2]), function(id){ x <- jsonlite::read_json( paste0( - "http://www.usanpn.org/npn_portal/observations/getObservationById.json?request_src=PPO&observation_id=", + "http://services.usanpn.org/npn_portal/observations/getObservationById.json?request_src=PPO&observation_id=", id), simplifyVector = T ) if (sorted) From 210b8eb3fd781096f8bea7e7af24f16c78826b90 Mon Sep 17 00:00:00 2001 From: Peter Kalverla Date: Mon, 15 Jan 2024 10:40:51 +0100 Subject: [PATCH 3/4] More complex condition If no results or results but empty. --- R/ppo_data.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/ppo_data.R b/R/ppo_data.R index a5efe0e..d74f809 100644 --- a/R/ppo_data.R +++ b/R/ppo_data.R @@ -189,7 +189,7 @@ make_queryURL <- function(params, limit = 100000L) { } process_response <- function(results, keepData = FALSE) { - if (!length(results) | results$status_code != 200) + if (!length(results) | (length(results) && results$status_code != 200)) list( "data" = NULL, "readme" = NULL, From fef2fa0c193498222259c86d5bb3140d8042de9c Mon Sep 17 00:00:00 2001 From: Peter Kalverla Date: Mon, 15 Jan 2024 10:52:39 +0100 Subject: [PATCH 4/4] Force test rerun Why does one test suite fail while the others don't? Server issue? --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 0250e80..1f051a4 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,7 @@ started with rppo. We recommend visiting the [rppo vignette](https://htmlpreview.github.io/?https://github.com/ropensci/rppo/blob/master/vignettes/rppo-vignette.html) for a more complete set of examples on using the rppo package, as well as viewing man pages for rppo functions in the R environment, using -`?ppo_data` and -`?ppo_terms`. +`?ppo_data` and `?ppo_terms`. ``` r # query all results from day 1 through 100 in a particular bounding box,