Skip to content

Commit

Permalink
Revert "Shift to make RSocrata recommended but not required"
Browse files Browse the repository at this point in the history
This reverts commit 26a19d0.
  • Loading branch information
RichardMN committed Nov 20, 2021
1 parent 26a19d0 commit 6828efd
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Imports:
R6,
readxl,
rlang,
RSocrata,
stringi,
stringr,
tibble,
Expand All @@ -113,7 +114,6 @@ Suggests:
knitr,
mockery,
pkgdown,
RSocrata,
rmarkdown,
rvest,
rworldmap,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export(test_download)
export(test_processing)
export(test_return)
importFrom(R6,R6Class)
importFrom(RSocrata,read.socrata)
importFrom(countrycode,countrycode)
importFrom(countrycode,countryname)
importFrom(dplyr,"%>%")
Expand Down
18 changes: 2 additions & 16 deletions R/Colombia.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,11 @@ Colombia <- R6::R6Class("Colombia",
},

#' @description Colombia specific download using Socrata API
#' @importFrom dplyr select
#' @importFrom RSocrata read.socrata
download = function () {
message_verbose(self$verbose,
"Downloading Colombia data. This may take a while.")
# RSocrata package is recommended but not required
if (require("RSocrata", attach.required = TRUE)) {
self$data$raw$main <- RSocrata::read.socrata(self$data_urls[["main"]])
} else {
# If the RSocrata package is not available, we download the full wide
# csv (which is at least 8x larger) then select down to what we could
# get through the API.
#truncated_url <- sub("\\?.*", "", self$data_urls[["main"]])
alternate_url <- "https://www.datos.gov.co/api/views/gt2j-8ykr/rows.csv?accessType=DOWNLOAD"
massive_co_data <-
csv_reader(alternate_url,
self$verbose)
self$data$raw$main <- massive_co_data %>%
select(.data$fecha_diagnostico, .data$ciudad-municipio)
}
self$data$raw$main <- read.socrata(self$data_urls[["main"]])
},

#' @description Colombia specific data cleaning
Expand Down
Binary file modified tests/testthat/custom_data/Colombia_level_1.rds
Binary file not shown.
Binary file modified tests/testthat/custom_data/Colombia_level_2.rds
Binary file not shown.

0 comments on commit 6828efd

Please sign in to comment.