ropenscilabs / deposits

R Client for access to multiple data repository services
https://docs.ropensci.org/deposits/
Other
37 stars 3 forks source link

Possible Bug with reading from json - `description` not found and date format of `created` #91

Open rkrug opened 9 months ago

rkrug commented 9 months ago

Sorry - but I found another possible bug:

in this case, description is not found, and created is apparently not in the correct format. It must be another interaction, as this error does not come in #90

Cheers,

Rainer

library(deposits)

sessionInfo()
#> R version 4.3.2 (2023-10-31)
#> Platform: aarch64-apple-darwin20 (64-bit)
#> Running under: macOS Sonoma 14.1.2
#> 
#> Matrix products: default
#> BLAS:   /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRblas.0.dylib 
#> LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib;  LAPACK version 3.11.0
#> 
#> locale:
#> [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
#> 
#> time zone: Europe/Berlin
#> tzcode source: internal
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> other attached packages:
#> [1] deposits_0.2.1.046
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.33     styler_1.10.2     R6_2.5.1          fastmap_1.1.1    
#>  [5] xfun_0.41         magrittr_2.0.3    glue_1.6.2        R.utils_2.12.3   
#>  [9] knitr_1.45        htmltools_0.5.7   rmarkdown_2.25    lifecycle_1.0.4  
#> [13] cli_3.6.1         R.methodsS3_1.8.2 vctrs_0.6.5       reprex_2.0.2     
#> [17] withr_2.5.2       compiler_4.3.2    rprojroot_2.0.4   here_1.0.1       
#> [21] R.oo_1.25.0       R.cache_0.16.0    purrr_1.0.2       tools_4.3.2      
#> [25] evaluate_0.23     yaml_2.3.7        rlang_1.1.2       fs_1.6.3

metadata <- structure(
    list(
        title = "LEEF-1 experiment",
        description = "Data sampled during the LEEF-1 experiment",
        abstract = "The data from the LEEF-1 experiment.",
        created = "2020-01-01",
        language = "eng", accessRights = "embargoed.",
        rightsHolder = "A person or organization owning or managing rights over the resource. Recommended practice is to refer to the rights holder with a URI. If this is not possible or feasible, a literal value that identifies the rights holder may be provided.",
        license = "CC-BY-SA-4.0",
        creator = list(list(
            name = "Rainer M. Krug",
            affiliation = "University of Zurich", orcid = "0000-0002-7490-0066"
        )),
        contributor = list(list(
            name = "Rainer M. Krug", affiliation = "University of Zurich",
            orcid = "0000-0002-7490-0066", type = "DataManager"
        )),
        isPartOf = list(list(
            identifier = "https://doi.org/10.1111/ele.14217",
            relation = "isPartOf"
        ))
    )
)

cli <- depositsClient$new(service = "zenodo", sandbox = TRUE)

cli$deposit_fill_metadata(metadata)
#>             instancePath                                         schemaPath
#> 1               /created                        #/properties/created/format
#> 2              /metadata                     #/properties/metadata/required
#> 3 /metadata/access_right #/properties/metadata/properties/access_right/enum
#>    keyword params.format params.missingProperty
#> 1   format     date-time                   <NA>
#> 2 required          <NA>            description
#> 3     enum          <NA>                   <NA>
#>                  params.allowedValues
#> 1                                NULL
#> 2                                NULL
#> 3 open, embargoed, restricted, closed
#>                                      message
#> 1              must match format "date-time"
#> 2  must have required property 'description'
#> 3 must be equal to one of the allowed values
#> Error: Stopping because the metadata terms listed above do not conform with the expected schema for the zenodo service.

Created on 2023-12-05 with reprex v2.0.2

rkrug commented 9 months ago

The problem concerning the description is an interaction with the field rightsHolder. as soon as this is excluded, the message disappears.

mpadge commented 6 months ago

@rkrug Now address this issue, but first i note that both "created" and "access_rights" clearly state the problem in the error message:

The description seems to be the remaining bug which i am now addressing ...

mpadge commented 6 months ago

That fixes the easy parts. The remaining problems all extend from accessRights = "embargoed". Specifying this in Zenodo then requires an embargo_date entry in the request metadata. The problem is how to represent this in the DCMI schema? It is currently not recognised there, therefore simply removed, leading to a request being submitted without this required field, which is then rejected.

mpadge commented 6 months ago

https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#http://purl.org/dc/terms/available, or possibly https://www.dublincore.org/specifications/dublin-core/dcmi-terms/#http://purl.org/dc/terms/valid

rkrug commented 6 months ago

Thanks for the clarification.