ImperialCollegeLondon / safedata_validator

Python tools to validate and publish datasets using the safedata metadata format.
https://safedata-validator.readthedocs.io/
MIT License
2 stars 4 forks source link

Prevent Exception on empty data sheets #73

Closed davidorme closed 1 year ago

davidorme commented 1 year ago

Some legacy datasets pointing to external files have empty data worksheets: no data fields, just the header metadata fields and row numbers in Column A. At the moment, this correctly throws up error logs - because we no longer want to allow this to happen - but DataWorksheet.n_fields and DataWorksheet.n_empty_fields are currently typed but not defined which causes an Exception when printing the worksheet summary message.

This PR defines defaults of 0 for those two values. It also adds some extra FORMATTER.pops() into taxa.py to maintain correct indenting in failure modes for NCBITaxa and GBIFTaxa.