Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty dataset name and authors #1581

Closed
Remi-Gau opened this issue Jan 11, 2023 · 5 comments · Fixed by bids-standard/bids-specification#1916
Closed

empty dataset name and authors #1581

Remi-Gau opened this issue Jan 11, 2023 · 5 comments · Fixed by bids-standard/bids-specification#1916

Comments

@Remi-Gau
Copy link
Contributor

Just tested it and validation passes without warning if leave an empty string ("") or just spaces (" ") for the dataset_descrtiption name .

Same for Authors.

This probably deserves a warning.

@sappelhoff
Copy link
Member

that's our old issue with generating warnings for JSON schema based validation. In that workflow we currently only have:

  1. fail with an often cryptic error message because the schema is violated
  2. succeed because the schema is adhered to

perhaps it'd be easier to explicitly forbid "whitespace-only" strings in the JSON schema, for example via a "pattern".

@effigies
Copy link
Collaborator

Name: #1572 will be in the next release.

Authors is supposed to be a list. There should be a warning if the list is empty or the field is missing NO_AUTHORS:

113: {
key: 'NO_AUTHORS',
severity: 'warning',
reason:
'The Authors field of dataset_description.json should contain an array of fields - with one author per field. This was triggered because there are no authors, which will make DOI registration from dataset metadata impossible.',
},

Implementation is here:

const checkAuthorField = (authors) => {
const issues = []
// because this test happens before schema validation,
// we have to make sure that authors is an array
if (authors && typeof authors == 'object' && authors.length) {
// if any author has more than one comma, throw an error
authors.forEach((author) => {
if (('' + author).split(',').length > 2) {
issues.push(new Issue({ code: 103, evidence: author }))
}
})
// if authors is length 1, we want a warning for a single comma
// and an error for multiple commas
if (authors.length == 1) {
const author = authors[0]
// check the number of commas in the single author field
if (typeof author == 'string' && author.split(',').length <= 2) {
// if there is one or less comma in the author field,
// we suspect that the curator has not listed everyone involved
issues.push(new Issue({ code: 102, evidence: author }))
}
}
} else {
// if there are no authors,
// warn user that errors could occur during doi minting
// and that snapshots on OpenNeuro will not be allowed
issues.push(new Issue({ code: 113, evidence: JSON.stringify(authors) }))
}
return issues
}

Tests are here:

it('returns code 113 when there are no Authors', () => {
const invalidJsonContentsDict = {
'/dataset_description.json': {
Authors: [],
},
}
let issues = checkDatasetDescription(invalidJsonContentsDict)
assert(
issues.findIndex((issue) => issue.code === 113) > -1,
'issues include a code 113',
)
const invalidJsonContentsDict2 = {
'/dataset_description.json': {},
}
issues = checkDatasetDescription(invalidJsonContentsDict2)
assert(
issues.findIndex((issue) => issue.code === 113) > -1,
'issues include a code 113',
)
})
})

We could add an EMPTY_AUTHOR issue, just like the 2+ commas issue, and warn if author.strip().length == 0.

@Remi-Gau
Copy link
Contributor Author

We could add an EMPTY_AUTHOR issue, just like the 2+ commas issue, and warn if author.strip().length == 0.

that would be nice

@mateuszpawlik
Copy link

FYI I just got code: 113 - NO_AUTHORS although I have authors in CITATION.cff file, as recommended.

@Remi-Gau
Copy link
Contributor Author

Remi-Gau commented Feb 16, 2024

FYI I just got code: 113 - NO_AUTHORS although I have authors in CITATION.cff file, as recommended.

https://github.com/bids-standard/bids-examples/actions/runs/7928356588/job/21646448322?pr=426#step:8:373

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants