Skip to content

Commit

Permalink
updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Jul 3, 2019
1 parent 02cb3b5 commit 1042794
Show file tree
Hide file tree
Showing 2 changed files with 115 additions and 73 deletions.
19 changes: 15 additions & 4 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -209,29 +209,40 @@ See `ckanr::servers()` for a list of CKAN servers. Ther are `r length(ckanr::ser

### The Natural History Museum

Website: [http://data.nhm.ac.uk/](http://data.nhm.ac.uk/)
Website: <https://data.nhm.ac.uk/>

```{r output.lines=1:8}
ckanr_setup(url = "http://data.nhm.ac.uk")
ckanr_setup(url = "https://data.nhm.ac.uk")
x <- package_search(q = '*:*', rows = 1)
x$results
```

### The National Geothermal Data System

Website: [http://geothermaldata.org/](http://geothermaldata.org/)
Website: <http://geothermaldata.org/>

```{r output.lines=1:8}
ckanr_setup("http://search.geothermaldata.org")
x <- package_search(q = '*:*', rows = 1)
x$results
```

## Contributors

* Scott Chamberlain
* Imanuel Costigan
* Sharla Gelfand
* Florian Mayer
* Wush Wu

## Meta

* Please [report any issues or bugs](https://github.com/ropensci/ckanr/issues).
* License: MIT
* Get citation information for `ckanr` in R doing `citation(package = 'ckanr')`
* Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
* Please note that this project is released with a [Contributor Code of Conduct][coc].
By participating in this project you agree to abide by its terms.

[![ropensci](http://ropensci.org/public_images/github_footer.png)](http://ropensci.org)

[coc]: https://github.com/ropensci/ckanr/blob/master/CODE_OF_CONDUCT.md
169 changes: 100 additions & 69 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ ckanr
=====



[![cran checks](https://cranchecks.info/badges/worst/ckanr)](https://cranchecks.info/pkgs/ckanr)
[![Build Status](https://api.travis-ci.org/ropensci/ckanr.png)](https://travis-ci.org/ropensci/ckanr)
[![Build status](https://ci.appveyor.com/api/projects/status/5yqd882v4fbeggd5?svg=true)](https://ci.appveyor.com/project/sckott/ckanr)
[![codecov.io](https://codecov.io/github/ropensci/ckanr/coverage.svg?branch=master)](https://codecov.io/github/ropensci/ckanr?branch=master)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/ckanr?color=FAB657)](https://github.com/metacran/cranlogs.app)
[![cran version](http://www.r-pkg.org/badges/version/ckanr)](https://cran.r-project.org/package=ckanr)

`ckanr` is an R client for the CKAN API.

## Description

CKAN is an open source set of tools for hosting and providing data on the web. (CKAN users could include non-profits, museums, local city/county governments, etc.).
Expand Down Expand Up @@ -89,16 +92,16 @@ List packages

```r
package_list(as = "table")
#> [1] "artifact-data-agriculture"
#> [2] "artifact-data-aviation"
#> [3] "artifact-data-bookbinding"
#> [4] "artifact-data-chemistry"
#> [5] "artifact-data-communications"
#> [6] "artifact-data-computing-technology"
#> [7] "artifact-data-domestic-technology"
#> [8] "artifact-data-energy-electric"
#> [9] "artifact-data-exploration-and-survey"
#> [10] "artifact-data-fisheries"
#> [1] "artifact-data-agriculture"
#> [2] "artifact-data-aviation"
#> [3] "artifact-data-bookbinding"
#> [4] "artifact-data-chemistry"
#> [5] "artifact-data-communications"
#> [6] "artifact-data-computing-technology"
#> [7] "artifact-data-domestic-technology"
#> [8] "artifact-data-energy-electric"
#> [9] "artifact-data-exploration-and-survey"
#> [10] "artifact-data-fisheries"
...
```

Expand All @@ -107,10 +110,10 @@ Show a package

```r
package_show('34d60b13-1fd5-430e-b0ec-c8bc7f4841cf')
#> <CKAN Package> 34d60b13-1fd5-430e-b0ec-c8bc7f4841cf
#> <CKAN Package> 34d60b13-1fd5-430e-b0ec-c8bc7f4841cf
#> Title: Artifact Data - Vacuum Tubes
#> Creator/Modified: 2014-10-28T18:12:11.453636 / 2014-11-05T21:25:16.848989
#> Resources (up to 5): Artifact Data - Vacuum Tubes (XML), Data Dictionary, Tips (English), Tips (French)
#> Creator/Modified: 2014-10-28T18:12:11.453636 / 2016-06-13T20:06:50.014352
#> Resources (up to 5): Artifact Data - Vacuum Tubes (XML), Data Dictionary, Tips (English), Tips (French), Données d'artefact - Tubes Electronique (XML)
#> Tags (up to 5): Vacuum Tubes
#> Groups (up to 5): communications
```
Expand All @@ -122,20 +125,20 @@ Search for packages
x <- package_search(q = '*:*', rows = 2)
x$results
#> [[1]]
#> <CKAN Package> f4406699-3e11-4856-be48-b55da98b3c14
#> Title: Artifact Data - Horology
#> Creator/Modified: 2014-10-28T16:50:30.068996 / 2015-03-30T15:06:55.218176
#> Resources (up to 5): Artifact Data - Horology (XML), Data Dictionary, Tips (English), Tips (French)
#> Tags (up to 5): Horology
#> Groups (up to 5): scientific-instrumentation
#>
#> <CKAN Package> 99f457c9-ea24-48a1-87be-b52385825b6a
#> Title: Artifact Data - All Artifacts
#> Creator/Modified: 2014-10-24T17:39:06.411039 / 2016-06-14T21:31:27.983485
#> Resources (up to 5): Artifact Data - All Artifacts (XML), Data Dictonary, Tips (English), Tips (French), Données d'artefact - Tout les artefacts (XML)
#> Tags (up to 5): Agriculture, Alimentation, Aviation, Espace, Food
#> Groups (up to 5): everything
#>
#> [[2]]
#> <CKAN Package> 0a801729-aa94-4d76-a5e0-7b487303f4e5
#> Title: Artifact Data - Astronomy
#> Creator/Modified: 2014-10-24T19:16:59.160533 / 2015-01-09T23:33:13.972898
#> Resources (up to 5): Artifact Data - Astronomy (XML), Data Dictionary, Tips (English), Tips (French)
#> Tags (up to 5): Astronomy, Scientific Instrumentation
#> Groups (up to 5): scientific-instrumentation
#> <CKAN Package> 443cb020-f2ae-48b1-be67-90df1abd298e
#> Title: Artifact Data - Location - Canada Aviation and Space Museum
#> Creator/Modified: 2014-10-28T20:39:23.561940 / 2016-06-14T18:59:17.786219
#> Resources (up to 5): Artifact Data - Location - Canada Aviation and Space Museum (XML), Data Dictionary, Tips (English), Tips (French), Jeux de données XML - Emplacements - Musée de l'aviation et de l'espace du Canada
#> Tags (up to 5): Canada Aviation and Space Museum, Location
#> Groups (up to 5): location
```

## Resources
Expand All @@ -147,19 +150,19 @@ Search for resources
x <- resource_search(q = 'name:data', limit = 2)
x$results
#> [[1]]
#> <CKAN Resource> e179e910-27fb-44f4-a627-99822af49ffa
#> <CKAN Resource> e179e910-27fb-44f4-a627-99822af49ffa
#> Name: Artifact Data - Exploration and Survey (XML)
#> Description: XML Dataset
#> Creator/Modified: 2014-10-28T15:50:35.374303 /
#> Size:
#> Creator/Modified: 2014-10-28T15:50:35.374303 /
#> Size:
#> Format: XML
#>
#>
#> [[2]]
#> <CKAN Resource> ba84e8b7-b388-4d2a-873a-7b107eb7f135
#> <CKAN Resource> ba84e8b7-b388-4d2a-873a-7b107eb7f135
#> Name: Data Dictionary
#> Description: Data dictionary for CSTMC artifact datasets.
#> Creator/Modified: 2014-11-03T18:01:02.094210 /
#> Size:
#> Creator/Modified: 2014-11-03T18:01:02.094210 /
#> Size:
#> Format: XLS
```

Expand All @@ -171,20 +174,20 @@ List users
```r
user_list()[1:2]
#> [[1]]
#> <CKAN User> ee100ca6-2363-4db8-b24b-066e865c33ec
#> <CKAN User> ee100ca6-2363-4db8-b24b-066e865c33ec
#> Name: CSTMC
#> Display Name: CSTMC
#> Full Name:
#> No. Packages:
#> Full Name:
#> No. Packages:
#> No. Edits: 0
#> Created: 2014-10-16T18:15:03.685929
#>
#>
#> [[2]]
#> <CKAN User> de64d5d4-86ab-4510-820b-f0bd86ea7a79
#> <CKAN User> de64d5d4-86ab-4510-820b-f0bd86ea7a79
#> Name: default
#> Display Name: default
#> Full Name:
#> No. Packages:
#> Full Name:
#> No. Packages:
#> No. Edits: 0
#> Created: 2014-03-20T02:55:40.628968
```
Expand All @@ -197,13 +200,13 @@ List groups
```r
group_list(as = 'table')[, 1:3]
#> display_name description
#> 1 Communications
#> 2 Domestic and Industrial Technology
#> 3 Everything
#> 4 Location
#> 5 Resources
#> 6 Scientific Instrumentation
#> 7 Transportation
#> 1 Communications
#> 2 Domestic and Industrial Technology
#> 3 Everything
#> 4 Location
#> 5 Resources
#> 6 Scientific Instrumentation
#> 7 Transportation
#> title
#> 1 Communications
#> 2 Domestic and Industrial Technology
Expand All @@ -226,11 +229,11 @@ group_show('communications', as = 'table')$users
#> 1 a32002c960476614370a16e9fb81f436 FALSE
#> 2 10b930a228afd1da2647d62e70b71bf8 TRUE
#> activity_streams_email_notifications state number_of_edits
#> 1 FALSE active 379
#> 1 FALSE active 516
#> 2 FALSE active 44
#> number_administered_packages display_name fullname
#> 1 39 marc <NA>
#> 2 1 sepandar
#> 1 40 marc <NA>
#> 2 1 sepandar
#> id
#> 1 27778230-2e90-4818-9f00-bbf778c8fa09
#> 2 b50449ea-1dcc-4d52-b620-fc95bf56034b
Expand Down Expand Up @@ -258,10 +261,10 @@ Show tags
tag_show('Aviation')$packages[[1]][1:3]
#> $owner_org
#> [1] "fafa260d-e2bf-46cd-9c35-34c1dfa46c57"
#>
#>
#> $maintainer
#> [1] ""
#>
#>
#> $relationships_as_object
#> list()
```
Expand All @@ -274,60 +277,88 @@ List organizations
```r
organization_list()
#> [[1]]
#> <CKAN Organization> fafa260d-e2bf-46cd-9c35-34c1dfa46c57
#> <CKAN Organization> fafa260d-e2bf-46cd-9c35-34c1dfa46c57
#> Name: cstmc
#> Display name: CSTMC
#> No. Packages:
#> No. Packages:
#> No. Users: 0
```


## ckanr's dplyr interface
`ckanr` implements a `dplyr` SQL interface to CKAN's datastore.
You can access any resource in the datastore directly using only the CKAN
resource ID.

Note: this will only work for resources which were uploaded successfully to the
datastore - they will show the green "Data API" button in CKAN.


```r
ckan <- ckanr::src_ckan("https://my.ckan.org/")
res_id <- "my-ckan-resource-id"
dplyr::tbl(src = ckan$con, from = res_id) %>% as_tibble(.)
```


## Examples of different CKAN APIs

See `ckanr::servers()` for a list of CKAN servers. Ther are 124 as of 2015-10-21.
See `ckanr::servers()` for a list of CKAN servers. Ther are 124 as of 2019-07-03.

### The Natural History Museum

Website: [http://data.nhm.ac.uk/](http://data.nhm.ac.uk/)
Website: <https://data.nhm.ac.uk/>


```r
ckanr_setup(url = "http://data.nhm.ac.uk")
ckanr_setup(url = "https://data.nhm.ac.uk")
x <- package_search(q = '*:*', rows = 1)
x$results
#> [[1]]
#> <CKAN Package> 56e711e6-c847-4f99-915a-6894bb5c5dea
#> Title: Collection specimens
#> Creator/Modified: 2014-12-08T16:39:22.346941 / 2015-09-30T13:42:02.859838
#> Resources (up to 5): Specimens
#> Tags (up to 5):
#> <CKAN Package> d68e20f4-a56d-4a8a-a8d7-dc478ba64c76
#> Title: Wallace and Banks drawers
#> Creator/Modified: 2018-08-15T13:31:33.694910 / 2019-04-10T14:54:37.206921
#> Resources (up to 5): Drawer-level images
#> Tags (up to 5):
#> Groups (up to 5):
NA
```

### The National Geothermal Data System

Website: [http://geothermaldata.org/](http://geothermaldata.org/)
Website: <http://geothermaldata.org/>


```r
ckanr_setup("http://search.geothermaldata.org")
x <- package_search(q = '*:*', rows = 1)
x$results
#> [[1]]
#> <CKAN Package> 428701c7-1b99-424a-a2ae-829cfe37794c
#> Title: Pagosa Springs borehole lithology intervals
#> Creator/Modified: 2015-10-08T20:37:41.620696 / 2015-10-08T20:38:56.525277
#> Resources (up to 5): Borehole Lithology of Pagosa Springs Temperature Gradient wells
#> Tags (up to 5):
#> <CKAN Package> 71ffb979-c3c8-467c-ab67-fe9477f0abda
#> Title: Resource Analysis for Deep Direct-Use Feasibility Study in East Texas, Part 2 MEMO SMU DDU GeologicVariability-TravPeak29Jan2019.xlsx
#> Creator/Modified: 2019-07-02T22:55:08.989201 / 2019-07-02T22:55:09.055454
#> Resources (up to 5): MEMO SMU DDU GeologicVariability-TravPeak29Jan2019.xlsx
#> Tags (up to 5): DDU, Deep direct-use, East Texas, Eastman Chemical, Heat flow
#> Groups (up to 5):
NA
```

## Contributors

* Scott Chamberlain
* Imanuel Costigan
* Sharla Gelfand
* Florian Mayer
* Wush Wu

## Meta

* Please [report any issues or bugs](https://github.com/ropensci/ckanr/issues).
* License: MIT
* Get citation information for `ckanr` in R doing `citation(package = 'ckanr')`
* Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
* Please note that this project is released with a [Contributor Code of Conduct][coc].
By participating in this project you agree to abide by its terms.

[![ropensci](http://ropensci.org/public_images/github_footer.png)](http://ropensci.org)

[coc]: https://github.com/ropensci/ckanr/blob/master/CODE_OF_CONDUCT.md

0 comments on commit 1042794

Please sign in to comment.