From 86e969288222f5eb57c327efed0b815cc0ad092c Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Mon, 20 Apr 2015 22:19:09 -0500 Subject: [PATCH 01/55] Add basic appveyor.yml file, ignore in R build --- .Rbuildignore | 1 + appveyor.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 appveyor.yml diff --git a/.Rbuildignore b/.Rbuildignore index e9febb7..8ab65d9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -10,3 +10,4 @@ RSocrata.Rcheck .DS_Store README.md ^\.travis\.yml$ +appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..6cec0ca --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,40 @@ +# DO NOT CHANGE the "init" and "install" sections below + +# Download script file from GitHub +init: + ps: | + $ErrorActionPreference = "Stop" + Invoke-WebRequest http://raw.github.com/krlmlr/r-appveyor/master/scripts/appveyor-tool.ps1 -OutFile "..\appveyor-tool.ps1" + Import-Module '..\appveyor-tool.ps1' +install: + ps: Bootstrap + +# Adapt as necessary starting from here + +build_script: + - travis-tool.sh install_deps + +test_script: + - travis-tool.sh run_tests + +on_failure: + - travis-tool.sh dump_logs + +artifacts: + - path: '*.Rcheck\**\*.log' + name: Logs + + - path: '*.Rcheck\**\*.out' + name: Logs + + - path: '*.Rcheck\**\*.fail' + name: Logs + + - path: '*.Rcheck\**\*.Rout' + name: Logs + + - path: '\*_*.tar.gz' + name: Bits + + - path: '\*_*.zip' + name: Bits \ No newline at end of file From 34867094931b925b817d8ad9810a90e6f92eb453 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Mon, 20 Apr 2015 22:36:06 -0500 Subject: [PATCH 02/55] Added unit testing to build scripts --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 6cec0ca..468ce9a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,6 +16,7 @@ build_script: test_script: - travis-tool.sh run_tests + - Rscript.exe -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' on_failure: - travis-tool.sh dump_logs From d470ad06eae3620c6f09fa5ef69ba031dc18684c Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Mon, 20 Apr 2015 22:36:06 -0500 Subject: [PATCH 03/55] Added unit testing to build scripts --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 6cec0ca..18eb027 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,6 +16,7 @@ build_script: test_script: - travis-tool.sh run_tests + - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' on_failure: - travis-tool.sh dump_logs From b915ce8f00076ec06367baba381c1989c72ebe36 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Mon, 20 Apr 2015 22:48:58 -0500 Subject: [PATCH 04/55] Clean-up extraneous comments --- appveyor.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 18eb027..0ae2cd9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,3 @@ -# DO NOT CHANGE the "init" and "install" sections below - -# Download script file from GitHub init: ps: | $ErrorActionPreference = "Stop" @@ -9,8 +6,6 @@ init: install: ps: Bootstrap -# Adapt as necessary starting from here - build_script: - travis-tool.sh install_deps From 81d7ccad4fc0363b4529f4d7d386fcac7ddaf55b Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Mon, 20 Apr 2015 23:11:01 -0500 Subject: [PATCH 05/55] Potential fix to run Rscript on test_script --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0ae2cd9..2835009 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,7 +11,7 @@ build_script: test_script: - travis-tool.sh run_tests - - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' + - cmd: Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' on_failure: - travis-tool.sh dump_logs From 1715d8d432cbc3079055c76086bbe77cd006fb5f Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Mon, 20 Apr 2015 23:35:12 -0500 Subject: [PATCH 06/55] Added warnings_are_errors for appveyor and travis-ci --- .travis.yml | 2 ++ appveyor.yml | 3 +++ 2 files changed, 5 insertions(+) diff --git a/.travis.yml b/.travis.yml index 2b480a7..84bb9ea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,6 +8,8 @@ language: c env: - R_MY_PKG="$(basename $TRAVIS_REPO_SLUG)" + - global: + - WARNINGS_ARE_ERRORS=1 before_install: - curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh diff --git a/appveyor.yml b/appveyor.yml index 2835009..2e95381 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,6 @@ +environment: + WARNINGS_ARE_ERRORS: 1 + init: ps: | $ErrorActionPreference = "Stop" From 8a74f52153df3940ca24a583b9803db5276cd386 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Mon, 20 Apr 2015 23:37:16 -0500 Subject: [PATCH 07/55] Testing directory for Appveyor --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index 2e95381..2b11c7b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -14,6 +14,7 @@ build_script: test_script: - travis-tool.sh run_tests + - cmd: echo %cd% - cmd: Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' on_failure: From 95fda865a4c4ec47c7f5d23a3134f5e3fcc03150 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Tue, 21 Apr 2015 20:28:40 -0500 Subject: [PATCH 08/55] Turn off WARNINGS_ARE_ERRORS to test unit testing capabilities --- .travis.yml | 3 +-- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84bb9ea..f4dccdc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,9 +7,8 @@ language: c env: - - R_MY_PKG="$(basename $TRAVIS_REPO_SLUG)" - global: - - WARNINGS_ARE_ERRORS=1 + - WARNINGS_ARE_ERRORS=0 before_install: - curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh diff --git a/appveyor.yml b/appveyor.yml index 2b11c7b..143b5be 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,5 +1,5 @@ environment: - WARNINGS_ARE_ERRORS: 1 + WARNINGS_ARE_ERRORS: 0 init: ps: | From b341597c092160e3e791e413a9831ccc9edebe47 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Tue, 21 Apr 2015 23:02:35 -0500 Subject: [PATCH 09/55] Hard-removed WARNINGS_ARE_ERRORS for unit testing --- .travis.yml | 4 ---- appveyor.yml | 3 --- 2 files changed, 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index f4dccdc..dce4f9f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,10 +6,6 @@ language: c -env: - - global: - - WARNINGS_ARE_ERRORS=0 - before_install: - curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh - chmod 755 ./travis-tool.sh diff --git a/appveyor.yml b/appveyor.yml index 143b5be..802043f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,3 @@ -environment: - WARNINGS_ARE_ERRORS: 0 - init: ps: | $ErrorActionPreference = "Stop" From 56ac9cf28e1d2e3dd3ac04ded5920b54907e6a3b Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Tue, 21 Apr 2015 23:17:25 -0500 Subject: [PATCH 10/55] Using double-quotes instead of single for Appveyor --- appveyor.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 802043f..b814fe0 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -11,8 +11,7 @@ build_script: test_script: - travis-tool.sh run_tests - - cmd: echo %cd% - - cmd: Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' + - Rscript -e "source('R/tests/testRSocrata.R'); runAllTestsCI()" on_failure: - travis-tool.sh dump_logs From 346b56f2bd953f99742ef2454327c4268a7d1273 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Tue, 21 Apr 2015 23:57:12 -0500 Subject: [PATCH 11/55] roxygen2 now builds NAMESPACE, .Rd and collate files --- RSocrata.Rproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RSocrata.Rproj b/RSocrata.Rproj index b785b09..c3e4e80 100644 --- a/RSocrata.Rproj +++ b/RSocrata.Rproj @@ -15,4 +15,4 @@ LaTeX: pdfLaTeX BuildType: Package PackageInstallArgs: --no-multiarch --with-keep.source PackageCheckArgs: --as-cran -PackageRoxygenize: rd +PackageRoxygenize: rd,collate,namespace From 01c73529ca931c33b06d499c1719247437144e95 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Tue, 21 Apr 2015 23:57:32 -0500 Subject: [PATCH 12/55] Add roxygen2 to CI build scripts --- .travis.yml | 1 + appveyor.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index dce4f9f..e1546fe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ before_install: install: - ./travis-tool.sh install_deps script: + - Rscript -e 'install.packages("roxygen2"); library("roxygen2"); roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))' - ./travis-tool.sh run_tests - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' diff --git a/appveyor.yml b/appveyor.yml index b814fe0..f9adc94 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,6 +10,7 @@ build_script: - travis-tool.sh install_deps test_script: + - Rscript -e "install.packages('roxygen2'); library('roxygen2'); roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))" - travis-tool.sh run_tests - Rscript -e "source('R/tests/testRSocrata.R'); runAllTestsCI()" From dc18695618e8e87851bb9a2e5fc1e698255361ca Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Wed, 22 Apr 2015 00:15:27 -0500 Subject: [PATCH 13/55] Added CRAN repo; fixed quote marks --- .travis.yml | 2 +- appveyor.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e1546fe..048a549 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ before_install: install: - ./travis-tool.sh install_deps script: - - Rscript -e 'install.packages("roxygen2"); library("roxygen2"); roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))' + - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" - ./travis-tool.sh run_tests - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' diff --git a/appveyor.yml b/appveyor.yml index f9adc94..cd4ce8b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,7 +10,7 @@ build_script: - travis-tool.sh install_deps test_script: - - Rscript -e "install.packages('roxygen2'); library('roxygen2'); roxygen2::roxygenize('.', roclets=c('rd', 'collate', 'namespace'))" + - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" - travis-tool.sh run_tests - Rscript -e "source('R/tests/testRSocrata.R'); runAllTestsCI()" From 016a7766e5e00f6c6d7dc9325e7bdcaddb6af49c Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Wed, 22 Apr 2015 00:29:10 -0500 Subject: [PATCH 14/55] Added AppVeyor badges, added warnings_as_errors, closes #39 --- .travis.yml | 4 ++++ README.md | 4 ++-- appveyor.yml | 3 +++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 048a549..8a79207 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,10 @@ language: c +env: + - global: + - WARNINGS_ARE_ERRORS=1 + before_install: - curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh - chmod 755 ./travis-tool.sh diff --git a/README.md b/README.md index 98d3451..f3adf86 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ RSocrata ======== -Master: [![Build Status - Master](https://api.travis-ci.org/Chicago/RSocrata.png?branch=master)](https://travis-ci.org/Chicago/RSocrata) +Master: [![Build Status - Master](https://api.travis-ci.org/Chicago/RSocrata.png?branch=master)](https://travis-ci.org/Chicago/RSocrata) [![Build status](https://ci.appveyor.com/api/projects/status/vcvxeiw9eop6ngcn/branch/master?svg=true)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master) -Dev: [![Build Status - Dev](https://api.travis-ci.org/Chicago/RSocrata.png?branch=dev)](https://travis-ci.org/Chicago/RSocrata) +Dev: [![Build Status - Dev](https://api.travis-ci.org/Chicago/RSocrata.png?branch=dev)](https://travis-ci.org/Chicago/RSocrata) [![Build status](https://ci.appveyor.com/api/projects/status/vcvxeiw9eop6ngcn/branch/dev?svg=true)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) A tool for downloading Socrata datasets as R data frames -------------------------------------------------------- diff --git a/appveyor.yml b/appveyor.yml index cd4ce8b..00265ab 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,6 @@ +environment: + WARNINGS_ARE_ERRORS: 1 + init: ps: | $ErrorActionPreference = "Stop" From f4880c02cf066770b7a7d2fd4f2188d3dc8cf307 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Wed, 22 Apr 2015 00:40:33 -0500 Subject: [PATCH 15/55] Bump build number --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 62ad2b5..64a96dd 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,8 +8,8 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.0-12 -Date: 2015-4-20 +Version: 1.6.0-13 +Date: 2015-4-22 URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues Depends: From 35d4d4abca12ee4e1631206788393a8438f35cb8 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Tue, 26 May 2015 14:00:59 -0500 Subject: [PATCH 16/55] Updated badges layout to Shields.io --- README.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f3adf86..77f85a3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,13 @@ RSocrata ======== -Master: [![Build Status - Master](https://api.travis-ci.org/Chicago/RSocrata.png?branch=master)](https://travis-ci.org/Chicago/RSocrata) [![Build status](https://ci.appveyor.com/api/projects/status/vcvxeiw9eop6ngcn/branch/master?svg=true)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master) +**Master** -Dev: [![Build Status - Dev](https://api.travis-ci.org/Chicago/RSocrata.png?branch=dev)](https://travis-ci.org/Chicago/RSocrata) [![Build status](https://ci.appveyor.com/api/projects/status/vcvxeiw9eop6ngcn/branch/dev?svg=true)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) +[![Linux build](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata) [![Windows build](https://img.shields.io/appveyor/ci/Chicago/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master) + +**Dev** + +[![Build Status - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata) [![Build status](https://img.shields.io/appveyor/ci/Chicago/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) A tool for downloading Socrata datasets as R data frames -------------------------------------------------------- From 2550178f45ed88e330dc50ce4b02dad5d9e34be6 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Thu, 28 May 2015 17:15:17 -0500 Subject: [PATCH 17/55] Build number bump --- DESCRIPTION | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 64a96dd..7b58c07 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,8 +8,8 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.0-13 -Date: 2015-4-22 +Version: 1.6.0-14 +Date: 2015-5-28 URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues Depends: @@ -22,4 +22,4 @@ Suggests: RUnit Author: Hugh Devlin, Ph. D. and Tom Schenk, Jr. Maintainer: "Tom Schenk Jr." -License: MIT + file LICENSE \ No newline at end of file +License: MIT + file LICENSE From 3b7069240eb2afb9c06f5e9041947ea5cdf1d616 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Thu, 28 May 2015 17:38:37 -0500 Subject: [PATCH 18/55] Fixed AppVeyor icons --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 77f85a3..167a09d 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ RSocrata **Master** -[![Linux build](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata) [![Windows build](https://img.shields.io/appveyor/ci/Chicago/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master) +[![Linux build](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata) [![Windows build](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master) **Dev** -[![Build Status - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata) [![Build status](https://img.shields.io/appveyor/ci/Chicago/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) +[![Build Status - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata) [![Build status](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) A tool for downloading Socrata datasets as R data frames -------------------------------------------------------- From 632ef0472a2eda0944f372ef3f81759c828fcde2 Mon Sep 17 00:00:00 2001 From: Gene Leynes Date: Fri, 5 Jun 2015 09:47:31 -0500 Subject: [PATCH 19/55] Moved most 'Depends' packages to 'Imports' in DESCRIPTION. Added 'ImportFrom' in NAMESPACE. Strangely, had to comment out fieldNames examplein the documentation. --- .gitignore | 13 ++++++------- DESCRIPTION | 12 ++++++------ NAMESPACE | 8 ++++---- R/RSocrata.R | 8 ++++---- 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/.gitignore b/.gitignore index 408ac80..50471e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,15 @@ -/.settings +/.git /.project +/.Rbuildignore.Rcheck /.README.md.html +/.settings +/DESCRIPTION.Rcheck /man -/.git -/RSocrata_*.tar.gz -/RCheck /out +/RCheck +/RSocrata_*.tar.gz /RSocrata.Rcheck *.pdf -/DESCRIPTION.Rcheck -/.Rbuildignore.Rcheck -*.Rproj.user *.Rproj *.Rproj.user *.Rhistory diff --git a/DESCRIPTION b/DESCRIPTION index 62ad2b5..7bb12b5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,18 +8,18 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.0-12 -Date: 2015-4-20 +Version: 1.6.0-13 +Date: 2015-6-5 URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues -Depends: +Imports: httr (>= 0.3), jsonlite (>= 0.9.14), - mime (>= 0.2) -Imports: + mime (>= 0.2), +Depends: curl (>= 0.5) Suggests: RUnit Author: Hugh Devlin, Ph. D. and Tom Schenk, Jr. Maintainer: "Tom Schenk Jr." -License: MIT + file LICENSE \ No newline at end of file +License: MIT + file LICENSE diff --git a/NAMESPACE b/NAMESPACE index f995a38..a722644 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,7 +2,7 @@ export(fieldName) export(posixify) export(read.socrata) export(ls.socrata) -import(jsonlite) -import(httr) -import(mime) -import(curl) \ No newline at end of file +importFrom("httr", "parse_url", "build_url", "http_status", "stop_for_status", "GET", "content") +importFrom("mime", "guess_type") +importFrom("jsonlite", "fromJSON") +import("curl") diff --git a/R/RSocrata.R b/R/RSocrata.R index 9a30d23..df3d035 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -3,9 +3,9 @@ # Author: Hugh J. Devlin, Ph. D. 2013-08-28 ############################################################################### -library('httr') # for access to the HTTP header -library('jsonlite') # for parsing data types from Socrata -library('mime') # for guessing mime type +# library('httr') # for access to the HTTP header +# library('jsonlite') # for parsing data types from Socrata +# library('mime') # for guessing mime type #' Time-stamped message #' @@ -89,7 +89,7 @@ validateUrl <- function(url, app_token) { #' @export #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} #' @examples -#' fieldName("Number.of.Stations") # number_of_stations +#' #fieldName("Number.of.Stations") # number_of_stations fieldName <- function(humanName) { tolower(gsub('\\.', '_', as.character(humanName))) } From f060f92d63555311a96c0e83e18aeffa062c0aff Mon Sep 17 00:00:00 2001 From: Gene Leynes Date: Fri, 5 Jun 2015 10:30:52 -0500 Subject: [PATCH 20/55] testing adding httr:: to parse_url to explicitly reference the proper namespace --- R/RSocrata.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/RSocrata.R b/R/RSocrata.R index df3d035..7719dcc 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -50,7 +50,7 @@ isFourByFour <- function(fourByFour) { #' @author Tom Schenk Jr \email{tom.schenk@@cityofchicago.org} validateUrl <- function(url, app_token) { url <- as.character(url) - parsedUrl <- parse_url(url) + parsedUrl <- httr::parse_url(url) if(is.null(parsedUrl$scheme) | is.null(parsedUrl$hostname) | is.null(parsedUrl$path)) stop(url, " does not appear to be a valid URL.") if(!is.null(app_token)) { # Handles the addition of API token and resolves invalid uses @@ -188,7 +188,7 @@ getSodaTypes <- function(response) { #' df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv") read.socrata <- function(url, app_token = NULL) { validUrl <- validateUrl(url, app_token) # check url syntax, allow human-readable Socrata url - parsedUrl <- parse_url(validUrl) + parsedUrl <- httr::parse_url(validUrl) mimeType <- guess_type(parsedUrl$path) if(!(mimeType %in% c('text/csv','application/json'))) stop("Error in read.socrata: ", mimeType, " not a supported data format.") @@ -220,7 +220,7 @@ read.socrata <- function(url, app_token = NULL) { #' df <- ls.socrata("http://soda.demo.socrata.com") ls.socrata <- function(url) { url <- as.character(url) - parsedUrl <- parse_url(url) + parsedUrl <- httr::parse_url(url) if(is.null(parsedUrl$scheme) | is.null(parsedUrl$hostname)) stop(url, " does not appear to be a valid URL.") parsedUrl$path <- "data.json" From e497cbe2319224cb355cbe0d7e7834016c2ccd78 Mon Sep 17 00:00:00 2001 From: Gene Leynes Date: Fri, 5 Jun 2015 10:38:21 -0500 Subject: [PATCH 21/55] using :: to reference all namespaces --- R/RSocrata.R | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/R/RSocrata.R b/R/RSocrata.R index 7719dcc..358b4c9 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -67,14 +67,14 @@ validateUrl <- function(url, app_token) { }) } if(substr(parsedUrl$path, 1, 9) == 'resource/') { - return(build_url(parsedUrl)) # resource url already + return(httr::build_url(parsedUrl)) # resource url already } fourByFour <- basename(parsedUrl$path) if(!isFourByFour(fourByFour)) stop(fourByFour, " is not a valid Socrata dataset unique identifier.") else { parsedUrl$path <- paste('resource/', fourByFour, '.csv', sep="") - build_url(parsedUrl) + httr::build_url(parsedUrl) } } @@ -118,17 +118,17 @@ posixify <- function(x) { # @return httr response object # @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} getResponse <- function(url) { - response <- GET(url) - status <- http_status(response) + response <- httr::GET(url) + status <- httr::http_status(response) if(response$status_code != 200) { msg <- paste("Error in httr GET:", response$status_code, response$headers$statusmessage, url) if(!is.null(response$headers$`content-length`) && (response$headers$`content-length` > 0)) { - details <- content(response) + details <- httr::content(response) msg <- paste(msg, details$code[1], details$message[1]) } logMsg(msg) } - stop_for_status(response) + httr::stop_for_status(response) response } @@ -164,8 +164,8 @@ getContentAsDataFrame <- function(response) { # @return a named vector mapping field names to data types getSodaTypes <- function(response) { UseMethod('response') } getSodaTypes <- function(response) { - result <- fromJSON(response$headers[['x-soda2-types']]) - names(result) <- fromJSON(response$headers[['x-soda2-fields']]) + result <- jsonlite::fromJSON(response$headers[['x-soda2-types']]) + names(result) <- jsonlite::fromJSON(response$headers[['x-soda2-fields']]) result } @@ -189,7 +189,7 @@ getSodaTypes <- function(response) { read.socrata <- function(url, app_token = NULL) { validUrl <- validateUrl(url, app_token) # check url syntax, allow human-readable Socrata url parsedUrl <- httr::parse_url(validUrl) - mimeType <- guess_type(parsedUrl$path) + mimeType <- mime::guess_type(parsedUrl$path) if(!(mimeType %in% c('text/csv','application/json'))) stop("Error in read.socrata: ", mimeType, " not a supported data format.") response <- getResponse(validUrl) @@ -224,7 +224,7 @@ ls.socrata <- function(url) { if(is.null(parsedUrl$scheme) | is.null(parsedUrl$hostname)) stop(url, " does not appear to be a valid URL.") parsedUrl$path <- "data.json" - df <- fromJSON(build_url(parsedUrl)) + df <- jsonlite::fromJSON(httr::build_url(parsedUrl)) df <- as.data.frame(df$dataset) df$issued <- as.POSIXct(df$issued) df$modified <- as.POSIXct(df$modified) From 577a48fe8379a4f40331088ec23ee1e54952ebd2 Mon Sep 17 00:00:00 2001 From: Gene Leynes Date: Fri, 5 Jun 2015 11:02:22 -0500 Subject: [PATCH 22/55] using :: to reference all namespaces --- R/RSocrata.R | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/R/RSocrata.R b/R/RSocrata.R index 358b4c9..d543b40 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -147,12 +147,12 @@ getContentAsDataFrame <- function(response) { if(sep != -1) mimeType <- substr(mimeType, 0, sep[1] - 1) switch(mimeType, 'text/csv' = - content(response), # automatic parsing + httr::content(response), # automatic parsing 'application/json' = - if(content(response, as='text') == "[ ]") # empty json? + if(httr::content(response, as='text') == "[ ]") # empty json? data.frame() # empty data frame else - data.frame(t(sapply(content(response), unlist)), stringsAsFactors=FALSE) + data.frame(t(sapply(httr::content(response), unlist)), stringsAsFactors=FALSE) ) # end switch } From 77492213c4046626fada1a86eef487a83d9eaaee Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Fri, 5 Jun 2015 20:15:43 -0500 Subject: [PATCH 23/55] Version bump to 1.6.1 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 68203db..5f8974b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.0-15 +Version: 1.6.1-1 Date: 2015-6-5 URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues From 16c58e941e7744735c63b88280c320e59af2152f Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Fri, 5 Jun 2015 20:54:37 -0500 Subject: [PATCH 24/55] Documentation clean-up, fixes #40 --- DESCRIPTION | 4 ++-- README.md | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 5f8974b..6875ac9 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.1-1 +Version: 1.6.1-2 Date: 2015-6-5 URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues @@ -21,5 +21,5 @@ Depends: Suggests: RUnit Author: Hugh Devlin, Ph. D. and Tom Schenk, Jr. -Maintainer: "Tom Schenk Jr." +Maintainer: Tom Schenk Jr License: MIT + file LICENSE diff --git a/README.md b/README.md index 167a09d..b730adc 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ RSocrata **Master** -[![Linux build](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata) [![Windows build](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master) +[![Linux build - Master](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Master](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master) **Dev** -[![Build Status - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata) [![Build status](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) +[![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) A tool for downloading Socrata datasets as R data frames -------------------------------------------------------- @@ -27,15 +27,15 @@ Use ```ls.socrata()``` to list all datasets available on a Socrata webserver. ### Example: Reading SoDA valid URLs ```r -earthquakesDataFrame <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv")
-nrow(earthquakesDataFrame) # 1007 (two "pages")
+earthquakesDataFrame <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv") +nrow(earthquakesDataFrame) # 1007 (two "pages") class(earthquakesDataFrame$Datetime[1]) # POSIXlt ``` ### Example: Reading "human-readable" URLs ```r -earthquakesDataFrame <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquakes-for-2012-11-01-API-School-Demo/4334-bgaj")
-nrow(earthquakesDataFrame) # 1007 (two "pages")
+earthquakesDataFrame <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquakes-for-2012-11-01-API-School-Demo/4334-bgaj") +nrow(earthquakesDataFrame) # 1007 (two "pages") class(earthquakesDataFrame$Datetime[1]) # POSIXlt ``` @@ -76,5 +76,5 @@ Please report issues, request enhancements or fork us at the [City of Chicago gi 1.6.0 Several changes: * New function, ```ls.socrata``` to list all datasets on a Socrata portal. -* New optional argument, ```app_token```, which lets users supply an API token while using ```read.socrata() to minimize throttling. +* New optional argument, ```app_token```, which lets users supply an API token while using ```read.socrata()``` to minimize throttling. * Repairs a bug where ```read.socrata``` failed when reading in a date with a column, but there are null values in that column. From 69ae6fdba1e5e6585a97969acd259549f83aebbb Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Fri, 5 Jun 2015 21:17:39 -0500 Subject: [PATCH 25/55] Contributing docs, closes #23 fix #28 --- .Rbuildignore | 1 + CONTRIBUTING.md | 25 +++++++++++++++++++++++++ README.md | 4 ++++ 3 files changed, 30 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/.Rbuildignore b/.Rbuildignore index 8ab65d9..e19c31c 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -11,3 +11,4 @@ RSocrata.Rcheck README.md ^\.travis\.yml$ appveyor.yml +CONTRIBUTING.md \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9737e87 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,25 @@ + +# How to contribute + +We really appreciate when users [fix bugs](https://github.com/Chicago/RSocrata/pull/25) or [provide new features](https://github.com/Chicago/RSocrata/pull/21). When submitting changes, please read below to help the development team keep on top of issues and changes. + +## Submitting a bug + +If you notice something strange, please [submit an issue on GitHub](https://github.com/Chicago/RSocrata/issues). In the issue, please try to achieve the following: + +* Describe what you did +* Describe what happened when you did it +* Describe what you think should happen +* If possible, describe where you think the error is occuring + +If you have multiple issues, please submit multiple requests. Once you submit your report, we'll often engage in a conversation or give it a label to be fixed. + +## Making Changes + +When you want to make a change, either to fix a bug or introduce a new feature, please follow the instructions below + +* Create a branch or fork of the project based off of the `dev` branch. +* Make commits of logical units +* Add unit tests for any new features +* Run all tests in `R/tests/testRSocrata.R` +* Create a pull request with a robust description or [reference the issue number](https://github.com/Chicago/RSocrata/issues) \ No newline at end of file diff --git a/README.md b/README.md index b730adc..48bdc09 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,10 @@ allSitesDataFrame$title # Names of each dataset Please report issues, request enhancements or fork us at the [City of Chicago github](https://github.com/Chicago/RSocrata/issues). +### Contributing + +If you would like to contribute to this project, please see the [contributing documentation](CONTRIBUTING.md) + ### Change log 1.1 Add check for valid Socrata resource URL. Add check for supported download file format. Add support for Socrata short dates. From 994ffa2b2789270c7642556e2fab1179940f0edf Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Fri, 5 Jun 2015 21:28:30 -0500 Subject: [PATCH 26/55] Updated release notes --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 48bdc09..64ecfec 100644 --- a/README.md +++ b/README.md @@ -82,3 +82,7 @@ If you would like to contribute to this project, please see the [contributing do * New function, ```ls.socrata``` to list all datasets on a Socrata portal. * New optional argument, ```app_token```, which lets users supply an API token while using ```read.socrata()``` to minimize throttling. * Repairs a bug where ```read.socrata``` failed when reading in a date with a column, but there are null values in that column. + +1.6.1 Bug fixes: +* Resolved potential [name collision issue](https://github.com/Chicago/RSocrata/issues/42) +* Cleaned-up documentation with contributor instructions From f624af5cbd6f0155cbda76599023c2e349a1ac14 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Sat, 4 Jul 2015 14:04:10 -0500 Subject: [PATCH 27/55] Removed \url{...}. *Now* closes #40 Erroneously mentioned as closed in 16c58e941e7744735c63b88280c320e59af2152f --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6875ac9..3a568f2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: RSocrata Title: Download 'Socrata' Data Sets as R Data Frames Description: Provides easier interaction with - Socrata open data portals \url{http://dev.socrata.com}. + Socrata open data portals http://dev.socrata.com. Users can provide a 'Socrata' data set resource URL, or a 'Socrata' Open Data API (SoDA) web query, or a 'Socrata' "human-friendly" URL, From d506619ccdc2d11e4201cade23e9d03cb181a2d9 Mon Sep 17 00:00:00 2001 From: dmpe Date: Tue, 7 Jul 2015 18:31:08 +0200 Subject: [PATCH 28/55] update travis to a new version, i.e. proper "r" instead of old "c" --- .travis.yml | 30 ++++++++++++------------------ DESCRIPTION | 4 ++-- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 8a79207..3f6e781 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,29 +2,23 @@ # # See README.md for instructions, or for more configuration options, # see the wiki: -# https://github.com/craigcitro/r-travis/wiki +# http://docs.travis-ci.com/user/languages/r/ -language: c +language: R +sudo: required +warnings_are_errors: true -env: - - global: - - WARNINGS_ARE_ERRORS=1 +r_github_packages: + - hadley/httr + - jeroenooms/jsonlite + - jeroenooms/curl + - klutometis/roxygen -before_install: - - curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh - - chmod 755 ./travis-tool.sh - - ./travis-tool.sh bootstrap -install: - - ./travis-tool.sh install_deps -script: - - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" - - ./travis-tool.sh run_tests +after_success: + - Rscript -e "library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' -after_failure: - - ./travis-tool.sh dump_logs - notifications: email: on_success: change - on_failure: change \ No newline at end of file + on_failure: change diff --git a/DESCRIPTION b/DESCRIPTION index 3a568f2..c483423 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,8 +8,8 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.1-2 -Date: 2015-6-5 +Version: 1.6.1-3 +Date: 2015-6-7 URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues Imports: From 81e049f55cccd23e479ca348e08078b4499da5fb Mon Sep 17 00:00:00 2001 From: dmpe Date: Tue, 7 Jul 2015 18:50:08 +0200 Subject: [PATCH 29/55] divide in two steps --- .travis.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3f6e781..f8a12ef 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,8 +14,10 @@ r_github_packages: - jeroenooms/curl - klutometis/roxygen -after_success: +before_install: - Rscript -e "library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" + +after_success: - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' notifications: From d76380326fe80dbce9cecc083a967aa4bc10ffa2 Mon Sep 17 00:00:00 2001 From: dmpe Date: Tue, 7 Jul 2015 19:06:57 +0200 Subject: [PATCH 30/55] revert to the old inline style --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index f8a12ef..96ae8a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ r_github_packages: - klutometis/roxygen before_install: - - Rscript -e "library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" + - Rscript -e "install.packages('roxygen2'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" after_success: - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' From 98a655c43f2053cf0f4dc141ea1a14dc2cc7dc36 Mon Sep 17 00:00:00 2001 From: dmpe Date: Tue, 7 Jul 2015 19:19:12 +0200 Subject: [PATCH 31/55] again --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 96ae8a0..be609b7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,7 @@ r_github_packages: - klutometis/roxygen before_install: - - Rscript -e "install.packages('roxygen2'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" + - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" after_success: - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' From 23db73cc08b87b4ba11d761eb064ceecb0772319 Mon Sep 17 00:00:00 2001 From: dmpe Date: Tue, 7 Jul 2015 19:38:23 +0200 Subject: [PATCH 32/55] upgrade packages to newer versions and remove `pck1::` --- DESCRIPTION | 8 ++--- R/RSocrata.R | 88 +++++++++++++++++++++++++++++----------------------- 2 files changed, 53 insertions(+), 43 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3a568f2..a5c6491 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,11 +13,11 @@ Date: 2015-6-5 URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues Imports: - httr (>= 0.3), - jsonlite (>= 0.9.14), - mime (>= 0.2), + httr (>= 1.0.0), + jsonlite (>= 0.9.16), + mime (>= 0.3), Depends: - curl (>= 0.5) + curl (>= 0.9.1) Suggests: RUnit Author: Hugh Devlin, Ph. D. and Tom Schenk, Jr. diff --git a/R/RSocrata.R b/R/RSocrata.R index d543b40..e148880 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -43,14 +43,15 @@ isFourByFour <- function(fourByFour) { #' URL. Will accept queries with optional API token as a separate #' argument or will also accept API token in the URL query. Will #' resolve conflicting API token by deferring to original URL. -#' @param url a string; character vector of length one +#' @param url a string; character vector of length one #' @param app_token a string; SODA API token used to query the data #' portal \url{http://dev.socrata.com/consumers/getting-started.html} #' @return a valid Url +#' @importFrom httr parse_url build_url #' @author Tom Schenk Jr \email{tom.schenk@@cityofchicago.org} validateUrl <- function(url, app_token) { url <- as.character(url) - parsedUrl <- httr::parse_url(url) + parsedUrl <- parse_url(url) if(is.null(parsedUrl$scheme) | is.null(parsedUrl$hostname) | is.null(parsedUrl$path)) stop(url, " does not appear to be a valid URL.") if(!is.null(app_token)) { # Handles the addition of API token and resolves invalid uses @@ -67,14 +68,14 @@ validateUrl <- function(url, app_token) { }) } if(substr(parsedUrl$path, 1, 9) == 'resource/') { - return(httr::build_url(parsedUrl)) # resource url already + return(build_url(parsedUrl)) # resource url already } fourByFour <- basename(parsedUrl$path) if(!isFourByFour(fourByFour)) stop(fourByFour, " is not a valid Socrata dataset unique identifier.") else { parsedUrl$path <- paste('resource/', fourByFour, '.csv', sep="") - httr::build_url(parsedUrl) + build_url(parsedUrl) } } @@ -110,35 +111,38 @@ posixify <- function(x) { strptime(x, format="%m/%d/%Y %I:%M:%S %p") # long date-time format } -# Wrap httr GET in some diagnostics -# -# In case of failure, report error details from Socrata -# -# @param url Socrata Open Data Application Program Interface (SODA) query -# @return httr response object -# @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} +#' Wrap httr GET in some diagnostics +#' +#' In case of failure, report error details from Socrata +#' +#' @param url Socrata Open Data Application Program Interface (SODA) query +#' @return httr response object +#' @importFrom httr http_status GET stop_for_status content +#' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} getResponse <- function(url) { - response <- httr::GET(url) - status <- httr::http_status(response) + response <- GET(url) + status <- http_status(response) if(response$status_code != 200) { msg <- paste("Error in httr GET:", response$status_code, response$headers$statusmessage, url) if(!is.null(response$headers$`content-length`) && (response$headers$`content-length` > 0)) { - details <- httr::content(response) + details <- content(response) msg <- paste(msg, details$code[1], details$message[1]) } logMsg(msg) } - httr::stop_for_status(response) + stop_for_status(response) response } -# Content parsers -# -# Return a data frame for csv -# -# @author Hugh J. Devlin \email{Hugh.Devlin@@cityofchicago.org} -# @param an httr response object -# @return data frame, possibly empty +#' Content parsers +#' +#' Return a data frame for csv +#' +#' @author Hugh J. Devlin \email{Hugh.Devlin@@cityofchicago.org} +#' @importFrom httr content +#' @param an httr response object +#' @return data frame, possibly empty +#' @noRd getContentAsDataFrame <- function(response) { UseMethod('response') } getContentAsDataFrame <- function(response) { mimeType <- response$header$'content-type' @@ -147,25 +151,27 @@ getContentAsDataFrame <- function(response) { if(sep != -1) mimeType <- substr(mimeType, 0, sep[1] - 1) switch(mimeType, 'text/csv' = - httr::content(response), # automatic parsing + content(response), # automatic parsing 'application/json' = - if(httr::content(response, as='text') == "[ ]") # empty json? + if(content(response, as='text') == "[ ]") # empty json? data.frame() # empty data frame else - data.frame(t(sapply(httr::content(response), unlist)), stringsAsFactors=FALSE) + data.frame(t(sapply(content(response), unlist)), stringsAsFactors=FALSE) ) # end switch } -# Get the SoDA 2 data types -# -# Get the Socrata Open Data Application Program Interface data types from the http response header -# @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} -# @param responseHeaders headers attribute from an httr response object -# @return a named vector mapping field names to data types +#' Get the SoDA 2 data types +#' +#' Get the Socrata Open Data Application Program Interface data types from the http response header +#' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} +#' @param responseHeaders headers attribute from an httr response object +#' @return a named vector mapping field names to data types +#' @importFrom jsonlite fromJSON +#' @noRd getSodaTypes <- function(response) { UseMethod('response') } getSodaTypes <- function(response) { - result <- jsonlite::fromJSON(response$headers[['x-soda2-types']]) - names(result) <- jsonlite::fromJSON(response$headers[['x-soda2-fields']]) + result <- fromJSON(response$headers[['x-soda2-types']]) + names(result) <- fromJSON(response$headers[['x-soda2-fields']]) result } @@ -182,14 +188,16 @@ getSodaTypes <- function(response) { #' @param app_token a string; SODA API token used to query the data #' portal \url{http://dev.socrata.com/consumers/getting-started.html} #' @return an R data frame with POSIX dates -#' @export #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} #' @examples #' df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv") +#' @importFrom httr parse_url +#' @importFrom mime guess_type +#' @export read.socrata <- function(url, app_token = NULL) { validUrl <- validateUrl(url, app_token) # check url syntax, allow human-readable Socrata url - parsedUrl <- httr::parse_url(validUrl) - mimeType <- mime::guess_type(parsedUrl$path) + parsedUrl <- parse_url(validUrl) + mimeType <- guess_type(parsedUrl$path) if(!(mimeType %in% c('text/csv','application/json'))) stop("Error in read.socrata: ", mimeType, " not a supported data format.") response <- getResponse(validUrl) @@ -214,17 +222,19 @@ read.socrata <- function(url, app_token = NULL) { #' @param url A Socrata URL. This simply points to the site root. #' @return an R data frame containing a listing of datasets along with #' various metadata. -#' @export #' @author Peter Schmiedeskamp \email{pschmied@@uw.edu} #' @examples #' df <- ls.socrata("http://soda.demo.socrata.com") +#' @importFrom jsonlite fromJSON +#' @importFrom httr parse_url build_url +#' @export ls.socrata <- function(url) { url <- as.character(url) - parsedUrl <- httr::parse_url(url) + parsedUrl <- parse_url(url) if(is.null(parsedUrl$scheme) | is.null(parsedUrl$hostname)) stop(url, " does not appear to be a valid URL.") parsedUrl$path <- "data.json" - df <- jsonlite::fromJSON(httr::build_url(parsedUrl)) + df <- fromJSON(build_url(parsedUrl)) df <- as.data.frame(df$dataset) df$issued <- as.POSIXct(df$issued) df$modified <- as.POSIXct(df$modified) From 6b13eeb7fb28bb02bb7a3056e01e2ecdac66c78f Mon Sep 17 00:00:00 2001 From: dmpe Date: Tue, 7 Jul 2015 19:54:41 +0200 Subject: [PATCH 33/55] upgrade description for the seocnd time --- DESCRIPTION | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index a5c6491..6be579f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,4 +1,5 @@ Package: RSocrata +Type: Package Title: Download 'Socrata' Data Sets as R Data Frames Description: Provides easier interaction with Socrata open data portals http://dev.socrata.com. @@ -10,16 +11,21 @@ Description: Provides easier interaction with Manages throttling by 'Socrata'. Version: 1.6.1-2 Date: 2015-6-5 -URL: https://github.com/Chicago/RSocrata -BugReports: https://github.com/Chicago/RSocrata/issues +Depends: + R (>= 3.0.0) Imports: httr (>= 1.0.0), jsonlite (>= 0.9.16), mime (>= 0.3), -Depends: curl (>= 0.9.1) Suggests: - RUnit -Author: Hugh Devlin, Ph. D. and Tom Schenk, Jr. + RUnit, + roxygen2 (>= 4.1.0) +Authors@R: c( + person("Hugh", "Devlin, Ph. D.", role = c("aut", "cre")), + person("Tom", "Schenk, Jr.", role = c("aut", "cre")) +) Maintainer: Tom Schenk Jr License: MIT + file LICENSE +URL: https://github.com/Chicago/RSocrata +BugReports: https://github.com/Chicago/RSocrata/issues \ No newline at end of file From 2916b7a0be56179b95fb7e3435450dad9a322c4a Mon Sep 17 00:00:00 2001 From: dmpe Date: Tue, 7 Jul 2015 20:17:34 +0200 Subject: [PATCH 34/55] import all, not just specific functions --- DESCRIPTION | 12 ++++++------ NAMESPACE | 12 +++++++----- R/RSocrata.R | 17 +++++++++-------- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6be579f..8699be7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -9,8 +9,8 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.1-2 -Date: 2015-6-5 +Version: 1.6.1-3 +Date: 2015-6-8 Depends: R (>= 3.0.0) Imports: @@ -22,10 +22,10 @@ Suggests: RUnit, roxygen2 (>= 4.1.0) Authors@R: c( - person("Hugh", "Devlin, Ph. D.", role = c("aut", "cre")), - person("Tom", "Schenk, Jr.", role = c("aut", "cre")) -) + person("Hugh", "Devlin, Ph. D.", role = c("aut")), + person("Tom", "Schenk, Jr.", role = c("cre"), email = "developers@cityofchicago.org") + ) Maintainer: Tom Schenk Jr License: MIT + file LICENSE URL: https://github.com/Chicago/RSocrata -BugReports: https://github.com/Chicago/RSocrata/issues \ No newline at end of file +BugReports: https://github.com/Chicago/RSocrata/issues diff --git a/NAMESPACE b/NAMESPACE index a722644..93f73e8 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,8 +1,10 @@ +# Generated by roxygen2 (4.1.1): do not edit by hand + export(fieldName) +export(ls.socrata) export(posixify) export(read.socrata) -export(ls.socrata) -importFrom("httr", "parse_url", "build_url", "http_status", "stop_for_status", "GET", "content") -importFrom("mime", "guess_type") -importFrom("jsonlite", "fromJSON") -import("curl") +import(curl) +import(httr) +import(jsonlite) +import(mime) diff --git a/R/RSocrata.R b/R/RSocrata.R index e148880..b0beb32 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -47,7 +47,7 @@ isFourByFour <- function(fourByFour) { #' @param app_token a string; SODA API token used to query the data #' portal \url{http://dev.socrata.com/consumers/getting-started.html} #' @return a valid Url -#' @importFrom httr parse_url build_url +#' @import httr #' @author Tom Schenk Jr \email{tom.schenk@@cityofchicago.org} validateUrl <- function(url, app_token) { url <- as.character(url) @@ -117,7 +117,7 @@ posixify <- function(x) { #' #' @param url Socrata Open Data Application Program Interface (SODA) query #' @return httr response object -#' @importFrom httr http_status GET stop_for_status content +#' @import httr #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} getResponse <- function(url) { response <- GET(url) @@ -139,7 +139,7 @@ getResponse <- function(url) { #' Return a data frame for csv #' #' @author Hugh J. Devlin \email{Hugh.Devlin@@cityofchicago.org} -#' @importFrom httr content +#' @import httr #' @param an httr response object #' @return data frame, possibly empty #' @noRd @@ -166,7 +166,7 @@ getContentAsDataFrame <- function(response) { #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} #' @param responseHeaders headers attribute from an httr response object #' @return a named vector mapping field names to data types -#' @importFrom jsonlite fromJSON +#' @import jsonlite #' @noRd getSodaTypes <- function(response) { UseMethod('response') } getSodaTypes <- function(response) { @@ -191,8 +191,9 @@ getSodaTypes <- function(response) { #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} #' @examples #' df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv") -#' @importFrom httr parse_url -#' @importFrom mime guess_type +#' @import httr +#' @import mime +#' @import curl #' @export read.socrata <- function(url, app_token = NULL) { validUrl <- validateUrl(url, app_token) # check url syntax, allow human-readable Socrata url @@ -225,8 +226,8 @@ read.socrata <- function(url, app_token = NULL) { #' @author Peter Schmiedeskamp \email{pschmied@@uw.edu} #' @examples #' df <- ls.socrata("http://soda.demo.socrata.com") -#' @importFrom jsonlite fromJSON -#' @importFrom httr parse_url build_url +#' @import jsonlite +#' @import httr #' @export ls.socrata <- function(url) { url <- as.character(url) From ce84fd7f4abf3d5ea4638a3ea7bbb8120961bdbc Mon Sep 17 00:00:00 2001 From: dmpe Date: Wed, 8 Jul 2015 15:57:22 +0200 Subject: [PATCH 35/55] I have no idea what is being merge in what, and where is what being (newly) developed. --- R/RSocrata.R | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/RSocrata.R b/R/RSocrata.R index b0beb32..475cb2b 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -90,7 +90,7 @@ validateUrl <- function(url, app_token) { #' @export #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} #' @examples -#' #fieldName("Number.of.Stations") # number_of_stations +#' fieldName("Number.of.Stations") # number_of_stations fieldName <- function(humanName) { tolower(gsub('\\.', '_', as.character(humanName))) } diff --git a/README.md b/README.md index 64ecfec..65c593d 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ If you would like to contribute to this project, please see the [contributing do 1.4 Add json file format for Socrata downloads. Switch to RJSONIO rom rjson. 1.5 Several changes: -* Swapped ```jsonlite``` to ```RJSONIO``` +* Swapped ```jsonlite``` from ```RJSONIO``` * Added handling for long and short dates * Added unit test for reading private datasets From b377cc7ae597d17f33a3cc8e955a7c981d4d76d7 Mon Sep 17 00:00:00 2001 From: dmpe Date: Wed, 8 Jul 2015 16:12:27 +0200 Subject: [PATCH 36/55] delete curl dependency, unnecessary --- DESCRIPTION | 13 ++++++------- NAMESPACE | 1 - R/RSocrata.R | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8699be7..82e61b6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,21 +11,20 @@ Description: Provides easier interaction with Manages throttling by 'Socrata'. Version: 1.6.1-3 Date: 2015-6-8 +Authors@R: c( + person("Hugh", "Devlin, Ph. D.", role = c("aut")), + person("Tom", "Schenk, Jr.", role = c("cre"), email = "developers@cityofchicago.org") + ) +Maintainer: Tom Schenk Jr Depends: R (>= 3.0.0) Imports: httr (>= 1.0.0), jsonlite (>= 0.9.16), - mime (>= 0.3), - curl (>= 0.9.1) + mime (>= 0.3) Suggests: RUnit, roxygen2 (>= 4.1.0) -Authors@R: c( - person("Hugh", "Devlin, Ph. D.", role = c("aut")), - person("Tom", "Schenk, Jr.", role = c("cre"), email = "developers@cityofchicago.org") - ) -Maintainer: Tom Schenk Jr License: MIT + file LICENSE URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues diff --git a/NAMESPACE b/NAMESPACE index 93f73e8..5d0e883 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,7 +4,6 @@ export(fieldName) export(ls.socrata) export(posixify) export(read.socrata) -import(curl) import(httr) import(jsonlite) import(mime) diff --git a/R/RSocrata.R b/R/RSocrata.R index 475cb2b..778d749 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -193,7 +193,6 @@ getSodaTypes <- function(response) { #' df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv") #' @import httr #' @import mime -#' @import curl #' @export read.socrata <- function(url, app_token = NULL) { validUrl <- validateUrl(url, app_token) # check url syntax, allow human-readable Socrata url From 0fe24576a3521cc6fea6066eba71ca396fd138ad Mon Sep 17 00:00:00 2001 From: dmpe Date: Wed, 8 Jul 2015 16:34:25 +0200 Subject: [PATCH 37/55] smaller changes --- DESCRIPTION | 6 +++--- NAMESPACE | 2 ++ R/RSocrata.R | 2 +- RSocrata.Rproj | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 82e61b6..35808d2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -9,13 +9,13 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.1-3 +Version: 1.6.2 Date: 2015-6-8 Authors@R: c( person("Hugh", "Devlin, Ph. D.", role = c("aut")), - person("Tom", "Schenk, Jr.", role = c("cre"), email = "developers@cityofchicago.org") + person("Tom", "Schenk", role = c("cre"), email = "developers@cityofchicago.org") ) -Maintainer: Tom Schenk Jr +Maintainer: Tom Schenk Depends: R (>= 3.0.0) Imports: diff --git a/NAMESPACE b/NAMESPACE index 5d0e883..37a09a4 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,3 +7,5 @@ export(read.socrata) import(httr) import(jsonlite) import(mime) +importFrom(httr,build_url) +importFrom(httr,parse_url) diff --git a/R/RSocrata.R b/R/RSocrata.R index 778d749..b401eca 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -191,7 +191,7 @@ getSodaTypes <- function(response) { #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} #' @examples #' df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv") -#' @import httr +#' @importFrom httr parse_url build_url #' @import mime #' @export read.socrata <- function(url, app_token = NULL) { diff --git a/RSocrata.Rproj b/RSocrata.Rproj index c3e4e80..584b854 100644 --- a/RSocrata.Rproj +++ b/RSocrata.Rproj @@ -13,6 +13,7 @@ RnwWeave: Sweave LaTeX: pdfLaTeX BuildType: Package +PackageUseDevtools: Yes PackageInstallArgs: --no-multiarch --with-keep.source PackageCheckArgs: --as-cran PackageRoxygenize: rd,collate,namespace From 04bb2458d3560b8b81ae744f4a4dea49aa7dc1e8 Mon Sep 17 00:00:00 2001 From: dmpe Date: Wed, 8 Jul 2015 18:51:26 +0200 Subject: [PATCH 38/55] add @dmpe as an contributor --- DESCRIPTION | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 35808d2..d0e9eda 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -13,7 +13,8 @@ Version: 1.6.2 Date: 2015-6-8 Authors@R: c( person("Hugh", "Devlin, Ph. D.", role = c("aut")), - person("Tom", "Schenk", role = c("cre"), email = "developers@cityofchicago.org") + person("Tom", "Schenk", role = c("cre"), email = "developers@cityofchicago.org"), + person("John", "Malc", email = "cincenko@outlook.com", role = c("ctb"), comment = "@dmpe") ) Maintainer: Tom Schenk Depends: @@ -24,7 +25,8 @@ Imports: mime (>= 0.3) Suggests: RUnit, - roxygen2 (>= 4.1.0) + roxygen2 (>= 4.1.0), + testthat (>= 0.10.0) License: MIT + file LICENSE URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues From 0134c71e65d2e9ea358db6474bda7299b5a8fd3a Mon Sep 17 00:00:00 2001 From: dmpe Date: Wed, 8 Jul 2015 19:56:41 +0200 Subject: [PATCH 39/55] 6 test will still fail, without bigger changes to the code udpate description --- DESCRIPTION | 12 +-- tests/testthat.R | 4 + tests/testthat/test-all.R | 203 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 213 insertions(+), 6 deletions(-) create mode 100644 tests/testthat.R create mode 100644 tests/testthat/test-all.R diff --git a/DESCRIPTION b/DESCRIPTION index c483423..0ba45af 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,18 +8,18 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.1-3 -Date: 2015-6-7 +Version: 1.6.1-4 +Date: 2015-7-10 URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues -Imports: +Imports: httr (>= 0.3), jsonlite (>= 0.9.14), mime (>= 0.2), -Depends: +Depends: curl (>= 0.5) -Suggests: - RUnit +Suggests: + testthat (>= 0.10.0) Author: Hugh Devlin, Ph. D. and Tom Schenk, Jr. Maintainer: Tom Schenk Jr License: MIT + file LICENSE diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..8604f6c --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(RSocrata) + +test_check("RSocrata") diff --git a/tests/testthat/test-all.R b/tests/testthat/test-all.R new file mode 100644 index 0000000..add785d --- /dev/null +++ b/tests/testthat/test-all.R @@ -0,0 +1,203 @@ +library(testthat) +library(RSocrata) +library(curl) +library(httr) +library(jsonlite) +library(mime) + +context("posixify function") + +test_that("posixify returns Long format", { + dt <- posixify("09/14/2012 10:38:01 PM") + expect_equal("POSIXlt", class(dt)[1], "first data type of a date") + expect_equal(2012, dt$year + 1900, "year") + expect_equal(9, dt$mon + 1, "month") + expect_equal(14, dt$mday, "day") + expect_equal(22, dt$hour, "hours") + expect_equal(38, dt$min, "minutes") + expect_equal(1, dt$sec, "seconds") +}) + + +test_that("posixify returns Short format", { + dt <- posixify("09/14/2012") + expect_equal("POSIXlt", class(dt)[1], "first data type of a date") + expect_equal(2012, dt$year + 1900, "year") + expect_equal(9, dt$mon + 1, "month") + expect_equal(14, dt$mday, "day") + expect_equal(0, dt$hour, "hours") + expect_equal(0, dt$min, "minutes") + expect_equal(0, dt$sec, "seconds") +}) + +context("read Socrata") + +test_that("read Socrata CSV", { + df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv') + expect_equal(1007, nrow(df), "rows") + expect_equal(9, ncol(df), "columns") +}) + +test_that("read Socrata JSON", { + df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.json') + expect_equal(1007, nrow(df), "rows") + expect_equal(11, ncol(df), "columns") +}) + +test_that("read Socrata No Scheme", { + expect_error(read.socrata('soda.demo.socrata.com/resource/4334-bgaj.csv')) +}) + +test_that("readSoQL", { + df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=region') + expect_equal(1007, nrow(df), "rows") + expect_equal(1, ncol(df), "columns") +}) + +test_that("readSoQLColumnNotFound (will fail)", { + # SoQL API uses field names, not human names + expect_error(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=Region')) +}) + +test_that("URL is private (Unauthorized) (will fail)", { + expect_error(read.socrata('http://data.cityofchicago.org/resource/j8vp-2qpg.json')) +}) + +test_that("readSocrataHumanReadable", { + df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj') + expect_equal(1007, nrow(df), "rows") + expect_equal(9, ncol(df), "columns") +}) + +test_that("format is not supported", { + # Unsupported data formats + expect_error(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.xml')) +}) + +context("Socrata Calendar") + +test_that("Calendar Date Long", { + df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv') + dt <- df$Datetime[1] # "2012-09-14 22:38:01" + expect_equal("POSIXlt", class(dt)[1], "data type of a date") + expect_equal(2012, dt$year + 1900, "year") + expect_equal(9, dt$mon + 1, "month") + expect_equal(14, dt$mday, "day") + expect_equal(22, dt$hour, "hours") + expect_equal(38, dt$min, "minutes") + expect_equal(1, dt$sec, "seconds") +}) + +test_that("Calendar Date Short", { + df <- read.socrata('http://data.cityofchicago.org/resource/y93d-d9e3.csv?$order=debarment_date') + dt <- df$DEBARMENT.DATE[1] # "05/21/1981" + expect_equal("POSIXlt", class(dt)[1], "data type of a date") + expect_equal(81, dt$year, "year") + expect_equal(5, dt$mon + 1, "month") + expect_equal(21, dt$mday, "day") + expect_equal(0, dt$hour, "hours") + expect_equal(0, dt$min, "minutes") + expect_equal(0, dt$sec, "seconds") +}) + +context("Checks the validity of 4x4") + +test_that("is 4x4", { + expect_true(isFourByFour("4334-bgaj"), "ok") + expect_false(isFourByFour("4334c-bgajc"), "11 characters instead of 9") + expect_false(isFourByFour("433-bga"), "7 characters instead of 9") + expect_false(isFourByFour("433-bgaj"), "3 characters before dash instead of 4") + expect_false(isFourByFour("4334-!gaj"), "non-alphanumeric character") +}) + + +test_that("is 4x4 URL", { + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/4334c-bgajc"), "11 characters instead of 9") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/433-bga"), "7 characters instead of 9") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/433-bgaj"), "3 characters before dash instead of 4") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/4334-!gaj"), "non-alphanumeric character") +}) + +test_that("Invalid URL", { + expect_error(read.socrata("a.fake.url.being.tested"), "invalid url") +}) + +context("Test Socrata with Token") + +test_that("CSV with Token", { + df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") + expect_equal(1007, nrow(df), "rows") + expect_equal(9, ncol(df), "columns") +}) + + +test_that("readSocrataHumanReadableToken", { + df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") + expect_equal(1007, nrow(df), "rows") + expect_equal(9, ncol(df), "columns") +}) + +test_that("API Conflict", { + df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") + expect_equal(1007, nrow(df), "rows") + expect_equal(9, ncol(df), "columns") + # Check that function is calling the API token specified in url + expect_true(substr(validateUrl('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") +}) + +test_that("readAPIConflictHumanReadable", { + df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") + expect_equal(1007, nrow(df), "rows") + expect_equal(9, ncol(df), "columns") + # Check that function is calling the API token specified in url + expect_true(substr(validateUrl('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") +}) + +test_that("incorrect API Query", { + # The query below is missing a $ before app_token. + expect_error(read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) + # Check that it was only because of missing $ + df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") + expect_equal(1007, nrow(df), "rows") + expect_equal(9, ncol(df), "columns") +}) + + +test_that("incorrect API Query Human Readable", { + # The query below is missing a $ before app_token. + expect_error(read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) + # Check that it was only because of missing $ + df <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") + expect_equal(1007, nrow(df), "rows") + expect_equal(9, ncol(df), "columns") +}) + +test_that("List datasets available from a Socrata domain", { + # Makes some potentially erroneous assumptions about availability + # of soda.demo.socrata.com + df <- ls.socrata("https://soda.demo.socrata.com") + expect_equal(TRUE, nrow(df) > 0) + # Test comparing columns against data.json specifications: + # https://project-open-data.cio.gov/v1.1/schema/ + core_names <- as.character(c("issued", "modified", "keyword", "landingPage", "theme", + "title", "accessLevel", "distribution", "description", + "identifier", "publisher", "contactPoint", "license")) + expect_equal(as.logical(rep(TRUE, length(core_names))), core_names %in% names(df)) + # Check that all names in data.json are accounted for in ls.socrata return + expect_equal(as.logical(rep(TRUE, length(names(df)))), names(df) %in% c(core_names)) +}) + + +test_that("Invalid Socrata domain", { + expect_error(read.socrata("a.fake.url.being.tested"), "invalid url") +}) + + + + + + + + + + From 57a32958203944eb0a6239aa6498e24bfdbd2f06 Mon Sep 17 00:00:00 2001 From: dmpe Date: Wed, 8 Jul 2015 20:03:16 +0200 Subject: [PATCH 40/55] delete tests based on RUnit --- R/tests/testRSocrata.R | 196 ----------------------------------------- 1 file changed, 196 deletions(-) delete mode 100644 R/tests/testRSocrata.R diff --git a/R/tests/testRSocrata.R b/R/tests/testRSocrata.R deleted file mode 100644 index 85aa7b3..0000000 --- a/R/tests/testRSocrata.R +++ /dev/null @@ -1,196 +0,0 @@ -# RUnit tests -# -# resource 4334-bgaj on the Socrata demo site is USGS Earthquakes for 2012-11-01 API School Demo -# -# Author: Hugh 2013-07-15 -############################################################################### - -library('RUnit') - -source("R/RSocrata.R") - -test.posixifyLong <- function() { - dt <- posixify("09/14/2012 10:38:01 PM") - checkEquals("POSIXlt", class(dt)[1], "first data type of a date") - checkEquals(2012, dt$year + 1900, "year") - checkEquals(9, dt$mon + 1, "month") - checkEquals(14, dt$mday, "day") - checkEquals(22, dt$hour, "hours") - checkEquals(38, dt$min, "minutes") - checkEquals(1, dt$sec, "seconds") -} - -test.posixifyShort <- function() { - dt <- posixify("09/14/2012") - checkEquals("POSIXlt", class(dt)[1], "first data type of a date") - checkEquals(2012, dt$year + 1900, "year") - checkEquals(9, dt$mon + 1, "month") - checkEquals(14, dt$mday, "day") - checkEquals(0, dt$hour, "hours") - checkEquals(0, dt$min, "minutes") - checkEquals(0, dt$sec, "seconds") -} - -test.readSocrataCsv <- function() { - df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv') - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.readSocrataJson <- function() { - df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.json') - checkEquals(1007, nrow(df), "rows") - checkEquals(11, ncol(df), "columns") -} - -test.readSocrataNoScheme <- function() { - checkException(read.socrata('soda.demo.socrata.com/resource/4334-bgaj.csv')) -} - -test.readSoQL <- function() { - df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=region') - checkEquals(1007, nrow(df), "rows") - checkEquals(1, ncol(df), "columns") -} - -test.readSoQLColumnNotFound <- function() { - # SoQL API uses field names, not human names - checkException(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=Region')) -} - -test.readPrivate <- function() { - checkException(read.socrata('http://data.cityofchicago.org/resource/j8vp-2qpg.json')) -} - -test.readSocrataHumanReadable <- function() { - df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj') - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.readSocrataFormatNotSupported <- function() { - # Unsupported data formats - checkException(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.xml')) -} - -test.readSocrataCalendarDateLong <- function() { - df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv') - dt <- df$Datetime[1] # "2012-09-14 22:38:01" - checkEquals("POSIXlt", class(dt)[1], "data type of a date") - checkEquals(2012, dt$year + 1900, "year") - checkEquals(9, dt$mon + 1, "month") - checkEquals(14, dt$mday, "day") - checkEquals(22, dt$hour, "hours") - checkEquals(38, dt$min, "minutes") - checkEquals(1, dt$sec, "seconds") -} - -test.readSocrataCalendarDateShort <- function() { - df <- read.socrata('http://data.cityofchicago.org/resource/y93d-d9e3.csv?$order=debarment_date') - dt <- df$DEBARMENT.DATE[1] # "05/21/1981" - checkEquals("POSIXlt", class(dt)[1], "data type of a date") - checkEquals(81, dt$year, "year") - checkEquals(5, dt$mon + 1, "month") - checkEquals(21, dt$mday, "day") - checkEquals(0, dt$hour, "hours") - checkEquals(0, dt$min, "minutes") - checkEquals(0, dt$sec, "seconds") -} - -test.isFourByFour <- function() { - checkTrue(isFourByFour("4334-bgaj"), "ok") - checkTrue(!isFourByFour("4334c-bgajc"), "11 characters instead of 9") - checkTrue(!isFourByFour("433-bga"), "7 characters instead of 9") - checkTrue(!isFourByFour("433-bgaj"), "3 characters before dash instead of 4") - checkTrue(!isFourByFour("4334-!gaj"), "non-alphanumeric character") -} - -test.isFourByFourUrl <- function() { - checkException(read.socrata("https://soda.demo.socrata.com/api/views/4334c-bgajc"), "11 characters instead of 9") - checkException(read.socrata("https://soda.demo.socrata.com/api/views/433-bga"), "7 characters instead of 9") - checkException(read.socrata("https://soda.demo.socrata.com/api/views/433-bgaj"), "3 characters before dash instead of 4") - checkException(read.socrata("https://soda.demo.socrata.com/api/views/4334-!gaj"), "non-alphanumeric character") -} - -test.readSocrataInvalidUrl <- function() { - checkException(read.socrata("a.fake.url.being.tested"), "invalid url") -} - -test.readSocrataToken <- function(){ - df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.readSocrataHumanReadableToken <- function(){ - df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.readAPIConflict <- function(){ - df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") - # Check that function is calling the API token specified in url - checkTrue(substr(validateUrl('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") -} - -test.readAPIConflictHumanReadable <- function(){ - df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") - # Check that function is calling the API token specified in url - checkTrue(substr(validateUrl('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") -} - -test.incorrectAPIQuery <- function(){ - # The query below is missing a $ before app_token. - checkException(read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) - # Check that it was only because of missing $ - df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.incorrectAPIQueryHumanReadable <- function(){ - # The query below is missing a $ before app_token. - checkException(read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) - # Check that it was only because of missing $ - df <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.lsSocrata <- function() { - # Makes some potentially erroneous assumptions about availability - # of soda.demo.socrata.com - df <- ls.socrata("https://soda.demo.socrata.com") - checkEquals(TRUE, nrow(df) > 0) - # Test comparing columns against data.json specifications: - # https://project-open-data.cio.gov/v1.1/schema/ - core_names <- as.character(c("issued", "modified", "keyword", "landingPage", "theme", - "title", "accessLevel", "distribution", "description", - "identifier", "publisher", "contactPoint", "license")) - checkEquals(as.logical(rep(TRUE, length(core_names))), core_names %in% names(df)) - # Check that all names in data.json are accounted for in ls.socrata return - checkEquals(as.logical(rep(TRUE, length(names(df)))), names(df) %in% c(core_names)) -} - -test.lsSocrataInvalidURL <- function() { - checkException(read.socrata("a.fake.url.being.tested"), "invalid url") -} - -test.suite <- defineTestSuite("test Socrata SODA interface", - dirs = file.path("R/tests"), - testFileRegexp = '^test.*\\.R') - -runAllTests <- function() { # Run during development, will complete regardless of errors - test.result <- runTestSuite(test.suite) - printTextProtocol(test.result) -} - -runAllTestsCI <- function() { # Ran for continuous integration tests, will stop if error found - test.result <- runTestSuite(test.suite) - if(getErrors(test.result)$nErr > 0 | getErrors(test.result)$nFail > 0) stop("TEST HAD ERRORS!") -} \ No newline at end of file From d83530a5d3101e88d06420ddc85a71939a28166f Mon Sep 17 00:00:00 2001 From: dmpe Date: Wed, 8 Jul 2015 20:14:56 +0200 Subject: [PATCH 41/55] add coveralls badge to readme. #48 https://github.com/Chicago/RSocrata/issues/48#issuecomment-119613385 --- .travis.yml | 7 ++++--- README.md | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index be609b7..a963a19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,12 +13,13 @@ r_github_packages: - jeroenooms/jsonlite - jeroenooms/curl - klutometis/roxygen + - jimhester/covr before_install: - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" - -after_success: - - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' + +after_success: + - Rscript -e 'library(covr);coveralls()' notifications: email: diff --git a/README.md b/README.md index 64ecfec..a3abc97 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ RSocrata [![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) +[![Coverage Status](https://img.shields.io/coveralls/Chicago/RSocrata.svg)](https://coveralls.io/r/Chicago/RSocrata?branch=master) + + A tool for downloading Socrata datasets as R data frames -------------------------------------------------------- From 4b124e209c8e23f5c948cbda7c527fb98a9b768d Mon Sep 17 00:00:00 2001 From: dmpe Date: Wed, 8 Jul 2015 20:16:54 +0200 Subject: [PATCH 42/55] https://github.com/Chicago/RSocrata/pull/47#discussion-diff-34170071 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a3abc97..3aeff34 100644 --- a/README.md +++ b/README.md @@ -72,10 +72,10 @@ If you would like to contribute to this project, please see the [contributing do 1.3 Added support for human-readable URL. -1.4 Add json file format for Socrata downloads. Switch to RJSONIO rom rjson. +1.4 Add json file format for Socrata downloads. Switch from `RJSONIO` to ```rjson`. 1.5 Several changes: -* Swapped ```jsonlite``` to ```RJSONIO``` +* Swapped ```jsonlite``` from ```RJSONIO``` * Added handling for long and short dates * Added unit test for reading private datasets From cc1ba9f3d6e3a79a05fcc59b8a4add8bbba4f6b6 Mon Sep 17 00:00:00 2001 From: dmpe Date: Wed, 8 Jul 2015 21:19:21 +0200 Subject: [PATCH 43/55] @param a xxx -> should be @param a - xxx --- DESCRIPTION | 3 +-- NAMESPACE | 9 ++++++--- R/RSocrata.R | 43 ++++++++++++++++++++++--------------------- 3 files changed, 29 insertions(+), 26 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index d0e9eda..c1cfde6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,8 +25,7 @@ Imports: mime (>= 0.3) Suggests: RUnit, - roxygen2 (>= 4.1.0), - testthat (>= 0.10.0) + roxygen2 (>= 4.1.0) License: MIT + file LICENSE URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues diff --git a/NAMESPACE b/NAMESPACE index 37a09a4..c9af39f 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -4,8 +4,11 @@ export(fieldName) export(ls.socrata) export(posixify) export(read.socrata) -import(httr) -import(jsonlite) -import(mime) +importFrom(httr,GET) importFrom(httr,build_url) +importFrom(httr,content) +importFrom(httr,http_status) importFrom(httr,parse_url) +importFrom(httr,stop_for_status) +importFrom(jsonlite,fromJSON) +importFrom(mime,guess_type) diff --git a/R/RSocrata.R b/R/RSocrata.R index b401eca..cf0c194 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -10,7 +10,7 @@ #' Time-stamped message #' #' Issue a time-stamped, origin-stamped log message. -#' @param s a string +#' @param s - a string #' @return None (invisible NULL) as per cat #' @author Hugh J. Devlin \email{Hugh.Devlin@@cityofchicago.org} logMsg <- function(s) { @@ -23,7 +23,7 @@ logMsg <- function(s) { #' supported by Socrata. It will provide an exception if the syntax #' does not align to Socrata unique identifiers. It only checks for #' the validity of the syntax, but does not check if it actually exists. -#' @param fourByFour a string; character vector of length one +#' @param fourByFour - a string; character vector of length one #' @return TRUE if is valid Socrata unique identifier, FALSE otherwise #' @author Tom Schenk Jr \email{tom.schenk@@cityofchicago.org} isFourByFour <- function(fourByFour) { @@ -43,11 +43,11 @@ isFourByFour <- function(fourByFour) { #' URL. Will accept queries with optional API token as a separate #' argument or will also accept API token in the URL query. Will #' resolve conflicting API token by deferring to original URL. -#' @param url a string; character vector of length one -#' @param app_token a string; SODA API token used to query the data +#' @param url - a string; character vector of length one +#' @param app_token - a string; SODA API token used to query the data #' portal \url{http://dev.socrata.com/consumers/getting-started.html} -#' @return a valid Url -#' @import httr +#' @return a - valid Url +#' @importFrom httr parse_url build_url #' @author Tom Schenk Jr \email{tom.schenk@@cityofchicago.org} validateUrl <- function(url, app_token) { url <- as.character(url) @@ -85,7 +85,7 @@ validateUrl <- function(url, app_token) { #' as it might appear in the first row of data, #' to field name as it might appear in the HTTP header; #' that is, lower case, periods replaced with underscores#' -#' @param humanName a Socrata human-readable column name +#' @param humanName - a Socrata human-readable column name #' @return Socrata field name #' @export #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} @@ -97,7 +97,7 @@ fieldName <- function(humanName) { #' Convert Socrata calendar_date string to POSIX #' -#' @param x character vector in one of two Socrata calendar_date formats +#' @param x - character vector in one of two Socrata calendar_date formats #' @return a POSIX date #' @export #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} @@ -115,10 +115,11 @@ posixify <- function(x) { #' #' In case of failure, report error details from Socrata #' -#' @param url Socrata Open Data Application Program Interface (SODA) query +#' @param url - Socrata Open Data Application Program Interface (SODA) query #' @return httr response object -#' @import httr +#' @importFrom httr http_status GET content stop_for_status #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} +#' @noRd getResponse <- function(url) { response <- GET(url) status <- http_status(response) @@ -139,8 +140,8 @@ getResponse <- function(url) { #' Return a data frame for csv #' #' @author Hugh J. Devlin \email{Hugh.Devlin@@cityofchicago.org} -#' @import httr -#' @param an httr response object +#' @importFrom httr content +#' @param response - an httr response object #' @return data frame, possibly empty #' @noRd getContentAsDataFrame <- function(response) { UseMethod('response') } @@ -164,9 +165,9 @@ getContentAsDataFrame <- function(response) { #' #' Get the Socrata Open Data Application Program Interface data types from the http response header #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} -#' @param responseHeaders headers attribute from an httr response object +#' @param response - headers attribute from an httr response object #' @return a named vector mapping field names to data types -#' @import jsonlite +#' @importFrom jsonlite fromJSON #' @noRd getSodaTypes <- function(response) { UseMethod('response') } getSodaTypes <- function(response) { @@ -179,20 +180,20 @@ getSodaTypes <- function(response) { #' #' Manages throttling and POSIX date-time conversions #' -#' @param url A Socrata resource URL, +#' @param url - A Socrata resource URL, #' or a Socrata "human-friendly" URL, #' or Socrata Open Data Application Program Interface (SODA) query #' requesting a comma-separated download format (.csv suffix), #' May include SoQL parameters, #' but is assumed to not include a SODA offset parameter -#' @param app_token a string; SODA API token used to query the data +#' @param app_token - a string; SODA API token used to query the data #' portal \url{http://dev.socrata.com/consumers/getting-started.html} #' @return an R data frame with POSIX dates #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} #' @examples #' df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv") #' @importFrom httr parse_url build_url -#' @import mime +#' @importFrom mime guess_type #' @export read.socrata <- function(url, app_token = NULL) { validUrl <- validateUrl(url, app_token) # check url syntax, allow human-readable Socrata url @@ -219,14 +220,14 @@ read.socrata <- function(url, app_token = NULL) { #' List datasets available from a Socrata domain #' -#' @param url A Socrata URL. This simply points to the site root. +#' @param url - A Socrata URL. This simply points to the site root. #' @return an R data frame containing a listing of datasets along with #' various metadata. #' @author Peter Schmiedeskamp \email{pschmied@@uw.edu} #' @examples #' df <- ls.socrata("http://soda.demo.socrata.com") -#' @import jsonlite -#' @import httr +#' @importFrom jsonlite fromJSON +#' @importFrom httr parse_url #' @export ls.socrata <- function(url) { url <- as.character(url) @@ -240,4 +241,4 @@ ls.socrata <- function(url) { df$modified <- as.POSIXct(df$modified) df$theme <- as.character(df$theme) df -} \ No newline at end of file +} From 835e97811dd6614934dff84632da6b47f5499c13 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Thu, 9 Jul 2015 23:39:28 -0500 Subject: [PATCH 44/55] Changed to square badges, inline placement --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 3aeff34..849dd32 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,11 @@ RSocrata **Master** -[![Linux build - Master](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Master](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master) +[![Linux build - Master](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Master](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master)[![Coverage - Master](https://img.shields.io/coveralls/dmpe/RSocrata/master.svg?style=flat-square&label=Coverage - Master)](https://coveralls.io/r/Chicago/RSocrata?branch=master) **Dev** -[![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) - -[![Coverage Status](https://img.shields.io/coveralls/Chicago/RSocrata.svg)](https://coveralls.io/r/Chicago/RSocrata?branch=master) +[![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev)[![Coverage - Dev](https://img.shields.io/coveralls/dmpe/RSocrata/dev.svg?style=flat-square&label=Coverage status - Dev)](https://coveralls.io/r/Chicago/RSocrata?branch=dev) A tool for downloading Socrata datasets as R data frames From ddb8fbb32325d55cee0af0301b8cacbfc9604880 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Fri, 10 Jul 2015 00:45:40 -0500 Subject: [PATCH 45/55] All tests now working appropriately --- tests/testthat/test-all.R | 122 ++++++++++++++++++-------------------- 1 file changed, 58 insertions(+), 64 deletions(-) diff --git a/tests/testthat/test-all.R b/tests/testthat/test-all.R index add785d..2b319f2 100644 --- a/tests/testthat/test-all.R +++ b/tests/testthat/test-all.R @@ -9,39 +9,39 @@ context("posixify function") test_that("posixify returns Long format", { dt <- posixify("09/14/2012 10:38:01 PM") - expect_equal("POSIXlt", class(dt)[1], "first data type of a date") - expect_equal(2012, dt$year + 1900, "year") - expect_equal(9, dt$mon + 1, "month") - expect_equal(14, dt$mday, "day") - expect_equal(22, dt$hour, "hours") - expect_equal(38, dt$min, "minutes") - expect_equal(1, dt$sec, "seconds") + expect_equal("POSIXlt", class(dt)[1], label="first data type of a date") + expect_equal(2012, dt$year + 1900, label="year") + expect_equal(9, dt$mon + 1, label="month") + expect_equal(14, dt$mday, label="day") + expect_equal(22, dt$hour, label="hours") + expect_equal(38, dt$min, label="minutes") + expect_equal(1, dt$sec, label="seconds") }) test_that("posixify returns Short format", { dt <- posixify("09/14/2012") - expect_equal("POSIXlt", class(dt)[1], "first data type of a date") - expect_equal(2012, dt$year + 1900, "year") - expect_equal(9, dt$mon + 1, "month") - expect_equal(14, dt$mday, "day") - expect_equal(0, dt$hour, "hours") - expect_equal(0, dt$min, "minutes") - expect_equal(0, dt$sec, "seconds") + expect_equal("POSIXlt", class(dt)[1], label="first data type of a date") + expect_equal(2012, dt$year + 1900, label="year") + expect_equal(9, dt$mon + 1, label="month") + expect_equal(14, dt$mday, label="day") + expect_equal(0, dt$hour, label="hours") + expect_equal(0, dt$min, label="minutes") + expect_equal(0, dt$sec, label="seconds") }) context("read Socrata") test_that("read Socrata CSV", { df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv') - expect_equal(1007, nrow(df), "rows") - expect_equal(9, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") }) test_that("read Socrata JSON", { df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.json') - expect_equal(1007, nrow(df), "rows") - expect_equal(11, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(11, ncol(df), label="columns") }) test_that("read Socrata No Scheme", { @@ -50,8 +50,8 @@ test_that("read Socrata No Scheme", { test_that("readSoQL", { df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=region') - expect_equal(1007, nrow(df), "rows") - expect_equal(1, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(1, ncol(df), label="columns") }) test_that("readSoQLColumnNotFound (will fail)", { @@ -65,8 +65,8 @@ test_that("URL is private (Unauthorized) (will fail)", { test_that("readSocrataHumanReadable", { df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj') - expect_equal(1007, nrow(df), "rows") - expect_equal(9, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") }) test_that("format is not supported", { @@ -79,76 +79,76 @@ context("Socrata Calendar") test_that("Calendar Date Long", { df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv') dt <- df$Datetime[1] # "2012-09-14 22:38:01" - expect_equal("POSIXlt", class(dt)[1], "data type of a date") - expect_equal(2012, dt$year + 1900, "year") - expect_equal(9, dt$mon + 1, "month") - expect_equal(14, dt$mday, "day") - expect_equal(22, dt$hour, "hours") - expect_equal(38, dt$min, "minutes") - expect_equal(1, dt$sec, "seconds") + expect_equal("POSIXlt", class(dt)[1], label="data type of a date") + expect_equal(2012, dt$year + 1900, label="year") + expect_equal(9, dt$mon + 1, label="month") + expect_equal(14, dt$mday, label="day") + expect_equal(22, dt$hour, label="hours") + expect_equal(38, dt$min, label="minutes") + expect_equal(1, dt$sec, label="seconds") }) test_that("Calendar Date Short", { df <- read.socrata('http://data.cityofchicago.org/resource/y93d-d9e3.csv?$order=debarment_date') dt <- df$DEBARMENT.DATE[1] # "05/21/1981" - expect_equal("POSIXlt", class(dt)[1], "data type of a date") - expect_equal(81, dt$year, "year") - expect_equal(5, dt$mon + 1, "month") - expect_equal(21, dt$mday, "day") - expect_equal(0, dt$hour, "hours") - expect_equal(0, dt$min, "minutes") - expect_equal(0, dt$sec, "seconds") + expect_equal("POSIXlt", class(dt)[1], label="data type of a date") + expect_equal(81, dt$year, label="year") + expect_equal(5, dt$mon + 1, label="month") + expect_equal(21, dt$mday, label="day") + expect_equal(0, dt$hour, label="hours") + expect_equal(0, dt$min, label="minutes") + expect_equal(0, dt$sec, label="seconds") }) context("Checks the validity of 4x4") test_that("is 4x4", { - expect_true(isFourByFour("4334-bgaj"), "ok") - expect_false(isFourByFour("4334c-bgajc"), "11 characters instead of 9") - expect_false(isFourByFour("433-bga"), "7 characters instead of 9") - expect_false(isFourByFour("433-bgaj"), "3 characters before dash instead of 4") - expect_false(isFourByFour("4334-!gaj"), "non-alphanumeric character") + expect_true(isFourByFour("4334-bgaj"), label="ok") + expect_false(isFourByFour("4334c-bgajc"), label="11 characters instead of 9") + expect_false(isFourByFour("433-bga"), label="7 characters instead of 9") + expect_false(isFourByFour("433-bgaj"), label="3 characters before dash instead of 4") + expect_false(isFourByFour("4334-!gaj"), label="non-alphanumeric character") }) test_that("is 4x4 URL", { - expect_error(read.socrata("https://soda.demo.socrata.com/api/views/4334c-bgajc"), "11 characters instead of 9") - expect_error(read.socrata("https://soda.demo.socrata.com/api/views/433-bga"), "7 characters instead of 9") - expect_error(read.socrata("https://soda.demo.socrata.com/api/views/433-bgaj"), "3 characters before dash instead of 4") - expect_error(read.socrata("https://soda.demo.socrata.com/api/views/4334-!gaj"), "non-alphanumeric character") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/4334c-bgajc"), "4334c-bgajc is not a valid Socrata dataset unique identifier", label="11 characters instead of 9") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/433-bga"), "433-bga is not a valid Socrata dataset unique identifier", label="7 characters instead of 9") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/433-bgaj"), "433-bgaj is not a valid Socrata dataset unique identifier", label="3 characters before dash instead of 4") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/4334-!gaj"), "4334-!gaj is not a valid Socrata dataset unique identifier", label="non-alphanumeric character") }) test_that("Invalid URL", { - expect_error(read.socrata("a.fake.url.being.tested"), "invalid url") + expect_error(read.socrata("a.fake.url.being.tested"), "a.fake.url.being.tested does not appear to be a valid URL", label="invalid url") }) context("Test Socrata with Token") test_that("CSV with Token", { df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") - expect_equal(1007, nrow(df), "rows") - expect_equal(9, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") }) test_that("readSocrataHumanReadableToken", { df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") - expect_equal(1007, nrow(df), "rows") - expect_equal(9, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") }) test_that("API Conflict", { df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") - expect_equal(1007, nrow(df), "rows") - expect_equal(9, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") # Check that function is calling the API token specified in url expect_true(substr(validateUrl('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") }) test_that("readAPIConflictHumanReadable", { df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") - expect_equal(1007, nrow(df), "rows") - expect_equal(9, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") # Check that function is calling the API token specified in url expect_true(substr(validateUrl('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") }) @@ -158,8 +158,8 @@ test_that("incorrect API Query", { expect_error(read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) # Check that it was only because of missing $ df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") - expect_equal(1007, nrow(df), "rows") - expect_equal(9, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") }) @@ -168,8 +168,8 @@ test_that("incorrect API Query Human Readable", { expect_error(read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) # Check that it was only because of missing $ df <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") - expect_equal(1007, nrow(df), "rows") - expect_equal(9, ncol(df), "columns") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") }) test_that("List datasets available from a Socrata domain", { @@ -188,12 +188,6 @@ test_that("List datasets available from a Socrata domain", { }) -test_that("Invalid Socrata domain", { - expect_error(read.socrata("a.fake.url.being.tested"), "invalid url") -}) - - - From 6d90340ce22aed940a0d1828e0ed4baacfd6e2d3 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Fri, 10 Jul 2015 01:19:28 -0500 Subject: [PATCH 46/55] Removed AppVeyor reference to RUnit tests --- appveyor.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 00265ab..acf5dcc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,6 @@ build_script: test_script: - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" - travis-tool.sh run_tests - - Rscript -e "source('R/tests/testRSocrata.R'); runAllTestsCI()" on_failure: - travis-tool.sh dump_logs From 42b46ee6c8b9e882ea22f6af6035e41ccb7228f7 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Fri, 10 Jul 2015 01:35:34 -0500 Subject: [PATCH 47/55] Build number bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 0ba45af..93f9f67 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,7 +8,7 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.1-4 +Version: 1.6.1-5 Date: 2015-7-10 URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues From f4f7bebee9f52d7592831877e97750d8bd748383 Mon Sep 17 00:00:00 2001 From: dmpe Date: Fri, 10 Jul 2015 10:40:35 +0200 Subject: [PATCH 48/55] update travis and add back ::s update description to delete maintainer merge all necessary commits --- .travis.yml | 33 +++---- DESCRIPTION | 7 +- R/RSocrata.R | 26 ++--- R/tests/testRSocrata.R | 196 ------------------------------------- README.md | 5 +- appveyor.yml | 1 - tests/testthat.R | 4 + tests/testthat/test-all.R | 197 ++++++++++++++++++++++++++++++++++++++ 8 files changed, 235 insertions(+), 234 deletions(-) delete mode 100644 R/tests/testRSocrata.R create mode 100644 tests/testthat.R create mode 100644 tests/testthat/test-all.R diff --git a/.travis.yml b/.travis.yml index 8a79207..329e047 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,29 +2,26 @@ # # See README.md for instructions, or for more configuration options, # see the wiki: -# https://github.com/craigcitro/r-travis/wiki +# http://docs.travis-ci.com/user/languages/r/ -language: c +language: R +sudo: required +warnings_are_errors: true -env: - - global: - - WARNINGS_ARE_ERRORS=1 +r_github_packages: + - hadley/httr + - jeroenooms/jsonlite + - jeroenooms/curl + - klutometis/roxygen + - jimhester/covr -before_install: - - curl -OL http://raw.github.com/craigcitro/r-travis/master/scripts/travis-tool.sh - - chmod 755 ./travis-tool.sh - - ./travis-tool.sh bootstrap -install: - - ./travis-tool.sh install_deps -script: - - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" - - ./travis-tool.sh run_tests - - Rscript -e 'source("R/tests/testRSocrata.R"); runAllTestsCI()' +# before_install: +# - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" -after_failure: - - ./travis-tool.sh dump_logs +after_success: + - Rscript -e 'library(covr);coveralls()' notifications: email: on_success: change - on_failure: change \ No newline at end of file + on_failure: change diff --git a/DESCRIPTION b/DESCRIPTION index c1cfde6..1f090f6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -10,13 +10,12 @@ Description: Provides easier interaction with Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. Version: 1.6.2 -Date: 2015-6-8 +Date: 2015-7-15 Authors@R: c( person("Hugh", "Devlin, Ph. D.", role = c("aut")), - person("Tom", "Schenk", role = c("cre"), email = "developers@cityofchicago.org"), + person("Tom", "Schenk Jr.", role = c("aut", "cre"), email = "developers@cityofchicago.org"), person("John", "Malc", email = "cincenko@outlook.com", role = c("ctb"), comment = "@dmpe") ) -Maintainer: Tom Schenk Depends: R (>= 3.0.0) Imports: @@ -24,7 +23,7 @@ Imports: jsonlite (>= 0.9.16), mime (>= 0.3) Suggests: - RUnit, + testthat (>= 0.10.0), roxygen2 (>= 4.1.0) License: MIT + file LICENSE URL: https://github.com/Chicago/RSocrata diff --git a/R/RSocrata.R b/R/RSocrata.R index cf0c194..41eef9d 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -51,7 +51,7 @@ isFourByFour <- function(fourByFour) { #' @author Tom Schenk Jr \email{tom.schenk@@cityofchicago.org} validateUrl <- function(url, app_token) { url <- as.character(url) - parsedUrl <- parse_url(url) + parsedUrl <- httr::parse_url(url) if(is.null(parsedUrl$scheme) | is.null(parsedUrl$hostname) | is.null(parsedUrl$path)) stop(url, " does not appear to be a valid URL.") if(!is.null(app_token)) { # Handles the addition of API token and resolves invalid uses @@ -68,14 +68,14 @@ validateUrl <- function(url, app_token) { }) } if(substr(parsedUrl$path, 1, 9) == 'resource/') { - return(build_url(parsedUrl)) # resource url already + return(httr::build_url(parsedUrl)) # resource url already } fourByFour <- basename(parsedUrl$path) if(!isFourByFour(fourByFour)) stop(fourByFour, " is not a valid Socrata dataset unique identifier.") else { parsedUrl$path <- paste('resource/', fourByFour, '.csv', sep="") - build_url(parsedUrl) + httr::build_url(parsedUrl) } } @@ -121,17 +121,17 @@ posixify <- function(x) { #' @author Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@@cityofchicago.org} #' @noRd getResponse <- function(url) { - response <- GET(url) - status <- http_status(response) + response <- httr::GET(url) + # status <- httr::http_status(response) if(response$status_code != 200) { msg <- paste("Error in httr GET:", response$status_code, response$headers$statusmessage, url) if(!is.null(response$headers$`content-length`) && (response$headers$`content-length` > 0)) { - details <- content(response) + details <- httr::content(response) msg <- paste(msg, details$code[1], details$message[1]) } logMsg(msg) } - stop_for_status(response) + httr::stop_for_status(response) response } @@ -171,8 +171,8 @@ getContentAsDataFrame <- function(response) { #' @noRd getSodaTypes <- function(response) { UseMethod('response') } getSodaTypes <- function(response) { - result <- fromJSON(response$headers[['x-soda2-types']]) - names(result) <- fromJSON(response$headers[['x-soda2-fields']]) + result <- jsonlite::fromJSON(response$headers[['x-soda2-types']]) + names(result) <- jsonlite::fromJSON(response$headers[['x-soda2-fields']]) result } @@ -197,8 +197,8 @@ getSodaTypes <- function(response) { #' @export read.socrata <- function(url, app_token = NULL) { validUrl <- validateUrl(url, app_token) # check url syntax, allow human-readable Socrata url - parsedUrl <- parse_url(validUrl) - mimeType <- guess_type(parsedUrl$path) + parsedUrl <- httr::parse_url(validUrl) + mimeType <- mime::guess_type(parsedUrl$path) if(!(mimeType %in% c('text/csv','application/json'))) stop("Error in read.socrata: ", mimeType, " not a supported data format.") response <- getResponse(validUrl) @@ -231,11 +231,11 @@ read.socrata <- function(url, app_token = NULL) { #' @export ls.socrata <- function(url) { url <- as.character(url) - parsedUrl <- parse_url(url) + parsedUrl <- httr::parse_url(url) if(is.null(parsedUrl$scheme) | is.null(parsedUrl$hostname)) stop(url, " does not appear to be a valid URL.") parsedUrl$path <- "data.json" - df <- fromJSON(build_url(parsedUrl)) + df <- jsonlite::fromJSON(httr::build_url(parsedUrl)) df <- as.data.frame(df$dataset) df$issued <- as.POSIXct(df$issued) df$modified <- as.POSIXct(df$modified) diff --git a/R/tests/testRSocrata.R b/R/tests/testRSocrata.R deleted file mode 100644 index 85aa7b3..0000000 --- a/R/tests/testRSocrata.R +++ /dev/null @@ -1,196 +0,0 @@ -# RUnit tests -# -# resource 4334-bgaj on the Socrata demo site is USGS Earthquakes for 2012-11-01 API School Demo -# -# Author: Hugh 2013-07-15 -############################################################################### - -library('RUnit') - -source("R/RSocrata.R") - -test.posixifyLong <- function() { - dt <- posixify("09/14/2012 10:38:01 PM") - checkEquals("POSIXlt", class(dt)[1], "first data type of a date") - checkEquals(2012, dt$year + 1900, "year") - checkEquals(9, dt$mon + 1, "month") - checkEquals(14, dt$mday, "day") - checkEquals(22, dt$hour, "hours") - checkEquals(38, dt$min, "minutes") - checkEquals(1, dt$sec, "seconds") -} - -test.posixifyShort <- function() { - dt <- posixify("09/14/2012") - checkEquals("POSIXlt", class(dt)[1], "first data type of a date") - checkEquals(2012, dt$year + 1900, "year") - checkEquals(9, dt$mon + 1, "month") - checkEquals(14, dt$mday, "day") - checkEquals(0, dt$hour, "hours") - checkEquals(0, dt$min, "minutes") - checkEquals(0, dt$sec, "seconds") -} - -test.readSocrataCsv <- function() { - df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv') - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.readSocrataJson <- function() { - df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.json') - checkEquals(1007, nrow(df), "rows") - checkEquals(11, ncol(df), "columns") -} - -test.readSocrataNoScheme <- function() { - checkException(read.socrata('soda.demo.socrata.com/resource/4334-bgaj.csv')) -} - -test.readSoQL <- function() { - df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=region') - checkEquals(1007, nrow(df), "rows") - checkEquals(1, ncol(df), "columns") -} - -test.readSoQLColumnNotFound <- function() { - # SoQL API uses field names, not human names - checkException(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=Region')) -} - -test.readPrivate <- function() { - checkException(read.socrata('http://data.cityofchicago.org/resource/j8vp-2qpg.json')) -} - -test.readSocrataHumanReadable <- function() { - df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj') - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.readSocrataFormatNotSupported <- function() { - # Unsupported data formats - checkException(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.xml')) -} - -test.readSocrataCalendarDateLong <- function() { - df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv') - dt <- df$Datetime[1] # "2012-09-14 22:38:01" - checkEquals("POSIXlt", class(dt)[1], "data type of a date") - checkEquals(2012, dt$year + 1900, "year") - checkEquals(9, dt$mon + 1, "month") - checkEquals(14, dt$mday, "day") - checkEquals(22, dt$hour, "hours") - checkEquals(38, dt$min, "minutes") - checkEquals(1, dt$sec, "seconds") -} - -test.readSocrataCalendarDateShort <- function() { - df <- read.socrata('http://data.cityofchicago.org/resource/y93d-d9e3.csv?$order=debarment_date') - dt <- df$DEBARMENT.DATE[1] # "05/21/1981" - checkEquals("POSIXlt", class(dt)[1], "data type of a date") - checkEquals(81, dt$year, "year") - checkEquals(5, dt$mon + 1, "month") - checkEquals(21, dt$mday, "day") - checkEquals(0, dt$hour, "hours") - checkEquals(0, dt$min, "minutes") - checkEquals(0, dt$sec, "seconds") -} - -test.isFourByFour <- function() { - checkTrue(isFourByFour("4334-bgaj"), "ok") - checkTrue(!isFourByFour("4334c-bgajc"), "11 characters instead of 9") - checkTrue(!isFourByFour("433-bga"), "7 characters instead of 9") - checkTrue(!isFourByFour("433-bgaj"), "3 characters before dash instead of 4") - checkTrue(!isFourByFour("4334-!gaj"), "non-alphanumeric character") -} - -test.isFourByFourUrl <- function() { - checkException(read.socrata("https://soda.demo.socrata.com/api/views/4334c-bgajc"), "11 characters instead of 9") - checkException(read.socrata("https://soda.demo.socrata.com/api/views/433-bga"), "7 characters instead of 9") - checkException(read.socrata("https://soda.demo.socrata.com/api/views/433-bgaj"), "3 characters before dash instead of 4") - checkException(read.socrata("https://soda.demo.socrata.com/api/views/4334-!gaj"), "non-alphanumeric character") -} - -test.readSocrataInvalidUrl <- function() { - checkException(read.socrata("a.fake.url.being.tested"), "invalid url") -} - -test.readSocrataToken <- function(){ - df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.readSocrataHumanReadableToken <- function(){ - df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.readAPIConflict <- function(){ - df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") - # Check that function is calling the API token specified in url - checkTrue(substr(validateUrl('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") -} - -test.readAPIConflictHumanReadable <- function(){ - df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") - # Check that function is calling the API token specified in url - checkTrue(substr(validateUrl('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") -} - -test.incorrectAPIQuery <- function(){ - # The query below is missing a $ before app_token. - checkException(read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) - # Check that it was only because of missing $ - df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.incorrectAPIQueryHumanReadable <- function(){ - # The query below is missing a $ before app_token. - checkException(read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) - # Check that it was only because of missing $ - df <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") - checkEquals(1007, nrow(df), "rows") - checkEquals(9, ncol(df), "columns") -} - -test.lsSocrata <- function() { - # Makes some potentially erroneous assumptions about availability - # of soda.demo.socrata.com - df <- ls.socrata("https://soda.demo.socrata.com") - checkEquals(TRUE, nrow(df) > 0) - # Test comparing columns against data.json specifications: - # https://project-open-data.cio.gov/v1.1/schema/ - core_names <- as.character(c("issued", "modified", "keyword", "landingPage", "theme", - "title", "accessLevel", "distribution", "description", - "identifier", "publisher", "contactPoint", "license")) - checkEquals(as.logical(rep(TRUE, length(core_names))), core_names %in% names(df)) - # Check that all names in data.json are accounted for in ls.socrata return - checkEquals(as.logical(rep(TRUE, length(names(df)))), names(df) %in% c(core_names)) -} - -test.lsSocrataInvalidURL <- function() { - checkException(read.socrata("a.fake.url.being.tested"), "invalid url") -} - -test.suite <- defineTestSuite("test Socrata SODA interface", - dirs = file.path("R/tests"), - testFileRegexp = '^test.*\\.R') - -runAllTests <- function() { # Run during development, will complete regardless of errors - test.result <- runTestSuite(test.suite) - printTextProtocol(test.result) -} - -runAllTestsCI <- function() { # Ran for continuous integration tests, will stop if error found - test.result <- runTestSuite(test.suite) - if(getErrors(test.result)$nErr > 0 | getErrors(test.result)$nFail > 0) stop("TEST HAD ERRORS!") -} \ No newline at end of file diff --git a/README.md b/README.md index 65c593d..1e2b40e 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,12 @@ RSocrata **Master** -[![Linux build - Master](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Master](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master) +[![Linux build - Master](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Master](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master)[![Coverage - Master](https://img.shields.io/coveralls/dmpe/RSocrata/master.svg?style=flat-square&label=Coverage - Master)](https://coveralls.io/r/Chicago/RSocrata?branch=master) **Dev** -[![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev) +[![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev)[![Coverage - Dev](https://img.shields.io/coveralls/dmpe/RSocrata/dev.svg?style=flat-square&label=Coverage status - Dev)](https://coveralls.io/r/Chicago/RSocrata?branch=dev) + A tool for downloading Socrata datasets as R data frames -------------------------------------------------------- diff --git a/appveyor.yml b/appveyor.yml index 00265ab..acf5dcc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -15,7 +15,6 @@ build_script: test_script: - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" - travis-tool.sh run_tests - - Rscript -e "source('R/tests/testRSocrata.R'); runAllTestsCI()" on_failure: - travis-tool.sh dump_logs diff --git a/tests/testthat.R b/tests/testthat.R new file mode 100644 index 0000000..8604f6c --- /dev/null +++ b/tests/testthat.R @@ -0,0 +1,4 @@ +library(testthat) +library(RSocrata) + +test_check("RSocrata") diff --git a/tests/testthat/test-all.R b/tests/testthat/test-all.R new file mode 100644 index 0000000..2b319f2 --- /dev/null +++ b/tests/testthat/test-all.R @@ -0,0 +1,197 @@ +library(testthat) +library(RSocrata) +library(curl) +library(httr) +library(jsonlite) +library(mime) + +context("posixify function") + +test_that("posixify returns Long format", { + dt <- posixify("09/14/2012 10:38:01 PM") + expect_equal("POSIXlt", class(dt)[1], label="first data type of a date") + expect_equal(2012, dt$year + 1900, label="year") + expect_equal(9, dt$mon + 1, label="month") + expect_equal(14, dt$mday, label="day") + expect_equal(22, dt$hour, label="hours") + expect_equal(38, dt$min, label="minutes") + expect_equal(1, dt$sec, label="seconds") +}) + + +test_that("posixify returns Short format", { + dt <- posixify("09/14/2012") + expect_equal("POSIXlt", class(dt)[1], label="first data type of a date") + expect_equal(2012, dt$year + 1900, label="year") + expect_equal(9, dt$mon + 1, label="month") + expect_equal(14, dt$mday, label="day") + expect_equal(0, dt$hour, label="hours") + expect_equal(0, dt$min, label="minutes") + expect_equal(0, dt$sec, label="seconds") +}) + +context("read Socrata") + +test_that("read Socrata CSV", { + df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv') + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") +}) + +test_that("read Socrata JSON", { + df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.json') + expect_equal(1007, nrow(df), label="rows") + expect_equal(11, ncol(df), label="columns") +}) + +test_that("read Socrata No Scheme", { + expect_error(read.socrata('soda.demo.socrata.com/resource/4334-bgaj.csv')) +}) + +test_that("readSoQL", { + df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=region') + expect_equal(1007, nrow(df), label="rows") + expect_equal(1, ncol(df), label="columns") +}) + +test_that("readSoQLColumnNotFound (will fail)", { + # SoQL API uses field names, not human names + expect_error(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv?$select=Region')) +}) + +test_that("URL is private (Unauthorized) (will fail)", { + expect_error(read.socrata('http://data.cityofchicago.org/resource/j8vp-2qpg.json')) +}) + +test_that("readSocrataHumanReadable", { + df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj') + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") +}) + +test_that("format is not supported", { + # Unsupported data formats + expect_error(read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.xml')) +}) + +context("Socrata Calendar") + +test_that("Calendar Date Long", { + df <- read.socrata('http://soda.demo.socrata.com/resource/4334-bgaj.csv') + dt <- df$Datetime[1] # "2012-09-14 22:38:01" + expect_equal("POSIXlt", class(dt)[1], label="data type of a date") + expect_equal(2012, dt$year + 1900, label="year") + expect_equal(9, dt$mon + 1, label="month") + expect_equal(14, dt$mday, label="day") + expect_equal(22, dt$hour, label="hours") + expect_equal(38, dt$min, label="minutes") + expect_equal(1, dt$sec, label="seconds") +}) + +test_that("Calendar Date Short", { + df <- read.socrata('http://data.cityofchicago.org/resource/y93d-d9e3.csv?$order=debarment_date') + dt <- df$DEBARMENT.DATE[1] # "05/21/1981" + expect_equal("POSIXlt", class(dt)[1], label="data type of a date") + expect_equal(81, dt$year, label="year") + expect_equal(5, dt$mon + 1, label="month") + expect_equal(21, dt$mday, label="day") + expect_equal(0, dt$hour, label="hours") + expect_equal(0, dt$min, label="minutes") + expect_equal(0, dt$sec, label="seconds") +}) + +context("Checks the validity of 4x4") + +test_that("is 4x4", { + expect_true(isFourByFour("4334-bgaj"), label="ok") + expect_false(isFourByFour("4334c-bgajc"), label="11 characters instead of 9") + expect_false(isFourByFour("433-bga"), label="7 characters instead of 9") + expect_false(isFourByFour("433-bgaj"), label="3 characters before dash instead of 4") + expect_false(isFourByFour("4334-!gaj"), label="non-alphanumeric character") +}) + + +test_that("is 4x4 URL", { + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/4334c-bgajc"), "4334c-bgajc is not a valid Socrata dataset unique identifier", label="11 characters instead of 9") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/433-bga"), "433-bga is not a valid Socrata dataset unique identifier", label="7 characters instead of 9") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/433-bgaj"), "433-bgaj is not a valid Socrata dataset unique identifier", label="3 characters before dash instead of 4") + expect_error(read.socrata("https://soda.demo.socrata.com/api/views/4334-!gaj"), "4334-!gaj is not a valid Socrata dataset unique identifier", label="non-alphanumeric character") +}) + +test_that("Invalid URL", { + expect_error(read.socrata("a.fake.url.being.tested"), "a.fake.url.being.tested does not appear to be a valid URL", label="invalid url") +}) + +context("Test Socrata with Token") + +test_that("CSV with Token", { + df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") +}) + + +test_that("readSocrataHumanReadableToken", { + df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj', app_token="ew2rEMuESuzWPqMkyPfOSGJgE") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") +}) + +test_that("API Conflict", { + df <- read.socrata('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") + # Check that function is calling the API token specified in url + expect_true(substr(validateUrl('https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") +}) + +test_that("readAPIConflictHumanReadable", { + df <- read.socrata('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") + # Check that function is calling the API token specified in url + expect_true(substr(validateUrl('https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE', app_token="ew2rEMuESuzWPqMkyPfOSUSER"), 70, 94)=="ew2rEMuESuzWPqMkyPfOSGJgE") +}) + +test_that("incorrect API Query", { + # The query below is missing a $ before app_token. + expect_error(read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) + # Check that it was only because of missing $ + df <- read.socrata("https://soda.demo.socrata.com/resource/4334-bgaj.csv?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") +}) + + +test_that("incorrect API Query Human Readable", { + # The query below is missing a $ before app_token. + expect_error(read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$app_token=ew2rEMuESuzWPqMkyPfOSGJgE")) + # Check that it was only because of missing $ + df <- read.socrata("https://soda.demo.socrata.com/dataset/USGS-Earthquake-Reports/4334-bgaj?$$app_token=ew2rEMuESuzWPqMkyPfOSGJgE") + expect_equal(1007, nrow(df), label="rows") + expect_equal(9, ncol(df), label="columns") +}) + +test_that("List datasets available from a Socrata domain", { + # Makes some potentially erroneous assumptions about availability + # of soda.demo.socrata.com + df <- ls.socrata("https://soda.demo.socrata.com") + expect_equal(TRUE, nrow(df) > 0) + # Test comparing columns against data.json specifications: + # https://project-open-data.cio.gov/v1.1/schema/ + core_names <- as.character(c("issued", "modified", "keyword", "landingPage", "theme", + "title", "accessLevel", "distribution", "description", + "identifier", "publisher", "contactPoint", "license")) + expect_equal(as.logical(rep(TRUE, length(core_names))), core_names %in% names(df)) + # Check that all names in data.json are accounted for in ls.socrata return + expect_equal(as.logical(rep(TRUE, length(names(df)))), names(df) %in% c(core_names)) +}) + + + + + + + + + From bb8123c51a22641d7409b0e3cf64ed51c7de5fe1 Mon Sep 17 00:00:00 2001 From: dmpe Date: Fri, 10 Jul 2015 10:56:31 +0200 Subject: [PATCH 49/55] update travis, and add 2 exported methods --- .travis.yml | 3 --- NAMESPACE | 2 ++ R/RSocrata.R | 11 +++++++---- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 329e047..d9a0eb2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,9 +15,6 @@ r_github_packages: - klutometis/roxygen - jimhester/covr -# before_install: -# - Rscript -e "install.packages('roxygen2', repos='http://cran.us.r-project.org'); library(roxygen2); roxygen2::roxygenize(package.dir='.', roclets=c('rd', 'collate', 'namespace'))" - after_success: - Rscript -e 'library(covr);coveralls()' diff --git a/NAMESPACE b/NAMESPACE index c9af39f..08e66c5 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,9 +1,11 @@ # Generated by roxygen2 (4.1.1): do not edit by hand export(fieldName) +export(isFourByFour) export(ls.socrata) export(posixify) export(read.socrata) +export(validateUrl) importFrom(httr,GET) importFrom(httr,build_url) importFrom(httr,content) diff --git a/R/RSocrata.R b/R/RSocrata.R index 41eef9d..2d77146 100644 --- a/R/RSocrata.R +++ b/R/RSocrata.R @@ -13,6 +13,7 @@ #' @param s - a string #' @return None (invisible NULL) as per cat #' @author Hugh J. Devlin \email{Hugh.Devlin@@cityofchicago.org} +#' @noRd logMsg <- function(s) { cat(format(Sys.time(), "%Y-%m-%d %H:%M:%OS3 "), as.character(sys.call(-1))[1], ": ", s, '\n', sep='') } @@ -26,6 +27,7 @@ logMsg <- function(s) { #' @param fourByFour - a string; character vector of length one #' @return TRUE if is valid Socrata unique identifier, FALSE otherwise #' @author Tom Schenk Jr \email{tom.schenk@@cityofchicago.org} +#' @export isFourByFour <- function(fourByFour) { fourByFour <- as.character(fourByFour) if(nchar(fourByFour) != 9) @@ -49,6 +51,7 @@ isFourByFour <- function(fourByFour) { #' @return a - valid Url #' @importFrom httr parse_url build_url #' @author Tom Schenk Jr \email{tom.schenk@@cityofchicago.org} +#' @export validateUrl <- function(url, app_token) { url <- as.character(url) parsedUrl <- httr::parse_url(url) @@ -132,7 +135,7 @@ getResponse <- function(url) { logMsg(msg) } httr::stop_for_status(response) - response + return(response) } #' Content parsers @@ -173,7 +176,7 @@ getSodaTypes <- function(response) { UseMethod('response') } getSodaTypes <- function(response) { result <- jsonlite::fromJSON(response$headers[['x-soda2-types']]) names(result) <- jsonlite::fromJSON(response$headers[['x-soda2-fields']]) - result + return(result) } #' Get a full Socrata data set as an R data frame @@ -215,7 +218,7 @@ read.socrata <- function(url, app_token = NULL) { for(columnName in colnames(page)[!is.na(dataTypes[fieldName(colnames(page))]) & dataTypes[fieldName(colnames(page))] == 'calendar_date']) { result[[columnName]] <- posixify(result[[columnName]]) } - result + return(result) } #' List datasets available from a Socrata domain @@ -240,5 +243,5 @@ ls.socrata <- function(url) { df$issued <- as.POSIXct(df$issued) df$modified <- as.POSIXct(df$modified) df$theme <- as.character(df$theme) - df + return(df) } From 2da69f1d444ef5fd04854063d6d7b693fdc9dabd Mon Sep 17 00:00:00 2001 From: dmpe Date: Fri, 10 Jul 2015 11:03:01 +0200 Subject: [PATCH 50/55] do include man dir --- .gitignore | 1 - man/fieldName.Rd | 27 +++++++++++++++++++++++++++ man/isFourByFour.Rd | 24 ++++++++++++++++++++++++ man/ls.socrata.Rd | 25 +++++++++++++++++++++++++ man/posixify.Rd | 21 +++++++++++++++++++++ man/read.socrata.Rd | 32 ++++++++++++++++++++++++++++++++ man/validateUrl.Rd | 29 +++++++++++++++++++++++++++++ 7 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 man/fieldName.Rd create mode 100644 man/isFourByFour.Rd create mode 100644 man/ls.socrata.Rd create mode 100644 man/posixify.Rd create mode 100644 man/read.socrata.Rd create mode 100644 man/validateUrl.Rd diff --git a/.gitignore b/.gitignore index 50471e5..dccab3c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ /.README.md.html /.settings /DESCRIPTION.Rcheck -/man /out /RCheck /RSocrata_*.tar.gz diff --git a/man/fieldName.Rd b/man/fieldName.Rd new file mode 100644 index 0000000..842e19e --- /dev/null +++ b/man/fieldName.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/RSocrata.R +\name{fieldName} +\alias{fieldName} +\title{Convert Socrata human-readable column name to field name} +\usage{ +fieldName(humanName) +} +\arguments{ +\item{humanName}{- a Socrata human-readable column name} +} +\value{ +Socrata field name +} +\description{ +Convert Socrata human-readable column name, +as it might appear in the first row of data, +to field name as it might appear in the HTTP header; +that is, lower case, periods replaced with underscores#' +} +\examples{ +fieldName("Number.of.Stations") # number_of_stations +} +\author{ +Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@cityofchicago.org} +} + diff --git a/man/isFourByFour.Rd b/man/isFourByFour.Rd new file mode 100644 index 0000000..1053d42 --- /dev/null +++ b/man/isFourByFour.Rd @@ -0,0 +1,24 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/RSocrata.R +\name{isFourByFour} +\alias{isFourByFour} +\title{Checks the validity of the syntax for a potential Socrata dataset Unique Identifier, also known as a 4x4.} +\usage{ +isFourByFour(fourByFour) +} +\arguments{ +\item{fourByFour}{- a string; character vector of length one} +} +\value{ +TRUE if is valid Socrata unique identifier, FALSE otherwise +} +\description{ +Will check the validity of a potential dataset unique identifier +supported by Socrata. It will provide an exception if the syntax +does not align to Socrata unique identifiers. It only checks for +the validity of the syntax, but does not check if it actually exists. +} +\author{ +Tom Schenk Jr \email{tom.schenk@cityofchicago.org} +} + diff --git a/man/ls.socrata.Rd b/man/ls.socrata.Rd new file mode 100644 index 0000000..3fe5934 --- /dev/null +++ b/man/ls.socrata.Rd @@ -0,0 +1,25 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/RSocrata.R +\name{ls.socrata} +\alias{ls.socrata} +\title{List datasets available from a Socrata domain} +\usage{ +ls.socrata(url) +} +\arguments{ +\item{url}{- A Socrata URL. This simply points to the site root.} +} +\value{ +an R data frame containing a listing of datasets along with +various metadata. +} +\description{ +List datasets available from a Socrata domain +} +\examples{ +df <- ls.socrata("http://soda.demo.socrata.com") +} +\author{ +Peter Schmiedeskamp \email{pschmied@uw.edu} +} + diff --git a/man/posixify.Rd b/man/posixify.Rd new file mode 100644 index 0000000..269daba --- /dev/null +++ b/man/posixify.Rd @@ -0,0 +1,21 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/RSocrata.R +\name{posixify} +\alias{posixify} +\title{Convert Socrata calendar_date string to POSIX} +\usage{ +posixify(x) +} +\arguments{ +\item{x}{- character vector in one of two Socrata calendar_date formats} +} +\value{ +a POSIX date +} +\description{ +Convert Socrata calendar_date string to POSIX +} +\author{ +Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@cityofchicago.org} +} + diff --git a/man/read.socrata.Rd b/man/read.socrata.Rd new file mode 100644 index 0000000..61c3e73 --- /dev/null +++ b/man/read.socrata.Rd @@ -0,0 +1,32 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/RSocrata.R +\name{read.socrata} +\alias{read.socrata} +\title{Get a full Socrata data set as an R data frame} +\usage{ +read.socrata(url, app_token = NULL) +} +\arguments{ +\item{url}{- A Socrata resource URL, +or a Socrata "human-friendly" URL, +or Socrata Open Data Application Program Interface (SODA) query +requesting a comma-separated download format (.csv suffix), +May include SoQL parameters, +but is assumed to not include a SODA offset parameter} + +\item{app_token}{- a string; SODA API token used to query the data +portal \url{http://dev.socrata.com/consumers/getting-started.html}} +} +\value{ +an R data frame with POSIX dates +} +\description{ +Manages throttling and POSIX date-time conversions +} +\examples{ +df <- read.socrata("http://soda.demo.socrata.com/resource/4334-bgaj.csv") +} +\author{ +Hugh J. Devlin, Ph. D. \email{Hugh.Devlin@cityofchicago.org} +} + diff --git a/man/validateUrl.Rd b/man/validateUrl.Rd new file mode 100644 index 0000000..ef9a17b --- /dev/null +++ b/man/validateUrl.Rd @@ -0,0 +1,29 @@ +% Generated by roxygen2 (4.1.1): do not edit by hand +% Please edit documentation in R/RSocrata.R +\name{validateUrl} +\alias{validateUrl} +\title{Convert, if necessary, URL to valid REST API URL supported by Socrata.} +\usage{ +validateUrl(url, app_token) +} +\arguments{ +\item{url}{- a string; character vector of length one} + +\item{app_token}{- a string; SODA API token used to query the data +portal \url{http://dev.socrata.com/consumers/getting-started.html}} +} +\value{ +a - valid Url +} +\description{ +Will convert a human-readable URL to a valid REST API call +supported by Socrata. It will accept a valid API URL if provided +by users and will also convert a human-readable URL to a valid API +URL. Will accept queries with optional API token as a separate +argument or will also accept API token in the URL query. Will +resolve conflicting API token by deferring to original URL. +} +\author{ +Tom Schenk Jr \email{tom.schenk@cityofchicago.org} +} + From 4ebbaf6eadd590ff15e0fac293f9746819bbf710 Mon Sep 17 00:00:00 2001 From: dmpe Date: Fri, 10 Jul 2015 17:28:52 +0200 Subject: [PATCH 51/55] no need for curl lib --- tests/testthat/test-all.R | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/testthat/test-all.R b/tests/testthat/test-all.R index 2b319f2..052e6f2 100644 --- a/tests/testthat/test-all.R +++ b/tests/testthat/test-all.R @@ -1,6 +1,5 @@ library(testthat) library(RSocrata) -library(curl) library(httr) library(jsonlite) library(mime) From 8c5a9be4bf4d595c38717dd4bf62a678d017ab3c Mon Sep 17 00:00:00 2001 From: dmpe Date: Fri, 10 Jul 2015 18:06:10 +0200 Subject: [PATCH 52/55] update readme (#48); split news/chagelog to its own file (better user UX) and delete it from rbuild. --- .Rbuildignore | 1 - NEWS.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ README.md | 34 ++++------------------------------ 3 files changed, 49 insertions(+), 31 deletions(-) create mode 100644 NEWS.md diff --git a/.Rbuildignore b/.Rbuildignore index e19c31c..df4cd6c 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,7 +8,6 @@ RSocrata.Rcheck ^.*\.Rproj$ ^\.Rproj\.user$ .DS_Store -README.md ^\.travis\.yml$ appveyor.yml CONTRIBUTING.md \ No newline at end of file diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000..a4fafee --- /dev/null +++ b/NEWS.md @@ -0,0 +1,45 @@ +### 1.1 +Add check for valid Socrata resource URL. Add check for supported download file format. Add support for Socrata short dates. + +### 1.2 +Use comma-separated file format for Socrata downloads. + +### 1.3 +* Added support for human-readable URL. Users can now copy and paste URLs of Socrata-hosted datasets, which will be transformed into a valid SoDA API web query. + +* Added additional RUnit tests to validate new functionality. + +### 1.4 +Add json file format for Socrata downloads. Switch to `RJSONIO` from `rjson`. + +### 1.5 Several changes: + +* Swapped to ```jsonlite``` from ```RJSONIO``` +* Added handling for long and short dates +* Added unit test for reading private datasets + +### 1.5.1 +Deprecated ```httr::guess_media()``` and implemented ```mime::guess_type()``` + +### 1.6.0 Several changes: + +* New function, ```ls.socrata``` to list all datasets on a Socrata portal. +* New optional argument, ```app_token```, which lets users supply an API token while using ```read.socrata()``` to minimize throttling. +* Repairs a bug where ```read.socrata``` failed when reading in a date with a column, but there are null values in that column. +* Minor changes to the DESCRIPTION documentation to point users to GitHub for issues and provides new contact information. + +### 1.6.1 Bug fixes: + +* Resolved potential [name collision issue](https://github.com/Chicago/RSocrata/issues/42) +* Cleaned-up documentation with contributor instructions [#23](https://github.com/Chicago/RSocrata/issues/23) and [#28](https://github.com/Chicago/RSocrata/issues/28)) +* Moved test coverage in `RUnit` to `testthat` and implemented code coverage monitoring ([#41](https://github.com/Chicago/RSocrata/issues/41)) +* Clean-up DESCRIPTION ([#40](https://github.com/Chicago/RSocrata/issues/40)) +* Add continuous integration for Windows ([#39](https://github.com/Chicago/RSocrata/issues/39)) +* Migrate Travis-CI to "proper" R YAML ([#46](https://github.com/Chicago/RSocrata/issues/46)) + + + + + + + diff --git a/README.md b/README.md index 1e2b40e..fcb67ab 100644 --- a/README.md +++ b/README.md @@ -3,11 +3,11 @@ RSocrata **Master** -[![Linux build - Master](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Master](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master)[![Coverage - Master](https://img.shields.io/coveralls/dmpe/RSocrata/master.svg?style=flat-square&label=Coverage - Master)](https://coveralls.io/r/Chicago/RSocrata?branch=master) +[![Linux build - Master](https://img.shields.io/travis/Chicago/RSocrata/master.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Master](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/master.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/master)[![Coverage - Master](https://img.shields.io/coveralls/Chicago/RSocrata/master.svg?style=flat-square&label=Coverage - Master)](https://coveralls.io/r/Chicago/RSocrata?branch=master) **Dev** -[![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev)[![Coverage - Dev](https://img.shields.io/coveralls/dmpe/RSocrata/dev.svg?style=flat-square&label=Coverage status - Dev)](https://coveralls.io/r/Chicago/RSocrata?branch=dev) +[![Linux build - Dev](https://img.shields.io/travis/Chicago/RSocrata/dev.svg?style=flat-square&label=Linux build)](https://travis-ci.org/Chicago/RSocrata)[![Windows build - Dev](https://img.shields.io/appveyor/ci/tomschenkjr/RSocrata/dev.svg?style=flat-square&label=Windows build)](https://ci.appveyor.com/project/tomschenkjr/rsocrata/branch/dev)[![Coverage - Dev](https://img.shields.io/coveralls/Chicago/RSocrata/dev.svg?style=flat-square&label=Coverage status - Dev)](https://coveralls.io/r/Chicago/RSocrata?branch=dev) A tool for downloading Socrata datasets as R data frames @@ -24,7 +24,7 @@ Supports [SoDA query parameters](http://dev.socrata.com/docs/queries.html) in th Use ```ls.socrata()``` to list all datasets available on a Socrata webserver. -[RUnit](http://cran.r-project.org/web/packages/RUnit/index.html) test coverage. +[testthat](http://cran.r-project.org/web/packages/testthat/index.html) test coverage. ### Example: Reading SoDA valid URLs ```r @@ -60,30 +60,4 @@ Please report issues, request enhancements or fork us at the [City of Chicago gi ### Contributing -If you would like to contribute to this project, please see the [contributing documentation](CONTRIBUTING.md) - -### Change log - -1.1 Add check for valid Socrata resource URL. Add check for supported download file format. Add support for Socrata short dates. - -1.2 Use comma-separated file format for Socrata downloads. - -1.3 Added support for human-readable URL. - -1.4 Add json file format for Socrata downloads. Switch to RJSONIO rom rjson. - -1.5 Several changes: -* Swapped ```jsonlite``` from ```RJSONIO``` -* Added handling for long and short dates -* Added unit test for reading private datasets - -1.5.1 Deprecated ```httr::guess_media()``` and implemented ```httr::guess_type()``` - -1.6.0 Several changes: -* New function, ```ls.socrata``` to list all datasets on a Socrata portal. -* New optional argument, ```app_token```, which lets users supply an API token while using ```read.socrata()``` to minimize throttling. -* Repairs a bug where ```read.socrata``` failed when reading in a date with a column, but there are null values in that column. - -1.6.1 Bug fixes: -* Resolved potential [name collision issue](https://github.com/Chicago/RSocrata/issues/42) -* Cleaned-up documentation with contributor instructions +If you would like to contribute to this project, please see the [contributing documentation](CONTRIBUTING.md) \ No newline at end of file From 5403fdb1bcbd44336fa6991bd6109c29766d8b7f Mon Sep 17 00:00:00 2001 From: dmpe Date: Fri, 10 Jul 2015 18:20:09 +0200 Subject: [PATCH 53/55] update contributing.md to reflect the change to testthat --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9737e87..d627bf5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,5 +21,5 @@ When you want to make a change, either to fix a bug or introduce a new feature, * Create a branch or fork of the project based off of the `dev` branch. * Make commits of logical units * Add unit tests for any new features -* Run all tests in `R/tests/testRSocrata.R` +* Run all tests in `tests/testthat/` * Create a pull request with a robust description or [reference the issue number](https://github.com/Chicago/RSocrata/issues) \ No newline at end of file From 1e9e0551b7b472237e3264d36a6ae1872a708239 Mon Sep 17 00:00:00 2001 From: Gene Leynes Date: Fri, 10 Jul 2015 14:47:38 -0500 Subject: [PATCH 54/55] deleted blank line --- DESCRIPTION | 1 - 1 file changed, 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index dc529bb..1f090f6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -25,7 +25,6 @@ Imports: Suggests: testthat (>= 0.10.0), roxygen2 (>= 4.1.0) - License: MIT + file LICENSE URL: https://github.com/Chicago/RSocrata BugReports: https://github.com/Chicago/RSocrata/issues From 6e118d46fe099479415ab01ae814601c7bd66b54 Mon Sep 17 00:00:00 2001 From: Tom Schenk Jr Date: Fri, 10 Jul 2015 18:06:01 -0500 Subject: [PATCH 55/55] Updated documentation; re-added build number --- DESCRIPTION | 11 ++++------- README.md | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1f090f6..7883771 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -9,13 +9,10 @@ Description: Provides easier interaction with returns an R data frame. Converts dates to 'POSIX' format. Manages throttling by 'Socrata'. -Version: 1.6.2 -Date: 2015-7-15 -Authors@R: c( - person("Hugh", "Devlin, Ph. D.", role = c("aut")), - person("Tom", "Schenk Jr.", role = c("aut", "cre"), email = "developers@cityofchicago.org"), - person("John", "Malc", email = "cincenko@outlook.com", role = c("ctb"), comment = "@dmpe") - ) +Version: 1.6.2-9 +Date: 2015-7-10 +Author: Hugh Devlin, Ph. D., Tom Schenk, Jr., and John Malc +Maintainer: "Tom Schenk Jr." Depends: R (>= 3.0.0) Imports: diff --git a/README.md b/README.md index 4f9300a..8c7f4c8 100644 --- a/README.md +++ b/README.md @@ -59,4 +59,4 @@ Please report issues, request enhancements or fork us at the [City of Chicago gi ### Contributing -If you would like to contribute to this project, please see the [contributing documentation](CONTRIBUTING.md) +If you would like to contribute to this project, please see the [contributing documentation](CONTRIBUTING.md) and the [product roadmap](https://github.com/Chicago/RSocrata/wiki/Roadmap#planned-releases).