Skip to content

Commit

Permalink
Merge branch 'feature/acquisition-mdjson-writer' into fix/mdJson-writ…
Browse files Browse the repository at this point in the history
…er-acqusition
  • Loading branch information
jwaspin committed May 2, 2024
2 parents 3cd7445 + cfd6150 commit 8ef4d30
Show file tree
Hide file tree
Showing 9 changed files with 141 additions and 44 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
adiwg-mdtranslator (2.20.0.pre.beta.1)
adiwg-mdtranslator (2.20.0.pre.beta.0)
adiwg-mdcodes (= 2.9.3.pre.beta.3)
adiwg-mdjson_schemas (= 2.9.2.pre.beta.7)
builder (~> 3.2)
Expand Down
3 changes: 2 additions & 1 deletion lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,8 @@ def newPlatform
identifier: {},
description: nil,
sponsors: [],
instruments: []
instruments: [],
history: []
}
end

Expand Down
15 changes: 0 additions & 15 deletions lib/adiwg/mdtranslator/readers/mdJson/modules/module_acq-pass.rb

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
require_relative 'module_scope'
require_relative 'module_requirement'
require_relative 'module_acq-objective'
require_relative 'module_acq-platform'
require_relative 'module_platform'
require_relative 'module_instrument'
require_relative 'module_acq-operation'
require_relative 'module_pass'
require_relative 'module_event'
require_relative 'module_acq-pass'
require_relative 'module_acq-environment'

module ADIWG
Expand Down Expand Up @@ -68,7 +68,7 @@ def self.unpack(hAcquisition, responseObj, inContext = nil)
if hAcquisition.has_key?('platform')
aItems = hAcquisition['platform']
aItems.each do |item|
hReturn = AcqPlatform.unpack(item, responseObj, outContext)
hReturn = Platform.unpack(item, responseObj, outContext)
unless hReturn.nil?
intAcquisition[:platforms] << hReturn
end
Expand Down Expand Up @@ -108,9 +108,9 @@ def self.unpack(hAcquisition, responseObj, inContext = nil)
if hAcquisition.has_key?('pass')
aItems = hAcquisition['pass']
aItems.each do |item|
hReturn = AcqPass.unpack(item, responseObj, outContext)
hReturn = Pass.unpack(item, responseObj, outContext)
unless hReturn.nil?
intAcquisition[:passs] << hReturn
intAcquisition[:passes] << hReturn
end
end
end
Expand Down
53 changes: 53 additions & 0 deletions lib/adiwg/mdtranslator/readers/mdJson/modules/module_pass.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
require_relative 'module_identifier'
require_relative 'module_extent'
require_relative 'module_event'

module ADIWG
module Mdtranslator
module Readers
module MdJson

module Pass
def self.unpack(hPass, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson

intMetadataClass = InternalMetadata.new
intPass = intMetadataClass.newPass

outContext = 'pass'
outContext = inContext + ' > ' + outContext unless inContext.nil?

if hPass.has_key?('passId')
intPass[:passId] = hPass['passId']
else
@MessagePath.issueWarning(40, responseObj, outContext)
end

if hPass.has_key?('identifier')
intPass[:identifier] = Identifier.unpack(hPass['identifier'], responseObj, outContext)
else
@MessagePath.issueWarning(40, responseObj, outContext)
end

if hPass.has_key?('extent')
intPass[:extent] = Extent.unpack(hPass['extent'], responseObj, outContext)
end

if hPass.has_key?('relatedEvent')
hPass['relatedEvent'].each do |item|
hReturn = Event.unpack(item, responseObj, outContext)
unless hReturn.nil?
intPass[:relatedEvents] << hReturn
end
end
end

intPass

end
end

end
end
end
end
76 changes: 76 additions & 0 deletions lib/adiwg/mdtranslator/readers/mdJson/modules/module_platform.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
require_relative 'module_citation'
require_relative 'module_identifier'
require_relative 'module_responsibileParty'
require_relative 'module_acq-instrument'
require_relative 'module_acq-instrumentationEventList'

module ADIWG
module Mdtranslator
module Readers
module MdJson

module Platform
def self.unpack(hAcqPlatform, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson

intAcqPlatform = intMetadataClass.newPlatform

if hAcqPlatform.has_key('platformId')
intAcqPlatform[:platformId] = hAcqPlatform['platformId']
else
@MessagePath.issueError(460, responseObj, inContext)
end

if hAcqPlatform.has_key?('citation')
hReturn = Citation.unpack(hAcqPlatform['citation'], responseObj, inContext)
unless hReturn.nil?
intAcqPlatform[:citation] = hReturn
end
end

if hAcqPlatform.has_key?('identifier')
hReturn = Identifier.unpack(hAcqPlatform['identifier'], responseObj, inContext)
unless hReturn.nil?
intAcqPlatform[:identifier] = hReturn
else
@MessagePath.issueError(461, responseObj, inContext)
end
end

if hAcqPlatform.has_key('description')
intAcqPlatform[:description] = hAcqPlatform['description']
else
@MessagePath.issueError(460, responseObj, inContext)
end

if hAcqPlatform.has_key?('sponsor')
hReturn = ResponsibileParty.unpack(hAcqPlatform['sponsor'], responseObj, inContext)
unless hReturn.nil?
intAcqPlatform[:sponsors] = hReturn
end
end

if hAcqPlatform.has_key('instrument')
hReturn = AcqInstrument.unpack(hAcqPlatform['instrument'], responseObj, inContext)
unless hReturn.nil?
intAcqPlatform[:instruments] = hReturn
else
@MessagePath.issueError(461, responseObj, inContext)
end
end

if hAcqPlatform.has_key('history')
hReturn = AcqInstrumentationEventList.unpack(hAcqPlatform['history'], responseObj, inContext)
unless hReturn.nil?
intAcqPlatform[:history] = hReturn
end

intAcqPlatform

end
end

end
end
end
end
2 changes: 1 addition & 1 deletion lib/adiwg/mdtranslator/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
module ADIWG
module Mdtranslator
# current mdtranslator version
VERSION = "2.20.0-beta.1"
VERSION = "2.20.0-beta.0"
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,9 @@ def writeXML(hReport)
end
end
end
# TODO the following will not work until the iso_evaluationMethodType codelist is added to mdCodes
# unless evaluationMethod[:evaluationMethodType].nil?
# @xml.tag!('mdq:evaluationMethodType') do
# codeListClass.writeXML('mcc', 'iso_evaluationMethodType', evaluationMethod[:evaluationMethodType])
# end
# end
@xml.tag!('mdq:evaluationMethodType') do
codeListClass.writeXML('mcc', 'iso_evaluationMethodType', evaluationMethod[:evaluationMethodType])
end
end
end
end # evaluationMethod
Expand Down

0 comments on commit 8ef4d30

Please sign in to comment.