Skip to content

Commit

Permalink
Merge branch 'feature/coverageResult' into injection/mdJson_writer_CR
Browse files Browse the repository at this point in the history
  • Loading branch information
J-Oliveros committed Jan 25, 2024
2 parents a38e083 + 65e4c50 commit 6cc6f81
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 105 deletions.
14 changes: 8 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ PATH
specs:
adiwg-mdtranslator (2.18.5)
adiwg-mdcodes (= 2.8.4)
adiwg-mdjson_schemas (= 2.8.1)
adiwg-mdjson_schemas (= 2.8.2)
builder (~> 3.2)
coderay (~> 1.1)
jbuilder (~> 2.5)
json (~> 2.0)
json-schema (~> 2.7)
kramdown (>= 1.13, < 3.0)
nokogiri (~> 1.7)
nokogiri (~> 1.15)
thor (~> 0.19)
uuidtools (~> 2.1)

Expand All @@ -32,7 +32,7 @@ GEM
public_suffix (>= 2.0.2, < 6.0)
adiwg-mdcodes (2.8.4)
json (~> 2.0)
adiwg-mdjson_schemas (2.8.1)
adiwg-mdjson_schemas (2.8.2)
builder (3.2.4)
coderay (1.1.3)
concurrent-ruby (1.2.2)
Expand All @@ -51,11 +51,13 @@ GEM
loofah (2.21.1)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mini_portile2 (2.4.0)
minitest (5.20.0)
nokogiri (1.10.10)
mini_portile2 (~> 2.4.0)
nokogiri (1.15.5-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.5-x86_64-linux)
racc (~> 1.4)
public_suffix (4.0.7)
racc (1.7.3)
rails-dom-testing (2.1.1)
activesupport (>= 5.0.0)
minitest
Expand Down
4 changes: 2 additions & 2 deletions adiwg-mdtranslator.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "thor", "~> 0.19"
spec.add_runtime_dependency "uuidtools", "~> 2.1"
spec.add_runtime_dependency "json-schema", "~> 2.7"
spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.8.1"
spec.add_runtime_dependency "adiwg-mdjson_schemas", "2.8.2"
spec.add_runtime_dependency "adiwg-mdcodes", "2.8.4"
spec.add_runtime_dependency "jbuilder", "~> 2.5"
spec.add_runtime_dependency "kramdown", ">= 1.13", "< 3.0"
spec.add_runtime_dependency "coderay", "~> 1.1"
spec.add_runtime_dependency "nokogiri", "~> 1.7"
spec.add_runtime_dependency "nokogiri", "~> 1.15"

end
4 changes: 2 additions & 2 deletions lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ def newCoverageResult
scope: {},
spatialRepresentationType: nil,
spatialRepresentation: {},
resultContent: [],
resultContentDescription: {},
resourceFormat: {},
resultFile: {}
}
Expand Down Expand Up @@ -736,8 +736,8 @@ def newDataQualityReport

def newStandaloneReport
{
reportReference: {},
abstract: nil,
reportReference: {},
}
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ def self.unpack(hReport, responseObj, inContext = nil)

intReport[:type] = hReport["type"]

if hReport.has_key?('standaloneQualityReportDetails')
intReport[:standaloneQualityReportDetails] = hReport['standaloneQualityReportDetails']
end

if hReport.has_key?('conformanceResult')
hReport['conformanceResult'].each do |item|
hReturn = ConformanceResult.unpack(item, responseObj)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,21 @@ def self.unpack(hLegalCon, responseObj, inContext = nil)

haveLegal = false

# legal constraint - use constraint []
if hLegalCon.has_key?('useConstraint')
hLegalCon['useConstraint'].each do |item|
# legal constraint - access constraint []
if hLegalCon.has_key?('accessConstraint')
hLegalCon['accessConstraint'].each do |item|
unless item == ''
intLegalCon[:useCodes] << item
intLegalCon[:accessCodes] << item
haveLegal = true
end
end
end

# legal constraint - access constraint []
if hLegalCon.has_key?('accessConstraint')
hLegalCon['accessConstraint'].each do |item|
# legal constraint - use constraint []
if hLegalCon.has_key?('useConstraint')
hLegalCon['useConstraint'].each do |item|
unless item == ''
intLegalCon[:accessCodes] << item
intLegalCon[:useCodes] << item
haveLegal = true
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ def self.build(hAllocation)
json.recipientId hAllocation[:recipientId]
json.responsibleParty @Namespace.json_map(hAllocation[:responsibleParties], ResponsibleParty)
json.matching hAllocation[:matching]
json.onlineResource @Namespace.json_map(hAllocation[:onlineResources], OnlineResource)
json.comment hAllocation[:comment]
json.onlineResource @Namespace.json_map(hAllocation[:onlineResources], OnlineResource)
end

end # build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
require 'jbuilder'
require_relative 'mdJson_scope'
require_relative 'mdJson_dataQualityReport'
require_relative 'mdJson_citation'
require_relative 'mdJson_standaloneQualityReport'

module ADIWG
module Mdtranslator
Expand All @@ -17,7 +19,7 @@ def self.build(hDataQuality)
Jbuilder.new do |json|
json.scope Scope.build(hDataQuality[:scope])
json.systemIdentifier hDataQuality[:systemIdentifier]
json.standaloneQualityReport hDataQuality[:standaloneQualityReport]
json.standaloneQualityReport StandaloneQualityReport.build(hDataQuality[:standaloneReport]) unless hDataQuality[:standaloneReport].nil?
json.report @Namespace.json_map(hDataQuality[:report], DataQualityReport)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ module Funding
def self.build(hFunding)

Jbuilder.new do |json|
json.description hFunding[:description]
json.timePeriod TimePeriod.build(hFunding[:timePeriod]) unless hFunding[:timePeriod].empty?
json.allocation @Namespace.json_map(hFunding[:allocations], Allocation)
json.timePeriod TimePeriod.build(hFunding[:timePeriod]) unless hFunding[:timePeriod].empty?
json.description hFunding[:description]
end

end # build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ module LegalConstraint
def self.build(hLegal)

Jbuilder.new do |json|
json.useConstraint hLegal[:useCodes] unless hLegal[:useCodes].empty?
json.accessConstraint hLegal[:accessCodes] unless hLegal[:accessCodes].empty?
json.useConstraint hLegal[:useCodes] unless hLegal[:useCodes].empty?
json.otherConstraint hLegal[:otherCons] unless hLegal[:otherCons].empty?
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ def self.build(hMetadata)
Jbuilder.new do |json|
json.metadataInfo MetadataInfo.build(hMetadata[:metadataInfo])
json.resourceInfo ResourceInfo.build(hMetadata[:resourceInfo])
json.dataQuality @Namespace.json_map(hMetadata[:dataQuality], DataQuality)
json.resourceLineage @Namespace.json_map(hMetadata[:lineageInfo], LineageInfo)
json.resourceDistribution @Namespace.json_map(hMetadata[:distributorInfo], Distribution)
json.associatedResource @Namespace.json_map(hMetadata[:associatedResources], AssociatedResource)
json.additionalDocumentation @Namespace.json_map(hMetadata[:additionalDocuments], AdditionalDocument)
json.funding @Namespace.json_map(hMetadata[:funding], Funding)
json.dataQuality @Namespace.json_map(hMetadata[:dataQuality], DataQuality)
end

end # build
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# mdJson 2.0 writer - dataQuality

require 'jbuilder'
require_relative 'mdJson_citation'

module ADIWG
module Mdtranslator
module Writers
module MdJson

module StandaloneQualityReport

@Namespace = ADIWG::Mdtranslator::Writers::MdJson

def self.build(hStandaloneReport)
reportReference = hStandaloneReport[:reportReference]
Jbuilder.new do |json|
json.reportReference Citation.build(reportReference)
json.abstract hStandaloneReport[:abstract]
end

end

end

end
end
end
end


122 changes: 62 additions & 60 deletions test/helpers/mdJson_hash_functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,68 @@ def build_dataDictionary
return hDictionary
end

def build_dataQuality
hDataQuality = dataQuality
hDataQuality[:scope] = build_scope_full
hDataQuality[:standaloneQualityReport] = {
reportReference: build_citation('standalone quality report 1'),
abstract: "standalone quality report 1"
}

hDataQuality[:report] = [
{
type: 'DQ_AbsoluteExternalPositionalAccuracy',
standaloneQualityReportDetails: "standalone quality report details 1",
qualityMeasure: {
identifier: {
identifier: 'identifier',
namespace: 'namespace',
version: 'version',
description: 'description'
},
name: ['name of measure'],
description: 'description'
},
evaluationMethod: {
type: 'DQ_EvaluationMethod',
dateTime: ['2019-06-11T08:35:00', '2019-06-11T09:00:00'],
methodDescription: 'evaluation method description',
evaluationProcedure: { title: 'EP Title' },
referenceDocument: [ ],
evaluationMethodType: 'DQ_EvaluationMethodTypeCode',
deductiveSource: 'deductive source',
samplingScheme: 'sampling scheme',
lotDescription: 'lot description',
samplingRatio: 'sampling ratio'
},
quantitativeResult: [
{
dateTime: "2019-06-11T09:00:00",
scope: build_scope_full,
value: [9.99, 9.0],
valueUnits: "value units",
valueRecordType: "value record type"
}
],
descriptiveResult: [{
dateTime: "2019-06-11T09:00:00",
scope: build_scope_full,
statement: "statement"
}],
conformanceResult: [{
dateTime: "2019-06-11T09:00:00",
scope: build_scope_full,
specification: build_citation('alternate metadata title one'),
explanation: "conformance result explanation",
pass: false
}],
# derivedElementReports: [],
}
]

return hDataQuality
end

def build_date(dateTime, type = 'none')
hDate = date
hDate[:date] = dateTime
Expand Down Expand Up @@ -157,66 +219,6 @@ def build_funding(id = nil, amount = nil, description = nil)
hFunding[:description] = description unless description.nil?
return hFunding
end

def build_dataQuality
hDataQuality = dataQuality
hDataQuality[:scope] = build_scope_full
hDataQuality[:standaloneQualityReport] = {
abstract: "standalone quality report 1"
}

hDataQuality[:report] = [
{
conformanceResult: [{
dateTime: "2019-06-11T09:00:00",
scope: build_scope_full,
specification: build_citation('alternate metadata title one'),
explanation: "conformance result explanation",
pass: false
}],
descriptiveResult: [{
dateTime: "2019-06-11T09:00:00",
scope: build_scope_full,
statement: "statement"
}],
qualityMeasure: {
identifier: {
identifier: 'identifier',
description: 'description',
namespace: 'namespace',
version: 'version'
},
name: ['name of measure'],
description: 'description'
},
evaluationMethod: {
type: 'evaluation method type - enumerated',
dateTime: '2019-06-11T08:35:00',
methodDescription: 'evaluation method description',
evaluationProcedure: { title: 'EP Title' },
referenceDocument: [ ],
evaluationMethodType: 'DQ_EvaluationMethodTypeCode',
deductiveSource: 'deductive source',
samplingScheme: 'sampling scheme',
lotDescription: 'lot description',
samplingRatio: 'sampling ratio'
},
quantitativeResult: [
{
dateTime: "2019-06-11T09:00:00",
scope: build_scope_full,
value: [9.99, 9.0],
valueUnits: "value units",
valueRecordType: "value record type"
}
],
# derivedElementReports: [],
# relatedElementReports: []
}
]

return hDataQuality
end

def build_geoJson
aGeoJson = []
Expand Down
Loading

0 comments on commit 6cc6f81

Please sign in to comment.