Skip to content

Commit

Permalink
Fix data quality report type
Browse files Browse the repository at this point in the history
Remove DQ_ prefix.
  • Loading branch information
jwaspin committed Mar 14, 2024
1 parent 33b7751 commit 5280efa
Show file tree
Hide file tree
Showing 4 changed files with 3,403 additions and 3,659 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def self.unpack(xDataQual, hMetadata, hDataQuality, hResponseObj)
xAccuracy = xDataQual.xpath('./attracc')
accuracyReport = xAccuracy.xpath('./attraccr').text
report = intMetadataClass.newDataQualityReport
report[:type] = 'DQ_NonQuantitativeAttributeAccuracy'
report[:type] = 'NonQuantitativeAttributeAccuracy'
descriptiveResult = intMetadataClass.newDescriptiveResult
descriptiveResult[:statement] = accuracyReport
report[:descriptiveResult] << descriptiveResult
Expand All @@ -41,7 +41,7 @@ def self.unpack(xDataQual, hMetadata, hDataQuality, hResponseObj)
unless xQuantitativeAccuracy.xpath('./attraccv').empty?
value = xQuantitativeAccuracy.xpath('./attraccv').text
report = intMetadataClass.newDataQualityReport
report[:type] = 'DQ_QuantitativeAttributeAccuracy'
report[:type] = 'QuantitativeAttributeAccuracy'
quantitativeResult = intMetadataClass.newQuantitativeResult
quantitativeResult[:values] << value
report[:quantitativeResult] << quantitativeResult
Expand All @@ -55,7 +55,7 @@ def self.unpack(xDataQual, hMetadata, hDataQuality, hResponseObj)
else
logic = xLogic.text
report = intMetadataClass.newDataQualityReport
report[:type] = 'DQ_ConceptualConsistency'
report[:type] = 'ConceptualConsistency'
report[:qualityMeasure] = intMetadataClass.newQualityMeasure
report[:qualityMeasure][:description] = logic
hDataQuality[:report] << report
Expand All @@ -68,7 +68,7 @@ def self.unpack(xDataQual, hMetadata, hDataQuality, hResponseObj)
else
complete = xComplete.text
report = intMetadataClass.newDataQualityReport
report[:type] = 'DQ_CompletenessOmission'
report[:type] = 'CompletenessOmission'
descriptiveResult = intMetadataClass.newDescriptiveResult
descriptiveResult[:statement] = complete
report[:descriptiveResult] << descriptiveResult
Expand All @@ -82,7 +82,7 @@ def self.unpack(xDataQual, hMetadata, hDataQuality, hResponseObj)
xHorizontal = xPositionalAccuracy.xpath('./horizpa')
unless xHorizontal.empty?
report = intMetadataClass.newDataQualityReport
report[:type] = 'DQ_AbsoluteExternalPositionalAccuracy'
report[:type] = 'AbsoluteExternalPositionalAccuracy'
unless xHorizontal.xpath('qhorizpa/horizpae').empty?
report[:qualityMeasure] = intMetadataClass.newQualityMeasure
report[:qualityMeasure][:description] = xHorizontal.xpath('qhorizpa/horizpae').text
Expand All @@ -105,7 +105,7 @@ def self.unpack(xDataQual, hMetadata, hDataQuality, hResponseObj)
xVertical = xPositionalAccuracy.xpath('./vertacc')
unless xVertical.empty?
report = intMetadataClass.newDataQualityReport
report[:type] = 'DQ_AbsoluteExternalPositionalAccuracy'
report[:type] = 'AbsoluteExternalPositionalAccuracy'
unless xVertical.xpath('qvertpa/vertacce').empty?
report[:qualityMeasure] = intMetadataClass.newQualityMeasure
report[:qualityMeasure][:description] = xVertical.xpath('qvertpa/vertacce').text
Expand Down
10 changes: 5 additions & 5 deletions lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def writeXML(intObj)
if hDataQuality && hDataQuality[:report]
# data quality 2.1 (attracc) - attribute accuracy (not implemented)
attribute_completeness_report = hDataQuality[:report].find do |report|
report[:type] == 'DQ_NonQuantitativeAttributeCompleteness' &&
report[:type] == 'NonQuantitativeAttributeCompleteness' &&
!report.dig(:descriptiveResult, 0, :statement).nil?
end

Expand All @@ -44,7 +44,7 @@ def writeXML(intObj)

# data quality 2.2 (logic) - logical consistency (not implemented) (required)
logic_report = hDataQuality[:report].find do |report|
report[:type] == 'DQ_ConceptualConsistency' &&
report[:type] == 'ConceptualConsistency' &&
!report.dig(:qualityMeasure, :description).nil?
end

Expand All @@ -56,7 +56,7 @@ def writeXML(intObj)

# data quality 2.3 (complete) - completion report (not implemented) (required)
completeness_report = hDataQuality[:report].find do |report|
report[:type] == 'DQ_CompletenessOmission' &&
report[:type] == 'CompletenessOmission' &&
!report.dig(:descriptiveResult, 0, :statement).nil?
end

Expand All @@ -70,7 +70,7 @@ def writeXML(intObj)


horizontal_positional_accuracy_report = hDataQuality[:report].find do |report|
report[:type] == 'DQ_AbsoluteExternalPositionalAccuracy' &&
report[:type] == 'AbsoluteExternalPositionalAccuracy' &&
report.dig(:qualityMeasure, :nameOfMeasure)&.any? { |name|
name == 'Horizontal Positional Accuracy Report'
}
Expand All @@ -80,7 +80,7 @@ def writeXML(intObj)


vertical_positional_accuracy_report = hDataQuality[:report].find do |report|
report[:type] == 'DQ_AbsoluteExternalPositionalAccuracy' &&
report[:type] == 'AbsoluteExternalPositionalAccuracy' &&
report.dig(:qualityMeasure, :nameOfMeasure)&.any? { |name|
name == 'Vertical Positional Accuracy Report'
}
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/mdJson_hash_functions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def build_dataQuality

hDataQuality[:report] = [
{
type: 'DQ_AbsoluteExternalPositionalAccuracy',
type: 'AbsoluteExternalPositionalAccuracy',
standaloneQualityReportDetails: "standalone quality report details 1",
qualityMeasure: {
identifier: {
Expand Down
Loading

0 comments on commit 5280efa

Please sign in to comment.