lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb in adiwg-mdtranslator-2.10.0 vs lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomicClassification.rb in adiwg-mdtranslator-2.12.0.pre
- old
+ new
@@ -1,9 +1,11 @@
# unpack taxonomic classification
# Reader - ADIwg JSON to internal data structure
# History:
+# Stan Smith 2018-04-06 renamed taxonomicRank to taxonomicLevel
+# Stan Smith 2018-04-06 renamed latinName to taxonomicName
# Stan Smith 2018-02-19 refactored error and warning messaging
# Stan Smith 2017-01-31 added taxonomicSystemId
# Stan Smith 2016-10-22 original script
require_relative 'module_taxonomicClassification'
@@ -17,11 +19,12 @@
def self.unpack(hTaxClass, responseObj)
# return nil object if input is empty
if hTaxClass.empty?
- responseObj[:readerExecutionMessages] << 'WARNING: mdJson reader: taxonomic classification object is empty'
+ responseObj[:readerExecutionMessages] <<
+ 'WARNING: mdJson reader: taxonomic classification object is empty'
return nil
end
# instance classes needed in script
intMetadataClass = InternalMetadata.new
@@ -32,25 +35,41 @@
unless hTaxClass['taxonomicSystemId'] == ''
intTaxClass[:taxonId] = hTaxClass['taxonomicSystemId']
end
end
- # taxonomic classification - taxon rank (required)
+ # taxonomic classification - taxon level (required)
+ # renamed from 'taxonomicRank'
+ if hTaxClass.has_key?('taxonomicLevel')
+ intTaxClass[:taxonRank] = hTaxClass['taxonomicLevel']
+ end
+ # support deprecation until schema version 3.0
if hTaxClass.has_key?('taxonomicRank')
intTaxClass[:taxonRank] = hTaxClass['taxonomicRank']
+ responseObj[:readerExecutionMessages] <<
+ 'NOTICE: mdJson reader: taxonomic classification taxonomicRank is deprecated, use taxonomicLevel'
end
if intTaxClass[:taxonRank].nil? || intTaxClass[:taxonRank] == ''
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: taxonomic classification rank is missing'
+ responseObj[:readerExecutionMessages] <<
+ 'ERROR: mdJson reader: taxonomic classification level is missing'
responseObj[:readerExecutionPass] = false
return nil
end
- # taxonomic classification - latin name (required)
+ # taxonomic classification - taxonomic name (required)
+ # renamed from 'latinName'
+ if hTaxClass.has_key?('taxonomicName')
+ intTaxClass[:taxonValue] = hTaxClass['taxonomicName']
+ end
+ # support deprecation until schema version 3.0
if hTaxClass.has_key?('latinName')
intTaxClass[:taxonValue] = hTaxClass['latinName']
+ responseObj[:readerExecutionMessages] <<
+ 'NOTICE: mdJson reader: taxonomic classification latinName is deprecated, use taxonomicName'
end
if intTaxClass[:taxonValue].nil? || intTaxClass[:taxonValue] == ''
- responseObj[:readerExecutionMessages] << 'ERROR: mdJson reader: taxonomic classification latin name is missing'
+ responseObj[:readerExecutionMessages] <<
+ 'ERROR: mdJson reader: taxonomic classification name is missing'
responseObj[:readerExecutionPass] = false
return nil
end
# taxonomic classification - common name []