ropensci / dataspice

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

Bug: Cannot use the biblio.csv metadata file due to keywords issue #118

Open jimbrig opened 1 year ago

amoeba commented 1 year ago

Hi @jimbrig, can you give us a little more info here? What keywords issue are you running into?

kthayashi commented 1 year ago

Hello - I'm not sure if this is exactly the same issue as @jimbrig experienced, but I also encountered an issue with keywords in the biblio.csv metadata file so wanted to chime in.

Here's what I did: I started by creating a rather minimal metadata file (say eml.xml) in EML format using the EML and EMLassemblyline packages. I confirmed that eml.xml is valid in EML, but perhaps notably this file does not contain any keyword info. I then converted this file into dataspice metadata tables using the function eml_to_spice(). When I then tried to use the function write_spice() on these tables, I received the error message:

> eml <- read_eml("eml.xml")
> my_spice <- eml_to_spice(eml, path = ".")
> write_spice(path = ".")  
Error in if (is.na(biblio$keywords)) { : argument is of length zero                                            
In addition: Warning message:
Unknown or uninitialised column: `keywords`. 

It appears that the table biblio.csv was lacking the expected column keywords. Here are the columns present in each of the metadata tables produced by write_spice():

> lapply(my_spice, names)
$attributes
[1] "fileName"     "variableName" "description"  "unitText"    

$access
[1] "fileName" "name"    

$biblio
[1] "title"         "datePublished" "license"      

$creators
[1] "id"          "name"        "affiliation" "email"   

For what it's worth, manually adding an empty keywords column to biblio.csv allowed me to avoid this issue and generate dataspice.json as expected.

amoeba commented 1 year ago

Thanks @kthayashi, that looks like enough info for me to reproduce the error on my end.