ropensci / dataspice

:hot_pepper: Create lightweight schema.org descriptions of your datasets
https://docs.ropensci.org/dataspice
Other
159 stars 26 forks source link

use EML not eml2 #75

Closed njtierney closed 5 years ago

njtierney commented 5 years ago

dataspice currently uses eml2, which has moved to EML:

image

This PR helps fix things so that you can install it - unfortunately it has a few failing tests (output shown below), which I unfortunately could not work out how to fix, hopefully I didn't break anything!

Loading dataspice
✔ | OK F W S | Context
✖ |  0 6     | test-eml_to_spice [8.0 s]
───────────────────────────────────────────────────────────────────────────────────
test-eml_to_spice.R:8: error: Access tabular format matches EML
$ operator is invalid for atomic vectors
1: es_access(eml) at ~/github/njtierney/dataspice/tests/testthat/test-eml_to_spice.R:8
2: get_entities(eml) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:48
3: entities %in% names(eml$dataset) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:4

test-eml_to_spice.R:24: error: Attributes tabular format matches EML
$ operator is invalid for atomic vectors
1: es_attributes(eml) at ~/github/njtierney/dataspice/tests/testthat/test-eml_to_spice.R:24
2: get_entities(eml) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:135
3: entities %in% names(eml$dataset) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:4

test-eml_to_spice.R:53: error: Biblio tabular format matches EML
$ operator is invalid for atomic vectors
1: expect_equal(eml$dataset$title, eml_biblio$title) at ~/github/njtierney/dataspice/tests/testthat/test-eml_to_spice.R:53
2: quasi_label(enquo(object), label)
3: eval_bare(get_expr(quo), get_env(quo))

test-eml_to_spice.R:90: error: Creators tabular format matches EML
$ operator is invalid for atomic vectors
1: es_creators(eml) at ~/github/njtierney/dataspice/tests/testthat/test-eml_to_spice.R:90
2: get_entities(eml, entities = c("creator", "contact", "associatedParty", "metadataProvider"), 
       level_id = c("individualName", "organizationName")) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:230
3: entities %in% names(eml$dataset) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:4

test-eml_to_spice.R:117: error: eml_to_spice files write to disk
$ operator is invalid for atomic vectors
1: eml_to_spice(eml, dir_path) at ~/github/njtierney/dataspice/tests/testthat/test-eml_to_spice.R:117
2: es_attributes(eml, path) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:287
3: get_entities(eml) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:135
4: entities %in% names(eml$dataset) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:4

test-eml_to_spice.R:132: error: eml_to_spice returns a list of tibbles
$ operator is invalid for atomic vectors
1: eml_to_spice(eml) at ~/github/njtierney/dataspice/tests/testthat/test-eml_to_spice.R:132
2: es_attributes(eml, path) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:287
3: get_entities(eml) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:135
4: entities %in% names(eml$dataset) at /Users/ntie0001/github/njtierney/dataspice/R/eml_to_spice.R:4
───────────────────────────────────────────────────────────────────────────────────

══ Results ════════════════════════════════════════════════════════════════════════
Duration: 8.0 s

OK:       0
Failed:   6
Warnings: 0
Skipped:  0

Test complete
annakrystalli commented 5 years ago

Hello and many thanks for the PR @njtierney and for trying to fix the tests!

I'll have a look at this at the weekend. In the meantime @isteves, if you have any suggestions let me know :)

annakrystalli commented 5 years ago

Hi @njtierney. So I've had a look and I was wondering what version of EML you have installed? CRAN has version 1.0.3 in which read_eml() still returns an S4 class:

eml_path <- system.file("example-dataset/broodTable_metadata.xml", package = "dataspice")
eml <- EML::read_eml(eml_path)
isS4(eml)
#> [1] TRUE
devtools::session_info()
#> Packages -----------------------------------------------------------------
#>  package   * version date       source        
#>  EML         1.0.3   2017-05-01 CRAN (R 3.4.4)

Created on 2019-02-16 by the reprex package (v0.2.0).

While the dev version 1.99.0 uses S3 classes:

eml_path <- system.file("example-dataset/broodTable_metadata.xml", package = "dataspice")
eml <- EML::read_eml(eml_path)
isS4(eml)
#> [1] FALSE
devtools::session_info()
#> Packages -----------------------------------------------------------------
#>  package    * version    date       source                                         
#>  EML          1.99.0     2019-02-16 Github (ropensci/EML@88accf8)  
#>  emld         0.0.2      2019-02-16 Github (cboettig/emld@ac5e3dd) 

Created on 2019-02-16 by the reprex package (v0.2.0).


and all tests pass

library(devtools)
test("/Users/Anna/Desktop/dataspice")
#> Loading dataspice
#> Loading required package: testthat
#> 
#> Attaching package: 'testthat'
#> The following object is masked from 'package:devtools':
#> 
#>     setup
#> Testing dataspice
#> ✔ | OK F W S | Context
#> 
⠏ |  0       | test-create_spice
⠋ |  1       | test-create_spice
⠙ |  2       | test-create_spice
⠹ |  3       | test-create_spice
✔ |  3       | test-create_spice
#> 
⠏ |  0       | test-eml_to_spice
⠋ |  1       | test-eml_to_spice
⠙ |  2       | test-eml_to_spice
⠹ |  3       | test-eml_to_spice
⠸ |  4       | test-eml_to_spice
⠼ |  5       | test-eml_to_spice
⠴ |  6       | test-eml_to_spice
⠦ |  7       | test-eml_to_spice
⠧ |  8       | test-eml_to_spice
⠇ |  9       | test-eml_to_spice
⠏ | 10       | test-eml_to_spice
⠋ | 11       | test-eml_to_spice
⠙ | 12       | test-eml_to_spice
⠹ | 13       | test-eml_to_spice
⠸ | 14       | test-eml_to_spice
⠼ | 15       | test-eml_to_spice
⠴ | 16       | test-eml_to_spice
⠦ | 17       | test-eml_to_spice
⠧ | 18       | test-eml_to_spice
⠇ | 19       | test-eml_to_spice
⠏ | 20       | test-eml_to_spice
⠋ | 21       | test-eml_to_spice
⠙ | 22       | test-eml_to_spice
⠹ | 23       | test-eml_to_spice
⠸ | 24       | test-eml_to_spice
✔ | 24       | test-eml_to_spice [2.2 s]
#> 
⠏ |  0       | test-prep_attributes.R
⠋ |  1       | test-prep_attributes.R
⠙ |  2       | test-prep_attributes.R
⠹ |  3       | test-prep_attributes.R
⠸ |  4       | test-prep_attributes.R
⠼ |  5       | test-prep_attributes.R
⠴ |  6       | test-prep_attributes.R
⠦ |  7       | test-prep_attributes.R
⠧ |  8       | test-prep_attributes.R
⠇ |  9       | test-prep_attributes.R
⠏ | 10       | test-prep_attributes.R
⠋ | 11       | test-prep_attributes.R
✔ | 11       | test-prep_attributes.R [0.2 s]
#> 
⠏ |  0       | write_spice
⠋ |  1       | write_spice
⠙ |  2       | write_spice
✔ |  2       | write_spice
#> 
#> ══ Results ════════════════════════════════════════════════════════════════════════════════════
#> Duration: 2.7 s
#> 
#> OK:       40
#> Failed:   0
#> Warnings: 0
#> Skipped:  0

Created on 2019-02-16 by the reprex package (v0.2.0).

So we can either proactively switch now to EML dev version and then switch again when it's available on CRAN or wait and just switch straight to the CRAN version later. I'm wondering, @cboettig, do you have any idea when the S3 EML version will be on CRAN? Any thoughts on the matter?

cboettig commented 5 years ago

Thanks Anna. Yeah, the new EML depends on emld, which isn’t on CRAN yet but just cleared rOpenSci peer review yesterday. So I m hoping to have both up to CRAN in the next week or so

On Sat, Feb 16, 2019 at 1:55 AM Anna Krystalli notifications@github.com wrote:

Hi @njtierney https://github.com/njtierney. So I've had a look and I was wondering what version of EML you have installed? CRAN has version 1.0.3 which read_eml() still returns an S4 class:

eml_path <- system.file("example-dataset/broodTable_metadata.xml", package = "dataspice") eml <- EML::read_eml(eml_path)

isS4(eml)

> [1] TRUE

devtools::session_info()

> Packages -----------------------------------------------------------------

> package * version date source

> EML 1.0.3 2017-05-01 CRAN (R 3.4.4)

Created on 2019-02-16 by the reprex package http://reprex.tidyverse.org (v0.2.0).

While the dev version 1.99.0 uses S3 classes:

eml_path <- system.file("example-dataset/broodTable_metadata.xml", package = "dataspice") eml <- EML::read_eml(eml_path)

isS4(eml)

> [1] FALSE

devtools::session_info()

> Packages -----------------------------------------------------------------

> package * version date source

> EML 1.99.0 2019-02-16 Github (ropensci/EML@88accf8)

> emld 0.0.2 2019-02-16 Github (cboettig/emld@ac5e3dd)

Created on 2019-02-16 by the reprex package http://reprex.tidyverse.org (v0.2.0).

and all tests pass

library(devtools)

test("/Users/Anna/Desktop/dataspice")

> Loading dataspice

> Loading required package: testthat

>

> Attaching package: 'testthat'

> The following object is masked from 'package:devtools':

>

> setup

> Testing dataspice

> ✔ | OK F W S | Context

>

⠏ | 0 | test-create_spice

⠋ | 1 | test-create_spice

⠙ | 2 | test-create_spice

⠹ | 3 | test-create_spice

✔ | 3 | test-create_spice

>

⠏ | 0 | test-eml_to_spice

⠋ | 1 | test-eml_to_spice

⠙ | 2 | test-eml_to_spice

⠹ | 3 | test-eml_to_spice

⠸ | 4 | test-eml_to_spice

⠼ | 5 | test-eml_to_spice

⠴ | 6 | test-eml_to_spice

⠦ | 7 | test-eml_to_spice

⠧ | 8 | test-eml_to_spice

⠇ | 9 | test-eml_to_spice

⠏ | 10 | test-eml_to_spice

⠋ | 11 | test-eml_to_spice

⠙ | 12 | test-eml_to_spice

⠹ | 13 | test-eml_to_spice

⠸ | 14 | test-eml_to_spice

⠼ | 15 | test-eml_to_spice

⠴ | 16 | test-eml_to_spice

⠦ | 17 | test-eml_to_spice

⠧ | 18 | test-eml_to_spice

⠇ | 19 | test-eml_to_spice

⠏ | 20 | test-eml_to_spice

⠋ | 21 | test-eml_to_spice

⠙ | 22 | test-eml_to_spice

⠹ | 23 | test-eml_to_spice

⠸ | 24 | test-eml_to_spice

✔ | 24 | test-eml_to_spice [2.2 s]

>

⠏ | 0 | test-prep_attributes.R

⠋ | 1 | test-prep_attributes.R

⠙ | 2 | test-prep_attributes.R

⠹ | 3 | test-prep_attributes.R

⠸ | 4 | test-prep_attributes.R

⠼ | 5 | test-prep_attributes.R

⠴ | 6 | test-prep_attributes.R

⠦ | 7 | test-prep_attributes.R

⠧ | 8 | test-prep_attributes.R

⠇ | 9 | test-prep_attributes.R

⠏ | 10 | test-prep_attributes.R

⠋ | 11 | test-prep_attributes.R

✔ | 11 | test-prep_attributes.R [0.2 s]

>

⠏ | 0 | write_spice

⠋ | 1 | write_spice

⠙ | 2 | write_spice

✔ | 2 | write_spice

>

> ══ Results ════════════════════════════════════════════════════════════════════════════════════

> Duration: 2.7 s

>

> OK: 40

> Failed: 0

> Warnings: 0

> Skipped: 0

Created on 2019-02-16 by the reprex package http://reprex.tidyverse.org (v0.2.0).

So we can either proactively switch now to EML dev version and then switch again when it's available on CRAN or wait and just switch straight to the CRAN version later. I'm wondering, @cboettig https://github.com/cboettig, do you have any idea when the S3 EML version will be on CRAN? Any thoughts on the matter?

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/ropenscilabs/dataspice/pull/75#issuecomment-464328025, or mute the thread https://github.com/notifications/unsubscribe-auth/AANleqYR4sILgeM3mM4WF7aDe0n_PTeTks5vN9WfgaJpZM4a1XVA .

--

Carl Boettiger http://carlboettiger.info/

njtierney commented 5 years ago

hello!

I had the CRAN version of EML:

packageVersion("EML")
#> [1] '1.0.3'

Created on 2019-02-17 by the reprex package (v0.2.1)

Checking now, if I install ropensci/EML, then it looks like I'm all good!

> test()
Loading dataspice
Testing dataspice
✔ | OK F W S | Context
✔ |  3       | test-create_spice [0.2 s]
✔ | 24       | test-eml_to_spice [3.3 s]
✔ | 11       | test-prep_attributes.R [0.2 s]
✔ |  2       | write_spice [0.2 s]

══ Results ══════════════════════════════════════════
Duration: 3.9 s

OK:       40
Failed:   0
Warnings: 0
Skipped:  0
annakrystalli commented 5 years ago

Great! Thanks both. So, @cboettig if you let us know when the new version is on CRAN, we can retest and merge the PR in then.

isteves commented 5 years ago

Late to the conversation, but glad it's just a package version issue (👍 @annakrystalli on catching that). Looks like I need to upgrade my system now, too! Great to hear that the new version is almost on CRAN

annakrystalli commented 5 years ago

Hello @cboettig 👋, I see emld is now on CRAN! 🚀

Just wondering whether the new version of EML is also imminent?

cboettig commented 5 years ago

Hopefully! I just have to get up the courage... 🦁

annakrystalli commented 5 years ago