From 6828efd1143d65d7fc6b5c09dbe185a0535733cc Mon Sep 17 00:00:00 2001 From: Richard Martin-Nielsen Date: Sat, 20 Nov 2021 18:51:21 +0200 Subject: [PATCH] Revert "Shift to make RSocrata recommended but not required" This reverts commit 26a19d070d71f732ceacb91ff20d40e33bb52fd6. --- DESCRIPTION | 2 +- NAMESPACE | 1 + R/Colombia.R | 18 ++---------------- .../testthat/custom_data/Colombia_level_1.rds | Bin 46 -> 800 bytes .../testthat/custom_data/Colombia_level_2.rds | Bin 46 -> 800 bytes 5 files changed, 4 insertions(+), 17 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a07e1f53..f1adb951 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -99,6 +99,7 @@ Imports: R6, readxl, rlang, + RSocrata, stringi, stringr, tibble, @@ -113,7 +114,6 @@ Suggests: knitr, mockery, pkgdown, - RSocrata, rmarkdown, rvest, rworldmap, diff --git a/NAMESPACE b/NAMESPACE index 891415c5..fa8d9b60 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -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,"%>%") diff --git a/R/Colombia.R b/R/Colombia.R index e34266b1..08dc853c 100644 --- a/R/Colombia.R +++ b/R/Colombia.R @@ -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 diff --git a/tests/testthat/custom_data/Colombia_level_1.rds b/tests/testthat/custom_data/Colombia_level_1.rds index 70e66ce7e53dbd6f0c9e82fb9618ef4b90f0b617..72c9db9b1f25cd3851b1372a3661e716164c913f 100644 GIT binary patch literal 800 zcmV+*1K<1~iwFP!000001MOK&XcIvcew!a51!0?}f+zJNVln#@+oVAcD)u0Pq*~A@ zly#Hpf=Q%l5pP};J*XfER=jxdWJEmaT|5bb(kR}n;8og7iylm8GTEfN*%zH<(zHeB z*EjRNnfEjQVbAsfKoCNb1i>&VLU`iL*nt#4V1QI4!ciF@kO_W62qHvA6Plu_imvL~ zZZ)maKbz4<5vE^PG|jt9lG|7`p>n%HyF_(eps@}NK4|>e;Nz^JF{A!FFn;nxv%y32 zF=#&4U?(Oe&>Ehouh2y90{;EkuZ<`p-b4~3bd1n2;vh!wJMSqm>P^VQUDl^K1M-ub z%01ou3j`$u<{^+krb8ehYf6H1M9{S$Y&rXJj?OIqP@xME$wN+X>XFk3)r+#T(fsym z+<5JGc^v%g9CRP>pVa&Wx^o1Eix9G|j0(|XbBd;bzAaFKe=5+|2uh$ncumRtk1Etf z_pdD<7af*2?^T1Y9D&;fCD!A)DsU10C$=mh@H*+K^DR$cgQ%kfW-5U_jMsr6r*6_a z+F>Onh7k6&;M8xrErTu`VN-$65gHWweBr;&dis-pV;<_8{SE@y4)grvST- zFvJ!C25TVgTW|md?lh%0zB%hLaMYW92cH4#|K;oxd%%3x%ZnhH*Xw{o1%f94hwlQU z=ZL)Tjbl3ij#}+FUM2Y0LL2YWjb-YPPDUJnb6){21erV^YSeE5WOY`~K4g-@OatUz z5j+-$i+cg`Lrz^~h2iB1f+WE6g%&DtfEV{#s05kbuD_mh;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