cqm-validators 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +7 -0
  3. data/Gemfile +6 -0
  4. data/LICENSE.txt +201 -0
  5. data/QRDA_Schematron_License.txt +191 -0
  6. data/README.md +40 -0
  7. data/Rakefile +10 -0
  8. data/bin/console +14 -0
  9. data/bin/setup +8 -0
  10. data/cqm_validators.gemspec +28 -0
  11. data/lib/base_validator.rb +22 -0
  12. data/lib/cqm_validators.rb +15 -0
  13. data/lib/cqm_validators/version.rb +3 -0
  14. data/lib/data_validator.rb +82 -0
  15. data/lib/measure_validator.rb +130 -0
  16. data/lib/performance_rate_validator.rb +92 -0
  17. data/lib/qrda_qdm_template_validator.rb +320 -0
  18. data/lib/reported_result_extractor.rb +172 -0
  19. data/lib/schema/infrastructure/cda/CDA_SDTC.xsd +44 -0
  20. data/lib/schema/infrastructure/cda/POCD_MT000040_SDTC.xsd +1500 -0
  21. data/lib/schema/infrastructure/cda/SDTC.xsd +210 -0
  22. data/lib/schema/processable/coreschemas/NarrativeBlock.xsd +557 -0
  23. data/lib/schema/processable/coreschemas/datatypes-base_SDTC.xsd +1850 -0
  24. data/lib/schema/processable/coreschemas/datatypes.xsd +1375 -0
  25. data/lib/schema/processable/coreschemas/infrastructureRoot.xsd +27 -0
  26. data/lib/schema/processable/coreschemas/voc.xsd +2124 -0
  27. data/lib/schema_validator.rb +23 -0
  28. data/lib/schematron/c_processor.rb +26 -0
  29. data/lib/schematron/iso-schematron-xslt1/ExtractSchFromRNG.xsl +75 -0
  30. data/lib/schematron/iso-schematron-xslt1/ExtractSchFromXSD.xsl +77 -0
  31. data/lib/schematron/iso-schematron-xslt1/iso_abstract_expand.xsl +297 -0
  32. data/lib/schematron/iso-schematron-xslt1/iso_dsdl_include.xsl +1509 -0
  33. data/lib/schematron/iso-schematron-xslt1/iso_schematron_message.xsl +55 -0
  34. data/lib/schematron/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl +1844 -0
  35. data/lib/schematron/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl +605 -0
  36. data/lib/schematron/iso-schematron-xslt1/readme.txt +101 -0
  37. data/lib/schematron/iso-schematron-xslt1/schematron-skeleton-api.htm +723 -0
  38. data/lib/schematron/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl +75 -0
  39. data/lib/schematron/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl +77 -0
  40. data/lib/schematron/iso-schematron-xslt2/iso_abstract_expand.xsl +297 -0
  41. data/lib/schematron/iso-schematron-xslt2/iso_dsdl_include.xsl +1508 -0
  42. data/lib/schematron/iso-schematron-xslt2/iso_schematron_message_xslt2.xsl +55 -0
  43. data/lib/schematron/iso-schematron-xslt2/iso_schematron_skeleton_for_saxon.xsl +2299 -0
  44. data/lib/schematron/iso-schematron-xslt2/iso_svrl_for_xslt2.xsl +684 -0
  45. data/lib/schematron/iso-schematron-xslt2/readme.txt +100 -0
  46. data/lib/schematron/iso-schematron-xslt2/sch-messages-cs.xhtml +56 -0
  47. data/lib/schematron/iso-schematron-xslt2/sch-messages-de.xhtml +57 -0
  48. data/lib/schematron/iso-schematron-xslt2/sch-messages-en.xhtml +57 -0
  49. data/lib/schematron/iso-schematron-xslt2/sch-messages-fr.xhtml +54 -0
  50. data/lib/schematron/iso-schematron-xslt2/sch-messages-nl.xhtml +58 -0
  51. data/lib/schematron/iso-schematron-xslt2/schematron-skeleton-api.htm +723 -0
  52. data/lib/schematron/java_processor.rb +92 -0
  53. data/lib/schematron/qrda/cat_1/HL7_CDAR2_QRDA_Category_I_2_12_16.sch +4693 -0
  54. data/lib/schematron/qrda/cat_1/voc.xml +1177 -0
  55. data/lib/schematron/qrda/cat_1_r2/QRDA Category I Release 2.sch +4069 -0
  56. data/lib/schematron/qrda/cat_1_r2/voc.xml +1065 -0
  57. data/lib/schematron/qrda/cat_1_r3_1/HL7 QRDA Category I STU 3.1.sch +3573 -0
  58. data/lib/schematron/qrda/cat_1_r3_1/HL7 QRDA Category III STU 1.1.sch +464 -0
  59. data/lib/schematron/qrda/cat_1_r3_1/QRDA Category I STU Release 3.1.sch +5394 -0
  60. data/lib/schematron/qrda/cat_1_r3_1/voc.xml +1229 -0
  61. data/lib/schematron/qrda/cat_1_r4/HL7 QRDA Category I STU 4.sch +3526 -0
  62. data/lib/schematron/qrda/cat_1_r4/voc.xml +1186 -0
  63. data/lib/schematron/qrda/cat_1_r5/HL7 QRDA Category I STU 5.sch +3069 -0
  64. data/lib/schematron/qrda/cat_1_r5/voc.xml +1186 -0
  65. data/lib/schematron/qrda/cat_3/QRDA Category III.sch +675 -0
  66. data/lib/schematron/qrda/cat_3/voc.xml +21 -0
  67. data/lib/schematron/qrda/cat_3_r1_1/HL7 QRDA Category III STU 1.1.sch +528 -0
  68. data/lib/schematron/qrda/cat_3_r1_1/voc.xml +8 -0
  69. data/lib/schematron/qrda/cat_3_r2/HL7 QRDA Category III STU 2.sch +677 -0
  70. data/lib/schematron/qrda/cat_3_r2/voc.xml +1186 -0
  71. data/lib/schematron/qrda/cat_3_r2_1/HL7 QRDA Category III STU 2.1.sch +678 -0
  72. data/lib/schematron/qrda/cat_3_r2_1/voc.xml +1186 -0
  73. data/lib/schematron_validator.rb +38 -0
  74. data/lib/validation_error.rb +10 -0
  75. data/lib/validators.rb +136 -0
  76. metadata +177 -0
@@ -0,0 +1,38 @@
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')
6
+
7
+ class Validator
8
+ include BaseValidator
9
+
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
17
+
18
+ def initialize(name,schematron_file)
19
+ @name = name
20
+ @schematron_file = schematron_file
21
+ end
22
+
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
35
+
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,10 @@
1
+ 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
data/lib/validators.rb ADDED
@@ -0,0 +1,136 @@
1
+ require_relative 'validation_error'
2
+ require_relative 'base_validator'
3
+ require_relative 'schema_validator'
4
+ require_relative 'schematron_validator'
5
+ require_relative 'measure_validator'
6
+ require_relative 'data_validator'
7
+ require_relative 'performance_rate_validator'
8
+ require_relative 'qrda_qdm_template_validator'
9
+
10
+ module CqmValidators
11
+
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
48
+
49
+ end
50
+
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
57
+
58
+ end
59
+
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
66
+
67
+ end
68
+
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
75
+
76
+ end
77
+
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
84
+
85
+ end
86
+
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
93
+
94
+ end
95
+
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
136
+ end
metadata ADDED
@@ -0,0 +1,177 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cqm-validators
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Laura
8
+ - Michael O'Keefe
9
+ autorequire:
10
+ bindir: exe
11
+ cert_chain: []
12
+ date: 2018-07-25 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: 1.8.2
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: 1.8.2
28
+ - !ruby/object:Gem::Dependency
29
+ name: bundler
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.16'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.16'
42
+ - !ruby/object:Gem::Dependency
43
+ name: rake
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '10.0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '10.0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: minitest
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '5.0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '5.0'
70
+ description: new cqm validator library
71
+ email:
72
+ - laclark@mitre.org
73
+ - mokeefe@mitre.org
74
+ executables: []
75
+ extensions: []
76
+ extra_rdoc_files: []
77
+ files:
78
+ - ".DS_Store"
79
+ - ".gitignore"
80
+ - Gemfile
81
+ - LICENSE.txt
82
+ - QRDA_Schematron_License.txt
83
+ - README.md
84
+ - Rakefile
85
+ - bin/console
86
+ - bin/setup
87
+ - cqm_validators.gemspec
88
+ - lib/base_validator.rb
89
+ - lib/cqm_validators.rb
90
+ - lib/cqm_validators/version.rb
91
+ - lib/data_validator.rb
92
+ - lib/measure_validator.rb
93
+ - lib/performance_rate_validator.rb
94
+ - lib/qrda_qdm_template_validator.rb
95
+ - lib/reported_result_extractor.rb
96
+ - lib/schema/infrastructure/cda/CDA_SDTC.xsd
97
+ - lib/schema/infrastructure/cda/POCD_MT000040_SDTC.xsd
98
+ - lib/schema/infrastructure/cda/SDTC.xsd
99
+ - lib/schema/processable/coreschemas/NarrativeBlock.xsd
100
+ - lib/schema/processable/coreschemas/datatypes-base_SDTC.xsd
101
+ - lib/schema/processable/coreschemas/datatypes.xsd
102
+ - lib/schema/processable/coreschemas/infrastructureRoot.xsd
103
+ - lib/schema/processable/coreschemas/voc.xsd
104
+ - lib/schema_validator.rb
105
+ - lib/schematron/c_processor.rb
106
+ - lib/schematron/iso-schematron-xslt1/ExtractSchFromRNG.xsl
107
+ - lib/schematron/iso-schematron-xslt1/ExtractSchFromXSD.xsl
108
+ - lib/schematron/iso-schematron-xslt1/iso_abstract_expand.xsl
109
+ - lib/schematron/iso-schematron-xslt1/iso_dsdl_include.xsl
110
+ - lib/schematron/iso-schematron-xslt1/iso_schematron_message.xsl
111
+ - lib/schematron/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl
112
+ - lib/schematron/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl
113
+ - lib/schematron/iso-schematron-xslt1/readme.txt
114
+ - lib/schematron/iso-schematron-xslt1/schematron-skeleton-api.htm
115
+ - lib/schematron/iso-schematron-xslt2/ExtractSchFromRNG-2.xsl
116
+ - lib/schematron/iso-schematron-xslt2/ExtractSchFromXSD-2.xsl
117
+ - lib/schematron/iso-schematron-xslt2/iso_abstract_expand.xsl
118
+ - lib/schematron/iso-schematron-xslt2/iso_dsdl_include.xsl
119
+ - lib/schematron/iso-schematron-xslt2/iso_schematron_message_xslt2.xsl
120
+ - lib/schematron/iso-schematron-xslt2/iso_schematron_skeleton_for_saxon.xsl
121
+ - lib/schematron/iso-schematron-xslt2/iso_svrl_for_xslt2.xsl
122
+ - lib/schematron/iso-schematron-xslt2/readme.txt
123
+ - lib/schematron/iso-schematron-xslt2/sch-messages-cs.xhtml
124
+ - lib/schematron/iso-schematron-xslt2/sch-messages-de.xhtml
125
+ - lib/schematron/iso-schematron-xslt2/sch-messages-en.xhtml
126
+ - lib/schematron/iso-schematron-xslt2/sch-messages-fr.xhtml
127
+ - lib/schematron/iso-schematron-xslt2/sch-messages-nl.xhtml
128
+ - lib/schematron/iso-schematron-xslt2/schematron-skeleton-api.htm
129
+ - 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
+ - lib/schematron/qrda/cat_1_r5/HL7 QRDA Category I STU 5.sch
141
+ - 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
148
+ - lib/schematron/qrda/cat_3_r2_1/HL7 QRDA Category III STU 2.1.sch
149
+ - lib/schematron/qrda/cat_3_r2_1/voc.xml
150
+ - lib/schematron_validator.rb
151
+ - lib/validation_error.rb
152
+ - lib/validators.rb
153
+ homepage: https://github.com/projecttacoma/cqm-validators
154
+ licenses:
155
+ - Apache-2.0
156
+ metadata: {}
157
+ post_install_message:
158
+ rdoc_options: []
159
+ require_paths:
160
+ - lib
161
+ required_ruby_version: !ruby/object:Gem::Requirement
162
+ requirements:
163
+ - - ">="
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ required_rubygems_version: !ruby/object:Gem::Requirement
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ version: '0'
171
+ requirements: []
172
+ rubyforge_project:
173
+ rubygems_version: 2.6.14
174
+ signing_key:
175
+ specification_version: 4
176
+ summary: new cqm validator library
177
+ test_files: []