In general, shiny_attributes is a bit buggy/finicky, but the biggest bug right now is that if you leave optional cells blank, it will write a data.frame with empty strings as opposed to empty cells, resulting in all sorts of validation errors. See this example:
library(EML) # 1.99.0
me <- list(individualName = list(givenName = "Jeanette", surName = "Clark"))
attributes <- data.frame(attributeName = 'length_1',
attributeDefinition = 'def1',
measurementScale = 'ratio',
domain = 'numericDomain',
unit = 'meter',
numberType = 'real',
stringsAsFactors = FALSE)
# create otherEntity as list of lists
my_eml <- list(packageId = "asdlf", system = "asdf",
dataset = list(
title = "A Valid EML Dataset",
creator = me,
contact = me,
dataTable = list(entityName = "name", attributeList = set_attributes(attributes))))
eml_validate(my_eml)
# [1] TRUE
# attr(,"errors")
# character(0)
# don't need to make any edits, just open app and close again
att_test <- shiny_attributes(attributes = attributes)
att_test$attributes
# > att_test$attributes$attributeLabel
# [1] ""
my_eml_test <- list(packageId = "asdlf", system = "asdf",
dataset = list(
title = "A Valid EML Dataset",
creator = me,
contact = me,
dataTable = list(entityName = "name", attributeList = set_attributes(att_test$attributes))))
eml_validate(my_eml_test)
# [1] FALSE
# attr(,"errors")
# [1] "Element 'attributeLabel': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'."
# [2] "Element 'attributeLabel': [facet 'pattern'] The value '' is not accepted by the pattern '[\\s]*[\\S][\\s\\S]*'."
# [3] "Element 'attributeLabel': '' is not a valid value of the atomic type '{eml://ecoinformatics.org/resource-2.1.1}NonEmptyStringType'."
# [4] "Element 'code': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'."
# [5] "Element 'code': [facet 'pattern'] The value '' is not accepted by the pattern '[\\s]*[\\S][\\s\\S]*'."
# [6] "Element 'code': '' is not a valid value of the atomic type '{eml://ecoinformatics.org/resource-2.1.1}NonEmptyStringType'."
# [7] "Element 'codeExplanation': [facet 'minLength'] The value has a length of '0'; this underruns the allowed minimum length of '1'."
# [8] "Element 'codeExplanation': [facet 'pattern'] The value '' is not accepted by the pattern '[\\s]*[\\S][\\s\\S]*'."
# [9] "Element 'codeExplanation': '' is not a valid value of the atomic type '{eml://ecoinformatics.org/resource-2.1.1}NonEmptyStringType'."
In general,
shiny_attributes
is a bit buggy/finicky, but the biggest bug right now is that if you leave optional cells blank, it will write adata.frame
with empty strings as opposed to empty cells, resulting in all sorts of validation errors. See this example: