adiwg-mdtranslator 2.19.0.pre.beta.31 → 2.20.0.pre.beta.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test.yml +1 -1
  3. data/DCAT-US.md +67 -0
  4. data/Gemfile.lock +41 -31
  5. data/README.md +21 -0
  6. data/Rakefile +1 -0
  7. data/adiwg-mdtranslator.gemspec +2 -2
  8. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dataQuality.rb +58 -92
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_conformanceResult.rb +0 -5
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_coverageResult.rb +0 -4
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dataQuality.rb +0 -7
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_descriptiveResult.rb +0 -4
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_quantitativeResult.rb +0 -4
  14. data/lib/adiwg/mdtranslator/version.rb +1 -1
  15. data/lib/adiwg/mdtranslator/writers/dcat_us/dcat_us_writer.rb +98 -0
  16. data/lib/adiwg/mdtranslator/writers/dcat_us/readme.md +10 -0
  17. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_level.rb +55 -0
  18. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_access_url.rb +17 -0
  19. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_accrualPeriodicity.rb +45 -0
  20. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_bureau_code.rb +33 -0
  21. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_contact_point.rb +29 -0
  22. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_dcat_us.rb +104 -0
  23. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by.rb +29 -0
  24. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_described_by_type.rb +33 -0
  25. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_description.rb +19 -0
  26. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_distribution.rb +59 -0
  27. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_download_url.rb +17 -0
  28. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_identifier.rb +29 -0
  29. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_is_part_of.rb +27 -0
  30. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_issued.rb +19 -0
  31. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_keyword.rb +19 -0
  32. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_landing_page.rb +27 -0
  33. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_language.rb +23 -0
  34. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_license.rb +18 -0
  35. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_media_type.rb +17 -0
  36. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_modified.rb +29 -0
  37. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_primaryITInvestmentUII.rb +19 -0
  38. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_program_code.rb +33 -0
  39. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_publisher.rb +74 -0
  40. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_references.rb +50 -0
  41. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_rights.rb +32 -0
  42. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_spatial.rb +32 -0
  43. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_system_of_records.rb +28 -0
  44. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_temporal.rb +40 -0
  45. data/lib/adiwg/mdtranslator/writers/dcat_us/sections/dcat_us_theme.rb +28 -0
  46. data/lib/adiwg/mdtranslator/writers/dcat_us/version.rb +14 -0
  47. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dataQuality.rb +115 -133
  48. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_spatialDomain.rb +1 -1
  49. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataQuality.rb +1 -17
  50. data/lib/adiwg/mdtranslator/writers/html/sections/html_dataQualityReport.rb +0 -28
  51. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_dataIdentification.rb +0 -29
  52. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_dataQualityReport.rb +1 -1
  53. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_gcoDateTime.rb +1 -10
  54. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_mdMetadata.rb +0 -27
  55. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_timePeriod.rb +6 -2
  56. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_conformanceResult.rb +5 -6
  57. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_coverageResult.rb +0 -1
  58. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_descriptiveResult.rb +0 -1
  59. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_onlineResource.rb +1 -1
  60. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_quantitativeResult.rb +5 -6
  61. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_resourceInfo.rb +1 -1
  62. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +26 -9
  63. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_allocation.rb +1 -1
  64. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_citation.rb +8 -8
  65. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQuality.rb +1 -1
  66. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_dataQualityReport.rb +3 -3
  67. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_geographicExtent.rb +1 -1
  68. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_lineage.rb +4 -4
  69. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_maintenance.rb +4 -4
  70. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_medium.rb +2 -2
  71. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_metadataInfo.rb +4 -4
  72. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_releasability.rb +1 -1
  73. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_resourceInfo.rb +5 -5
  74. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_responsibility.rb +1 -1
  75. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_spatialRepresentation.rb +4 -4
  76. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_taxonomy.rb +1 -1
  77. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timeInstant.rb +1 -1
  78. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_timePeriod.rb +5 -5
  79. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_transferOption.rb +2 -2
  80. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_usage.rb +5 -5
  81. data/lib/adiwg/mdtranslator/writers/simple_html/sections/html_vectorRepresentation.rb +2 -2
  82. data/lib/adiwg/mdtranslator_cli.rb +1 -1
  83. metadata +39 -8
  84. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_enumerationList.rb +0 -52
  85. data/lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_extension.rb +0 -208
@@ -0,0 +1,19 @@
1
+ require 'jbuilder'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Writers
6
+ module Dcat_us
7
+ module PrimaryITInvestmentUII
8
+
9
+ def self.build(intObj)
10
+ primaryITInvestmentUII = intObj[:metadata][:metadataInfo][:metadataIdentifier][:identifier]
11
+
12
+ primaryITInvestmentUII ? primaryITInvestmentUII : nil
13
+ end
14
+
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,33 @@
1
+ require 'jbuilder'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Writers
6
+ module Dcat_us
7
+ module ProgramCode
8
+
9
+ def self.build(intObj)
10
+
11
+ responsibleParties = intObj[:metadata][:resourceInfo][:citation][:responsibleParties]
12
+ contacts = []
13
+ responsibleParties.each do |party|
14
+ contactId = party[:parties][0][:contactId]
15
+ contacts << Dcat_us.get_contact_by_id(contactId)
16
+ end
17
+
18
+ programContacts = contacts&.select { |contact| contact[:externalIdentifier].any? { |id| id[:namespace] == 'programCode'} }
19
+
20
+ programsCodes = []
21
+ programContacts.each do |contact|
22
+ programCode = contact[:externalIdentifier].find { |id| id[:namespace] == 'programCode' }
23
+ programsCodes << programCode[:identifier]
24
+ end
25
+
26
+ return programsCodes
27
+ end
28
+
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,74 @@
1
+ module ADIWG
2
+ module Mdtranslator
3
+ module Writers
4
+ module Dcat_us
5
+ module Publisher
6
+ def self.build(intObj)
7
+ contacts = intObj.dig(:contacts)
8
+ metadata = intObj.dig(:metadata)
9
+ responsible_parties = metadata&.dig(:resourceInfo, :citation, :responsibleParties)
10
+ resource_distributions = metadata&.dig(:distributorInfo)
11
+
12
+ publisher = find_publisher(responsible_parties) || find_distributions_publisher(intObj)
13
+
14
+ return if publisher.nil?
15
+
16
+ name, org_name = extract_names(publisher, contacts)
17
+
18
+ return if name.nil?
19
+
20
+ build_json(name, org_name)
21
+ end
22
+
23
+ private
24
+
25
+ def self.find_publisher(responsible_parties)
26
+ responsible_parties&.detect do |party|
27
+ party[:roleName] == 'publisher' && party.dig(:parties)&.first&.dig(:contactType) == 'organization'
28
+ end
29
+ end
30
+
31
+ def self.find_distributions_publisher(intObj)
32
+ distributor_info = intObj.dig(:metadata, :distributorInfo) || []
33
+ distributor_info.each do |distribution|
34
+ distributors = distribution[:distributor] || []
35
+ distributors.each do |dist|
36
+ contact_type = dist.dig(:contact, :parties, 0, :contactType)
37
+ return dist[:contact] if contact_type == 'organization'
38
+ end
39
+ end
40
+ nil
41
+ end
42
+
43
+ def self.extract_names(publisher, contacts)
44
+ contact_id = publisher.dig(:parties)&.first&.dig(:contactId) || publisher[:contactId]
45
+ related_contact = contacts&.detect { |contact| contact[:contactId] == contact_id }
46
+ org_name = nil
47
+ if related_contact
48
+ member_of_org_ids = related_contact[:memberOfOrgs]
49
+ member_of_orgs = contacts.select { |contact| member_of_org_ids&.include?(contact[:contactId]) && contact[:isOrganization] }
50
+ org_name = member_of_orgs.first&.dig(:name)
51
+ end
52
+ name = publisher.dig(:parties)&.first&.dig(:contactName) || publisher[:contactName]
53
+ [name, org_name]
54
+ end
55
+
56
+ def self.build_json(name, org_name)
57
+ Jbuilder.new do |json|
58
+ json.set!('@type', 'org:Organization')
59
+ json.set!('name', name)
60
+
61
+ if org_name
62
+ json.subOrganizationOf do |json_sub|
63
+ json_sub.set!('@type', 'org:Organization')
64
+ json_sub.set!('name', org_name)
65
+ end
66
+ end
67
+ end
68
+ end
69
+
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,50 @@
1
+ require 'jbuilder'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Writers
6
+ module Dcat_us
7
+ module References
8
+
9
+ def self.build(intObj)
10
+ metadata = intObj.dig(:metadata)
11
+ associated_resources = metadata&.dig(:associatedResources)
12
+ additional_documents = metadata&.dig(:additionalDocuments)
13
+ uris = []
14
+
15
+ if associated_resources
16
+ associated_resources.each do |associated|
17
+ citation = associated.dig(:resourceCitation)
18
+ online_resources = citation&.dig(:onlineResources)
19
+ next unless online_resources
20
+
21
+ online_resources.each do |online|
22
+ uri = online.dig(:olResURI)
23
+ uris << uri if uri
24
+ end
25
+ end
26
+ end
27
+
28
+ if additional_documents
29
+ additional_documents.each do |additional|
30
+ citations = additional&.dig(:citation) || []
31
+ citations.each do |citation|
32
+ online_resources = citation&.dig(:onlineResources)
33
+ next unless online_resources
34
+
35
+ online_resources.each do |online|
36
+ uri = online.dig(:olResURI)
37
+ uris << uri if uri
38
+ end
39
+ end
40
+ end
41
+ end
42
+
43
+ uris.join(',')
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,32 @@
1
+ module ADIWG
2
+ module Mdtranslator
3
+ module Writers
4
+ module Dcat_us
5
+ module Rights
6
+
7
+ def self.build(intObj, accessLevel)
8
+ resourceInfo = intObj.dig(:metadata, :resourceInfo)
9
+ constraints = resourceInfo&.dig(:constraints)
10
+
11
+ if accessLevel && ["restricted public", "non-public"].include?(accessLevel)
12
+ constraints&.each do |constraint|
13
+ if constraint[:type] == "use"
14
+ statement = constraint.dig(:releasability, :statement)
15
+ disseminationConstraints = constraint.dig(:releasability, :disseminationConstraint)
16
+
17
+ if statement && disseminationConstraints
18
+ combinedConstraints = disseminationConstraints.join(" ")
19
+ return "#{statement} #{combinedConstraints}".strip
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ nil
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,32 @@
1
+ module ADIWG
2
+ module Mdtranslator
3
+ module Writers
4
+ module Dcat_us
5
+ module Spatial
6
+
7
+ def self.build(intObj)
8
+ resourceInfo = intObj.dig(:metadata, :resourceInfo)
9
+ extent = resourceInfo&.dig(:extents, 0)
10
+ geographicExtent = extent&.dig(:geographicExtents, 0)
11
+ boundingBox = geographicExtent&.dig(:boundingBox)
12
+
13
+ if boundingBox
14
+ return [
15
+ boundingBox[:eastLongitude],
16
+ boundingBox[:southLatitude],
17
+ boundingBox[:westLongitude],
18
+ boundingBox[:northLatitude]
19
+ ].join(',')
20
+ elsif geographicExtent&.dig(:geographicElement, 0, :type) == 'point'
21
+ point = geographicExtent.dig(:geographicElement, 0, :coordinate)
22
+ return "#{point[1]},#{point[0]}" if point&.length == 2
23
+ end
24
+
25
+ nil
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,28 @@
1
+ require 'jbuilder'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Writers
6
+ module Dcat_us
7
+ module SystemOfRecords
8
+
9
+ def self.build(intObj)
10
+ associatedResources = intObj.dig(:metadata, :associatedResources)
11
+
12
+ return nil if associatedResources.nil?
13
+
14
+ associatedResources.each do |resource|
15
+ if resource[:initiativeType] == 'sorn'
16
+ onlineResources = resource.dig(:resourceCitation, :onlineResources)
17
+ return onlineResources.first[:olResURI] if onlineResources&.first&.has_key?(:olResURI)
18
+ end
19
+ end
20
+
21
+ return nil
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,40 @@
1
+ module ADIWG
2
+ module Mdtranslator
3
+ module Writers
4
+ module Dcat_us
5
+ module Temporal
6
+
7
+ def self.build(intObj)
8
+ resourceInfo = intObj.dig(:metadata, :resourceInfo)
9
+ extent = resourceInfo&.dig(:extents, 0)
10
+ temporalExtents = extent&.dig(:temporalExtents)
11
+
12
+ if temporalExtents
13
+ temporalExtents.each do |temporalExtent|
14
+ timePeriod = temporalExtent&.dig(:timePeriod)
15
+ next unless timePeriod
16
+
17
+ startDateHash = timePeriod[:startDateTime]
18
+ endDateHash = timePeriod[:endDateTime]
19
+
20
+ startDate = startDateHash&.dig(:dateTime)
21
+ endDate = endDateHash&.dig(:dateTime)
22
+
23
+ if startDate && endDate
24
+ return "#{startDate}/#{endDate}"
25
+ elsif startDate
26
+ return startDate
27
+ elsif endDate
28
+ return endDate
29
+ end
30
+ end
31
+ end
32
+
33
+ nil
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,28 @@
1
+ require 'jbuilder'
2
+
3
+ module ADIWG
4
+ module Mdtranslator
5
+ module Writers
6
+ module Dcat_us
7
+ module Theme
8
+
9
+ def self.build(intObj)
10
+ resourceInfo = intObj[:metadata][:resourceInfo]
11
+ keywords_str = []
12
+
13
+ resourceInfo[:keywords].each do |keyword_group|
14
+ if keyword_group[:thesaurus][:title] == "ISO Topic Categories"
15
+ keyword_group[:keywords].each do |keyword_obj|
16
+ keywords_str << keyword_obj[:keyword]
17
+ end
18
+ end
19
+ end
20
+
21
+ return keywords_str.join(" ")
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,14 @@
1
+ # dcat_us version history
2
+ # Johnathan Aspinwall 2023-06-22 created for mdJson/mdTranslator 2.0
3
+
4
+ module ADIWG
5
+ module Mdtranslator
6
+ module Writers
7
+ module Dcat_us
8
+
9
+ VERSION = '1.0.0'
10
+
11
+ end
12
+ end
13
+ end
14
+ end
@@ -8,142 +8,124 @@
8
8
  require_relative 'class_lineage'
9
9
 
10
10
  module ADIWG
11
- module Mdtranslator
12
- module Writers
13
- module Fgdc
14
-
15
- class DataQuality
16
-
17
- def initialize(xml, hResponseObj)
18
- @xml = xml
19
- @hResponseObj = hResponseObj
20
- @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
21
- end
22
-
23
- def writeXML(intObj)
24
-
25
- # classes used
26
- lineageClass = Lineage.new(@xml, @hResponseObj)
27
-
28
- hDataQuality = intObj.dig(:metadata, :dataQuality, 0)
29
-
30
- if hDataQuality && hDataQuality[:report]
31
- # data quality 2.1 (attracc) - Attribute Accuracy
32
- attribute_accuracy_report_text = hDataQuality[:report].select do |report|
33
- [
34
- 'DQ_NonQuantitativeAttributeCorrectness',
35
- 'DQ_ThematicClassificationCorrectness'
36
- ].include?(report[:type]) && !report.dig(:descriptiveResult, 0, :statement).nil?
37
- end.map { |report| report.dig(:descriptiveResult, 0, :statement) }.compact.join(' ')
38
-
39
- quantitative_attribute_accuracy = hDataQuality[:report].find { |report| report[:type] == 'DQ_QuantitativeAttributeAccuracy' }
40
- attribute_accuracy_value = quantitative_attribute_accuracy.dig(:quantitativeResult, 0, :values, 0) if quantitative_attribute_accuracy
41
- attribute_evaluation_method = quantitative_attribute_accuracy.dig(:evaluationMethod, :methodDescription) if quantitative_attribute_accuracy
42
-
43
- if attribute_accuracy_report_text != '' || attribute_accuracy_value || attribute_evaluation_method
44
- @xml.tag!('attracc') do
45
- @xml.tag!('attraccr', attribute_accuracy_report_text) unless attribute_accuracy_report_text.empty?
46
- if attribute_accuracy_value || attribute_evaluation_method
47
- @xml.tag!('qattracc') do
48
- @xml.tag!('attraccv', attribute_accuracy_value) if attribute_accuracy_value
49
- @xml.tag!('attracce', attribute_evaluation_method) if attribute_evaluation_method
50
- end
11
+ module Mdtranslator
12
+ module Writers
13
+ module Fgdc
14
+
15
+ class DataQuality
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Fgdc
21
+ end
22
+
23
+ def writeXML(intObj)
24
+
25
+ # classes used
26
+ lineageClass = Lineage.new(@xml, @hResponseObj)
27
+
28
+ hDataQuality = intObj.dig(:metadata, :dataQuality, 0)
29
+
30
+ if hDataQuality && hDataQuality[:report]
31
+ # data quality 2.1 (attracc) - attribute accuracy (not implemented)
32
+ attribute_completeness_report = hDataQuality[:report].find do |report|
33
+ report[:type] == 'NonQuantitativeAttributeCorrectness' &&
34
+ !report.dig(:descriptiveResult, 0, :statement).nil?
35
+ end
36
+
37
+ if attribute_completeness_report
38
+ @xml.tag!('attracc') do
39
+ @xml.tag!('attraccr', attribute_completeness_report[:descriptiveResult][0][:statement])
40
+ end
41
+ elsif @hResponseObj[:writerShowTags]
42
+ @xml.tag!('attracc', 'Not Reported')
43
+ end
44
+
45
+ # data quality 2.2 (logic) - logical consistency (not implemented) (required)
46
+ logic_report = hDataQuality[:report].find do |report|
47
+ report[:type] == 'ConceptualConsistency' &&
48
+ !report.dig(:qualityMeasure, :description).nil?
49
+ end
50
+
51
+ if logic = logic_report&.dig(:qualityMeasure, :description)
52
+ @xml.tag!('logic', logic)
53
+ else
54
+ @xml.tag!('logic', 'Not Reported')
55
+ end
56
+
57
+ # data quality 2.3 (complete) - completion report (not implemented) (required)
58
+ completeness_report = hDataQuality[:report].find do |report|
59
+ report[:type] == 'Omission' &&
60
+ !report.dig(:descriptiveResult, 0, :statement).nil?
61
+ end
62
+
63
+ if complete = completeness_report&.dig(:descriptiveResult, 0, :statement)
64
+ @xml.tag!('complete', complete)
65
+ else
66
+ @xml.tag!('complete', 'Not Reported')
67
+ end
68
+
69
+ # data quality 2.4 (position) - positional accuracy
70
+
71
+
72
+ horizontal_positional_accuracy_report = hDataQuality[:report].find do |report|
73
+ report[:type] == 'AbsoluteExternalPositionalAccuracy' &&
74
+ report.dig(:qualityMeasure, :nameOfMeasure)&.any? { |name|
75
+ name == 'Horizontal Positional Accuracy Report'
76
+ }
77
+ end
78
+
79
+ horizpar = horizontal_positional_accuracy_report&.dig(:evaluationMethod, :methodDescription)
80
+
81
+
82
+ vertical_positional_accuracy_report = hDataQuality[:report].find do |report|
83
+ report[:type] == 'AbsoluteExternalPositionalAccuracy' &&
84
+ report.dig(:qualityMeasure, :nameOfMeasure)&.any? { |name|
85
+ name == 'Vertical Positional Accuracy Report'
86
+ }
87
+ end
88
+
89
+ vertaccr = vertical_positional_accuracy_report&.dig(:evaluationMethod, :methodDescription)
90
+
91
+ if horizpar || vertaccr
92
+ @xml.tag!('posacc') do
93
+ if horizpar
94
+ @xml.tag!('horizpa') do
95
+ @xml.tag!('horizpar', horizpar)
96
+ end
97
+ end
98
+
99
+ if vertaccr
100
+ @xml.tag!('vertacc') do
101
+ @xml.tag!('vertaccr', vertaccr)
102
+ end
103
+ end
104
+ end
105
+ elsif @hResponseObj[:writerShowTags]
106
+ @xml.tag!('position', 'Not Reported')
107
+ end
51
108
  end
52
- end
53
- elsif @hResponseObj[:writerShowTags]
54
- @xml.tag!('attracc', 'Not Reported')
55
- end
56
-
57
- # data quality 2.2 (logic) - logical consistency (required)
58
- logic_reports = hDataQuality[:report].select do |report|
59
- [
60
- 'DQ_ConceptualConsistency',
61
- 'DQ_DomainConsistency',
62
- 'DQ_FormatConsistency',
63
- 'DQ_TopologicalConsistency'
64
- ].include?(report[:type]) && !report.dig(:descriptiveResult, 0, :statement).nil?
65
- end
66
-
67
- logic = logic_reports.map { |report| report.dig(:descriptiveResult, 0, :statement) }.compact.join(' ')
68
-
69
- if logic != ''
70
- @xml.tag!('logic', logic)
71
- else
72
- @xml.tag!('logic', 'Not Reported')
73
- end
74
-
75
- # data quality 2.3 (complete) - completion report (required)
76
- omission = hDataQuality[:report].find { |report| report[:type] == 'DQ_CompletenessOmission' }&.dig(:descriptiveResult, 0, :statement)
77
- commission = hDataQuality[:report].find { |report| report[:type] == 'DQ_CompletenessCommission' }&.dig(:descriptiveResult, 0, :statement)
78
- complete = [omission, commission].compact.join(' ')
79
- if complete != ''
80
- @xml.tag!('complete', complete)
81
- else
82
- @xml.tag!('complete', 'Not Reported')
83
- end
84
-
85
- # data quality 2.4 (posacc) - Positional Accuracy
86
- reports = hDataQuality[:report].select do |report|
87
- [
88
- 'DQ_AbsoluteExternalPositionalAccuracy',
89
- 'DQ_RelativeInternalPositionalAccuracy',
90
- 'DQ_GriddedDataPositionalAccuracy'
91
- ].include?(report[:type]) && !report.dig(:descriptiveResult, 0, :statement).nil?
92
- end
93
-
94
- horizpar = ''
95
- vertaccr = ''
96
-
97
- reports.each do |report|
98
- descriptive_result = report.dig(:descriptiveResult, 0)
99
- next unless descriptive_result
100
-
101
- if descriptive_result[:name] == 'Vertical Positional Accuracy Report'
102
- vertaccr = descriptive_result[:statement]
103
- else
104
- horizpar = descriptive_result[:statement]
105
- end
106
- end
107
-
108
- if !horizpar.empty? || !vertaccr.empty?
109
- @xml.tag!('posacc') do
110
- if !horizpar.empty?
111
- @xml.tag!('horizpa') do
112
- @xml.tag!('horizpar', horizpar)
113
- end
109
+
110
+ # data quality 2.5 (lineage) - lineage (required)
111
+ unless intObj[:metadata][:lineageInfo].empty?
112
+ @xml.tag!('lineage') do
113
+ lineageClass.writeXML(intObj[:metadata][:lineageInfo])
114
+ end
115
+ end
116
+ if intObj[:metadata][:lineageInfo].empty?
117
+ @NameSpace.issueWarning(350, nil, 'data quality section')
114
118
  end
115
119
 
116
- if !vertaccr.empty?
117
- @xml.tag!('vertacc') do
118
- @xml.tag!('vertaccr', vertaccr)
119
- end
120
+ # data quality 2.6 (cloud) - cloud cover (not implemented)
121
+ if @hResponseObj[:writerShowTags]
122
+ @xml.tag!('cloud', 'Not Reported')
120
123
  end
121
- end
122
- elsif @hResponseObj[:writerShowTags]
123
- @xml.tag!('position', 'Not Reported')
124
- end
125
-
126
- # data quality 2.5 (lineage) - lineage (required)
127
- unless intObj[:metadata][:lineageInfo].empty?
128
- @xml.tag!('lineage') do
129
- lineageClass.writeXML(intObj[:metadata][:lineageInfo])
130
- end
131
- end
132
- if intObj[:metadata][:lineageInfo].empty?
133
- @NameSpace.issueWarning(350, nil, 'data quality section')
134
- end
135
-
136
- # data quality 2.6 (cloud) - cloud cover (not implemented)
137
- if @hResponseObj[:writerShowTags]
138
- @xml.tag!('cloud', 'Not Reported')
139
- end
140
-
141
- end # writeXML
142
- end # DataQuality
143
-
144
- end # Quality
145
124
 
125
+ end # writeXML
126
+ end # Quality
127
+
128
+ end
146
129
  end
147
- end
148
- end
149
- end
130
+ end
131
+ end
@@ -127,7 +127,7 @@ module ADIWG
127
127
 
128
128
  # altitude bounding (altmax) - maximum altitude (required)
129
129
  unless hBBox[:maximumAltitude].nil?
130
- @xml.tag!('altmax', hBBox[:maximumAltitude])
130
+ @xml.tag!('altmax', hBBox[:minimumAltitude])
131
131
  end
132
132
  if hBBox[:maximumAltitude].nil?
133
133
  @NameSpace.issueWarning(372, 'altmax')
@@ -16,22 +16,6 @@ module ADIWG
16
16
  scopeClass = Html_Scope.new(@html)
17
17
  dataQualityReportClass = Html_DataQualityReport.new(@html)
18
18
 
19
- # system identifier
20
- unless hDataQuality[:systemIdentifier].nil?
21
- systemIdentifier = hDataQuality[:systemIdentifier]
22
- @html.section(:class => 'block') do
23
- @html.details do
24
- @html.summary('System Identifier', {'class' => 'h4'})
25
- @html.em('UUID: ')
26
- @html.text!(systemIdentifier[:uid])
27
- @html.br
28
- @html.em('Label:')
29
- @html.text!(systemIdentifier[:label])
30
- @html.br
31
- end
32
- end
33
- end
34
-
35
19
  # scope
36
20
  unless hDataQuality[:scope].empty?
37
21
  @html.section(:class => 'block') do
@@ -80,7 +64,7 @@ module ADIWG
80
64
  hDataQuality[:report].each do |report|
81
65
  @html.section(:class => 'block') do
82
66
  @html.details do
83
- @html.summary(report[:type], {'class' => 'h5'})
67
+ @html.summary('Report', {'class' => 'h5'})
84
68
  dataQualityReportClass.writeHtml(report)
85
69
  end
86
70
  end