cqm-validators 0.1.0 → 2.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +5 -5
  2. data/.github/PULL_REQUEST_TEMPLATE.md +23 -0
  3. data/.gitignore +3 -1
  4. data/.overcommit.yml +18 -0
  5. data/.rubocop.yml +68 -0
  6. data/.simplecov +12 -0
  7. data/.travis.yml +20 -0
  8. data/Gemfile +11 -3
  9. data/README.md +20 -6
  10. data/Rakefile +8 -6
  11. data/config/mongoid.yml +6 -0
  12. data/cqm_validators.gemspec +23 -14
  13. data/lib/base_validator.rb +20 -20
  14. data/lib/cqm_validators.rb +4 -2
  15. data/lib/cqm_validators/version.rb +3 -1
  16. data/lib/data_validator.rb +74 -79
  17. data/lib/measure_validator.rb +104 -107
  18. data/lib/performance_rate_validator.rb +43 -63
  19. data/lib/qrda_qdm_template_validator.rb +164 -311
  20. data/lib/reported_result_extractor.rb +137 -139
  21. data/lib/schema_validator.rb +20 -19
  22. data/lib/schematron/c_processor.rb +19 -19
  23. data/lib/schematron/java_processor.rb +66 -68
  24. data/lib/schematron/qrda/{cat_1_r4/HL7 QRDA Category I STU 4.sch → cat_1_r5_1/HL7 QRDA Category I STU 5.1.sch } +1684 -2082
  25. data/lib/schematron/qrda/{cat_1_r3_1 → cat_1_r5_1}/voc.xml +1223 -1228
  26. data/lib/schematron_validator.rb +31 -32
  27. data/lib/validation_error.rb +11 -9
  28. data/lib/validators.rb +40 -106
  29. data/notice.md +9 -0
  30. metadata +97 -36
  31. data/lib/schematron/qrda/cat_1/HL7_CDAR2_QRDA_Category_I_2_12_16.sch +0 -4693
  32. data/lib/schematron/qrda/cat_1/voc.xml +0 -1177
  33. data/lib/schematron/qrda/cat_1_r2/QRDA Category I Release 2.sch +0 -4069
  34. data/lib/schematron/qrda/cat_1_r2/voc.xml +0 -1065
  35. data/lib/schematron/qrda/cat_1_r3_1/HL7 QRDA Category I STU 3.1.sch +0 -3573
  36. data/lib/schematron/qrda/cat_1_r3_1/HL7 QRDA Category III STU 1.1.sch +0 -464
  37. data/lib/schematron/qrda/cat_1_r3_1/QRDA Category I STU Release 3.1.sch +0 -5394
  38. data/lib/schematron/qrda/cat_1_r4/voc.xml +0 -1186
  39. data/lib/schematron/qrda/cat_3/QRDA Category III.sch +0 -675
  40. data/lib/schematron/qrda/cat_3/voc.xml +0 -21
  41. data/lib/schematron/qrda/cat_3_r1_1/HL7 QRDA Category III STU 1.1.sch +0 -528
  42. data/lib/schematron/qrda/cat_3_r1_1/voc.xml +0 -8
  43. data/lib/schematron/qrda/cat_3_r2/HL7 QRDA Category III STU 2.sch +0 -677
  44. data/lib/schematron/qrda/cat_3_r2/voc.xml +0 -1186
@@ -1,38 +1,37 @@
1
- module CqmValidators
2
- module Schematron
3
- NAMESPACE = {"svrl" => "http://purl.oclc.org/dsdl/svrl"}
4
- DIR = File.expand_path("../../", __FILE__)
5
- ISO_SCHEMATRON = File.join(DIR, 'lib/schematron/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl')
1
+ # frozen_string_literal: true
6
2
 
7
- class Validator
8
- include BaseValidator
3
+ module CqmValidators
4
+ module Schematron
5
+ NAMESPACE = { 'svrl' => 'http://purl.oclc.org/dsdl/svrl' }.freeze
6
+ DIR = File.expand_path('..', __dir__)
7
+ ISO_SCHEMATRON = File.join(DIR, 'lib/schematron/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl')
9
8
 
10
- if RUBY_PLATFORM != "java"
11
- require_relative "schematron/c_processor"
12
- include Schematron::CProcessor
13
- else
14
- require_relative 'schematron/java_processor'
15
- include Schematron::JavaProcessor
16
- end
9
+ class Validator
10
+ include BaseValidator
17
11
 
18
- def initialize(name,schematron_file)
19
- @name = name
20
- @schematron_file = schematron_file
21
- end
12
+ if RUBY_PLATFORM != 'java'
13
+ require_relative 'schematron/c_processor'
14
+ include Schematron::CProcessor
15
+ else
16
+ require_relative 'schematron/java_processor'
17
+ include Schematron::JavaProcessor
18
+ end
22
19
 
23
- def validate(document,data = {})
24
- file_errors = document.errors.select { |e| e.fatal? || e.error? }
25
- if file_errors
26
- file_errors.each do |error|
27
- build_error(error, '/', data[:file_name])
28
- end
29
- end
30
- errors = get_errors(document).root.xpath("//svrl:failed-assert",NAMESPACE).map do |el|
31
- build_error(el.xpath('svrl:text',NAMESPACE).text, el['location'], data[:file_name])
32
- end
33
- errors.uniq{|e| "#{e.location}#{e.message}"}
34
- end
20
+ def initialize(name, schematron_file)
21
+ @name = name
22
+ @schematron_file = schematron_file
23
+ end
35
24
 
36
- end
37
- end
25
+ def validate(document, data = {})
26
+ file_errors = get_document(document).errors.select { |e| e.fatal? || e.error? }
27
+ file_errors&.each do |error|
28
+ build_error(error, '/', data[:file_name])
29
+ end
30
+ errors = get_errors(document).root.xpath('//svrl:failed-assert', NAMESPACE).map do |el|
31
+ build_error(el.xpath('svrl:text', NAMESPACE).text, el['location'], data[:file_name])
32
+ end
33
+ errors.uniq { |e| "#{e.location}#{e.message}" }
34
+ end
35
+ end
36
+ end
38
37
  end
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ValidationError
2
- attr_accessor :message, :location, :file_name, :validator
3
-
4
- def initialize(params={})
5
- @location = params[:location]
6
- @message = params[:message]
7
- @validator = params[:validator]
8
- @file_name = params[:file_name]
9
- end
10
- end
4
+ attr_accessor :message, :location, :file_name, :validator
5
+
6
+ def initialize(params = {})
7
+ @location = params[:location]
8
+ @message = params[:message]
9
+ @validator = params[:validator]
10
+ @file_name = params[:file_name]
11
+ end
12
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative 'validation_error'
2
4
  require_relative 'base_validator'
3
5
  require_relative 'schema_validator'
@@ -8,129 +10,61 @@ require_relative 'performance_rate_validator'
8
10
  require_relative 'qrda_qdm_template_validator'
9
11
 
10
12
  module CqmValidators
13
+ CDA_SDTC_SCHEMA = 'lib/schema/infrastructure/cda/CDA_SDTC.xsd'
14
+ QRDA_CAT1_R5_SCHEMATRON = 'lib/schematron/qrda/cat_1_r5/HL7 QRDA Category I STU 5.sch'
15
+ QRDA_CAT1_R51_SCHEMATRON = 'lib/schematron/qrda/cat_1_r5_1/HL7 QRDA Category I STU 5.1.sch'
16
+ QRDA_CAT3_21SCHEMATRON = 'lib/schematron/qrda/cat_3_r2_1/HL7 QRDA Category III STU 2.1.sch'
17
+ BASE_DIR = File.expand_path('..', __dir__)
11
18
 
12
- CDA_SDTC_SCHEMA = 'lib/schema/infrastructure/cda/CDA_SDTC.xsd'
13
- QRDA_CAT1_SCHEMATRON = 'lib/schematron/qrda/cat_1_r2/QRDA Category I Release 2.sch'
14
- QRDA_CAT1_R3_SCHEMATRON = 'lib/schematron/qrda/cat_1/HL7_CDAR2_QRDA_Category_I_2_12_16.sch'
15
- QRDA_CAT1_R3_1_SCHEMATRON = 'lib/schematron/qrda/cat_1_r3_1/HL7 QRDA Category I STU 3.1.sch'
16
- QRDA_CAT1_R4_SCHEMATRON = 'lib/schematron/qrda/cat_1_r4/HL7 QRDA Category I STU 4.sch'
17
- QRDA_CAT1_R5_SCHEMATRON = 'lib/schematron/qrda/cat_1_r5/HL7 QRDA Category I STU 5.sch'
18
- QRDA_CAT3_SCHEMATRON = 'lib/schematron/qrda/cat_3/QRDA Category III.sch'
19
- QRDA_CAT3_1_1SCHEMATRON = 'lib/schematron/qrda/cat_3_r1_1/HL7 QRDA Category III STU 1.1.sch'
20
- QRDA_CAT3_2SCHEMATRON = 'lib/schematron/qrda/cat_3_r2/HL7 QRDA Category III STU 2.sch'
21
- QRDA_CAT3_21SCHEMATRON = 'lib/schematron/qrda/cat_3_r2_1/HL7 QRDA Category III STU 2.1.sch'
22
- BASE_DIR = File.expand_path("../../", __FILE__)
23
-
24
- class Cat1Measure < MeasureValidator
25
- include Singleton
26
-
27
- def initialize()
28
- super("2.16.840.1.113883.10.20.24.3.97")
29
- end
30
-
31
- end
32
-
33
- class Cat3Measure < MeasureValidator
34
- include Singleton
35
-
36
- def initialize()
37
- super("2.16.840.1.113883.10.20.27.3.1")
38
- end
39
-
40
- end
41
-
42
- class CDA < Schema::Validator
43
- include Singleton
44
-
45
- def initialize
46
- super("CDA SDTC Validator", File.join(BASE_DIR, CDA_SDTC_SCHEMA))
47
- end
19
+ class Cat1Measure < MeasureValidator
20
+ include Singleton
48
21
 
22
+ def initialize
23
+ super('2.16.840.1.113883.10.20.24.3.97')
49
24
  end
25
+ end
50
26
 
51
- class Cat1 < Schematron::Validator
52
- include Singleton
53
-
54
- def initialize
55
- super("QRDA Cat 1 R3 Validator", File.join(BASE_DIR, QRDA_CAT1_R3_SCHEMATRON))
56
- end
27
+ class Cat3Measure < MeasureValidator
28
+ include Singleton
57
29
 
30
+ def initialize
31
+ super('2.16.840.1.113883.10.20.27.3.1')
58
32
  end
33
+ end
59
34
 
60
- class Cat1R2 < Schematron::Validator
61
- include Singleton
62
-
63
- def initialize
64
- super("QRDA Cat 1 Validator", File.join(BASE_DIR, QRDA_CAT1_SCHEMATRON))
65
- end
35
+ class CDA < Schema::Validator
36
+ include Singleton
66
37
 
38
+ def initialize
39
+ super('CDA SDTC Validator', File.join(BASE_DIR, CDA_SDTC_SCHEMA))
67
40
  end
41
+ end
68
42
 
69
- class Cat1R31 < Schematron::Validator
70
- include Singleton
71
-
72
- def initialize
73
- super("QRDA Cat 1 Validator", File.join(BASE_DIR, QRDA_CAT1_R3_1_SCHEMATRON))
74
- end
43
+ class Cat1R5 < Schematron::Validator
44
+ include Singleton
75
45
 
46
+ def initialize
47
+ super('QRDA Cat 1 Validator', File.join(BASE_DIR, QRDA_CAT1_R5_SCHEMATRON))
76
48
  end
49
+ end
77
50
 
78
- class Cat1R4 < Schematron::Validator
79
- include Singleton
80
-
81
- def initialize
82
- super("QRDA Cat 1 Validator", File.join(BASE_DIR, QRDA_CAT1_R4_SCHEMATRON))
83
- end
51
+ class Cat1R51 < Schematron::Validator
52
+ include Singleton
84
53
 
54
+ def initialize
55
+ super('QRDA Cat 1 Validator', File.join(BASE_DIR, QRDA_CAT1_R51_SCHEMATRON))
85
56
  end
57
+ end
86
58
 
87
- class Cat1R5 < Schematron::Validator
88
- include Singleton
89
-
90
- def initialize
91
- super("QRDA Cat 1 Validator", File.join(BASE_DIR, QRDA_CAT1_R5_SCHEMATRON))
92
- end
59
+ class Cat3R21 < Schematron::Validator
60
+ include Singleton
93
61
 
62
+ def initialize
63
+ super('QRDA Cat 3 Validator', File.join(BASE_DIR, QRDA_CAT3_21SCHEMATRON))
94
64
  end
65
+ end
95
66
 
96
- class Cat3 < Schematron::Validator
97
- include Singleton
98
-
99
- def initialize
100
- super("QRDA Cat 3 Validator", File.join(BASE_DIR, QRDA_CAT3_SCHEMATRON))
101
- end
102
- end
103
-
104
- class Cat3R11 < Schematron::Validator
105
- include Singleton
106
-
107
- def initialize
108
- super("QRDA Cat 3 Validator", File.join(BASE_DIR, QRDA_CAT3_1_1SCHEMATRON))
109
- end
110
- end
111
-
112
- class Cat3R2 < Schematron::Validator
113
- include Singleton
114
-
115
- def initialize
116
- super("QRDA Cat 3 Validator", File.join(BASE_DIR, QRDA_CAT3_2SCHEMATRON))
117
- end
118
- end
119
-
120
- class Cat3R21 < Schematron::Validator
121
- include Singleton
122
-
123
- def initialize
124
- super("QRDA Cat 3 Validator", File.join(BASE_DIR, QRDA_CAT3_21SCHEMATRON))
125
- end
126
- end
127
-
128
- class Cat3PerformanceRate < PerformanceRateValidator
129
- include Singleton
130
-
131
- #def initialize
132
- # super("Performance Rate Validator", File.join(BASE_DIR, CDA_SDTC_SCHEMA))
133
- #end
134
-
135
- end
67
+ class Cat3PerformanceRate < PerformanceRateValidator
68
+ include Singleton
69
+ end
136
70
  end
@@ -0,0 +1,9 @@
1
+ NOTICE
2
+ ======
3
+ This (software/technical data) was produced for the U. S. Government under Contract Number HHSM-500-2012-00008I, and is subject to Federal Acquisition Regulation Clause 52.227-14, Rights in Data-General.
4
+
5
+ No other use other than that granted to the U. S. Government, or to those acting on behalf of the U. S. Government under that Clause is authorized without the express written permission of The MITRE Corporation.
6
+
7
+ To the extent necessary MITRE hereby grants express written permission to use, reproduce, distribute, modify, and otherwise leverage this software to the extent permitted by the Apache 2.0 license.
8
+
9
+ For further information, please contact The MITRE Corporation, Contracts Management Office, 7515 Colshire Drive, McLean, VA 22102-7539, (703) 983-6000.
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cqm-validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laura
8
8
  - Michael O'Keefe
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2018-07-25 00:00:00.000000000 Z
12
+ date: 2020-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
@@ -17,42 +17,42 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 1.8.2
20
+ version: '1.10'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 1.8.2
27
+ version: '1.10'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '1.16'
34
+ version: '0'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '1.16'
41
+ version: '0'
42
42
  - !ruby/object:Gem::Dependency
43
- name: rake
43
+ name: byebug
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '10.0'
48
+ version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '10.0'
55
+ version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: minitest
58
58
  requirement: !ruby/object:Gem::Requirement
@@ -67,6 +67,76 @@ dependencies:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: '5.0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: minitest-reporters
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - ">="
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: mongoid
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ - !ruby/object:Gem::Dependency
99
+ name: overcommit
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rake
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: 12.3.3
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: 12.3.3
126
+ - !ruby/object:Gem::Dependency
127
+ name: rubocop
128
+ requirement: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '0.93'
133
+ type: :development
134
+ prerelease: false
135
+ version_requirements: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '0.93'
70
140
  description: new cqm validator library
71
141
  email:
72
142
  - laclark@mitre.org
@@ -75,8 +145,12 @@ executables: []
75
145
  extensions: []
76
146
  extra_rdoc_files: []
77
147
  files:
78
- - ".DS_Store"
148
+ - ".github/PULL_REQUEST_TEMPLATE.md"
79
149
  - ".gitignore"
150
+ - ".overcommit.yml"
151
+ - ".rubocop.yml"
152
+ - ".simplecov"
153
+ - ".travis.yml"
80
154
  - Gemfile
81
155
  - LICENSE.txt
82
156
  - QRDA_Schematron_License.txt
@@ -84,6 +158,7 @@ files:
84
158
  - Rakefile
85
159
  - bin/console
86
160
  - bin/setup
161
+ - config/mongoid.yml
87
162
  - cqm_validators.gemspec
88
163
  - lib/base_validator.rb
89
164
  - lib/cqm_validators.rb
@@ -127,34 +202,21 @@ files:
127
202
  - lib/schematron/iso-schematron-xslt2/sch-messages-nl.xhtml
128
203
  - lib/schematron/iso-schematron-xslt2/schematron-skeleton-api.htm
129
204
  - lib/schematron/java_processor.rb
130
- - lib/schematron/qrda/cat_1/HL7_CDAR2_QRDA_Category_I_2_12_16.sch
131
- - lib/schematron/qrda/cat_1/voc.xml
132
- - lib/schematron/qrda/cat_1_r2/QRDA Category I Release 2.sch
133
- - lib/schematron/qrda/cat_1_r2/voc.xml
134
- - lib/schematron/qrda/cat_1_r3_1/HL7 QRDA Category I STU 3.1.sch
135
- - lib/schematron/qrda/cat_1_r3_1/HL7 QRDA Category III STU 1.1.sch
136
- - lib/schematron/qrda/cat_1_r3_1/QRDA Category I STU Release 3.1.sch
137
- - lib/schematron/qrda/cat_1_r3_1/voc.xml
138
- - lib/schematron/qrda/cat_1_r4/HL7 QRDA Category I STU 4.sch
139
- - lib/schematron/qrda/cat_1_r4/voc.xml
140
205
  - lib/schematron/qrda/cat_1_r5/HL7 QRDA Category I STU 5.sch
141
206
  - lib/schematron/qrda/cat_1_r5/voc.xml
142
- - lib/schematron/qrda/cat_3/QRDA Category III.sch
143
- - lib/schematron/qrda/cat_3/voc.xml
144
- - lib/schematron/qrda/cat_3_r1_1/HL7 QRDA Category III STU 1.1.sch
145
- - lib/schematron/qrda/cat_3_r1_1/voc.xml
146
- - lib/schematron/qrda/cat_3_r2/HL7 QRDA Category III STU 2.sch
147
- - lib/schematron/qrda/cat_3_r2/voc.xml
207
+ - lib/schematron/qrda/cat_1_r5_1/HL7 QRDA Category I STU 5.1.sch
208
+ - lib/schematron/qrda/cat_1_r5_1/voc.xml
148
209
  - lib/schematron/qrda/cat_3_r2_1/HL7 QRDA Category III STU 2.1.sch
149
210
  - lib/schematron/qrda/cat_3_r2_1/voc.xml
150
211
  - lib/schematron_validator.rb
151
212
  - lib/validation_error.rb
152
213
  - lib/validators.rb
214
+ - notice.md
153
215
  homepage: https://github.com/projecttacoma/cqm-validators
154
216
  licenses:
155
217
  - Apache-2.0
156
218
  metadata: {}
157
- post_install_message:
219
+ post_install_message:
158
220
  rdoc_options: []
159
221
  require_paths:
160
222
  - lib
@@ -162,16 +224,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
224
  requirements:
163
225
  - - ">="
164
226
  - !ruby/object:Gem::Version
165
- version: '0'
227
+ version: 2.5.0
166
228
  required_rubygems_version: !ruby/object:Gem::Requirement
167
229
  requirements:
168
230
  - - ">="
169
231
  - !ruby/object:Gem::Version
170
232
  version: '0'
171
233
  requirements: []
172
- rubyforge_project:
173
- rubygems_version: 2.6.14
174
- signing_key:
234
+ rubygems_version: 3.1.4
235
+ signing_key:
175
236
  specification_version: 4
176
237
  summary: new cqm validator library
177
238
  test_files: []