Skip to content

Commit

Permalink
Merge pull request #151 from RobLBaker/main
Browse files Browse the repository at this point in the history
bugfix for test_storage_type
  • Loading branch information
RobLBaker authored Nov 5, 2024
2 parents 2dfbe34 + e35f1ff commit 95ce24f
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 13 deletions.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# DPchecker 0.3.5 (develoment version)
## 2024-011-05
* Bugfix for `test_storage_type()` data packages built in ezEML that have only 1 .csv file.

* Add `test_project()` function to test for DataStore projects.
* Add unit tests for all optional eml elements
* Update documentation to reflect new `test_project()` function.
Expand Down
27 changes: 19 additions & 8 deletions R/required_eml_elements.R
Original file line number Diff line number Diff line change
Expand Up @@ -608,30 +608,41 @@ test_storage_type <- function(metadata = load_metadata(directory)) {
function (tbl)
{list(arcticdatautils::eml_get_simple(tbl,
"storageType"))})
#if EZeml added typeSystem="XML Schema Datatypes" to storageType element:
if(sum(grepl("XML Schema Datatype", attr_storage_type)) > 0){
attr_storage_type <-attr_storage_type[-length(seq_along(attr_storage_type))]
#if ezEML with multiple .csv (remove typeSystem="XML Schema Datatypes"):
if (sum(grepl("XML Schema Datatype", attr_storage_type)) > 1) {
attr_storage_type <- attr_storage_type[-length(seq_along(attr_storage_type))]
attr_storage_type <- unlist(attr_storage_type)
attr_storage_type <- attr_storage_type[names(attr_storage_type) %in% c("")]
}
# if ezEML with only one .csv (remove typeSystem= "XML Schema Datatypes":
else if (sum(grepl("XML Schema Datatype", attr_storage_type)) == 1) {
attr_storage_type <- unlist(attr_storage_type)
attr_storage_type <- attr_storage_type[names(attr_storage_type) %in% c("")]
}
# else not an ezEML product:
else{
else {
attr_storage_type$`@context` <- NULL
attr_storage_type <- unlist(attr_storage_type)
}

#comparisons:
if(identical(seq_along(metadata_attrs), seq_along(attr_storage_type))){
if (identical(seq_along(metadata_attrs), seq_along(attr_storage_type))) {
cli::cli_inform(c("v" = "All attributes listed in metadata have a storage type associated with them."))
}
else {
cli::cli_abort(c("x" = "Metadata attribute and storage type mis-match: attributes must have exactly one storage type."))
}
attr_storage_list <- c("string", "float", "date", "factor", "character", "dateTime")
if(sum(!attr_storage_type %in% attr_storage_list) > 0){
attr_storage_list <- c("string",
"float",
"date",
"factor",
"character",
"dateTime",
"integer")
if (sum(!attr_storage_type %in% attr_storage_list) > 0) {
cli::cli_warn(c("!" = "Some attribute storage types are not accepted values."))
}
else{
else {
cli::cli_inform(c("v" = "All attribute storage types are valid values."))
}
return(invisible(metadata))
Expand Down
10 changes: 7 additions & 3 deletions docs/news/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ pkgdown: 2.1.0
pkgdown_sha: ~
articles:
DPchecker: DPchecker.html
last_built: 2024-09-19T19:20Z
last_built: 2024-11-05T22:12Z
Binary file removed docs/reference/Rplot001.png
Binary file not shown.
2 changes: 1 addition & 1 deletion docs/search.json

Large diffs are not rendered by default.

0 comments on commit 95ce24f

Please sign in to comment.