cqm-parsers 2.0.1 → 3.0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e27468bb2847e360061429ac4b69e4b70bc9313
4
- data.tar.gz: 18055a1d7aaebcaeee25ae76ad02b7a0bbdc4022
3
+ metadata.gz: 9946e3dc5e1e74875ed24bb690332fc260f0b103
4
+ data.tar.gz: aa9298b5a7e4790a0534210a1278ec3b78ad387c
5
5
  SHA512:
6
- metadata.gz: afb7fbfe2ed876162ee398b8a292d866aee7772bbcf76ca4397171dd0d649d57bf124dcf239c09b6b51af5cec16b412d328e95973260d2226507ff2af6fe810c
7
- data.tar.gz: 80f210644ba381e9b107563f97bad75abbeecc687875ef0028b275d0e80de94afd2f8f9cccb5f2e1f348c68680f5bb891c12c009897704e472be1d12c167e884
6
+ metadata.gz: c9c64d13dc66b78ea4c8066ec1229d0503b217b2a10e440b6bb6f77911b3145049e3933bc8d5674928efb20e0d333e0830bfe2be304e6a7a46b808494e44fbf4
7
+ data.tar.gz: 578f9b9d566c4c67804fb33635c3dfaccfe9e09cd2fa5978fe4af57cde7b1955bf8f62b84de7a9f859bd57fc3026eee14dca1757d7655163d6de29c2692dd6a8
data/Gemfile CHANGED
@@ -2,9 +2,9 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec :development_group => :test
4
4
 
5
- gem 'mongoid', '~> 6.4.2'
5
+ gem 'mongoid', '~> 5.0.0'
6
6
 
7
- gem 'cqm-models', '~> 2.0.0'
7
+ # gem 'cqm-models', '~> 3.0.0'
8
8
  # gem 'cqm-models', git: 'https://github.com/projecttacoma/cqm-models.git', branch: 'master'
9
9
  # gem 'cqm-models', :path => '../cqm-models'
10
10
 
File without changes
@@ -74,7 +74,7 @@ module HQMF2
74
74
  fail 'Measure Observations criteria is missing computed expression(s) ' if exp.nil?
75
75
  parts = exp.to_s.split('-')
76
76
  dc = parse_parts_to_dc(parts)
77
- @doc.add_data_criteria(dc)
77
+ @doc.add_data_criteria(dc) unless dc.nil?
78
78
  # Update reference_ids with any newly referenced data criteria
79
79
  dc.children_criteria.each { |cc| @doc.add_reference_id(cc) } unless dc&.children_criteria.nil?
80
80
  dc
@@ -11,7 +11,7 @@ module HQMF2CQL
11
11
  end
12
12
 
13
13
  # Extracts potential measure observations from the CQL based HQMF.
14
- # This function needs to return a boolean so that it will continue to work with
14
+ # This function needs to return a boolean so that it will continue to work with
15
15
  # HQMF2::DocumentPopulationHelper::extract_populations_and_criteria
16
16
  # This function is being overridden because in CQL the observations are no longer data criteria in the HQMF.
17
17
  def extract_observations
@@ -22,10 +22,10 @@ module HQMF2CQL
22
22
  observation_section = @doc.xpath('/cda:QualityMeasureDocument/cda:component/cda:measureObservationSection',
23
23
  HQMF2::Document::NAMESPACES)
24
24
  unless observation_section.empty?
25
- observation_section.each do |entry|
25
+ observation_section.xpath('cda:definition').each do |obs_def|
26
26
  # Need to add population criteria for observations
27
27
  criteria_id = 'OBSERV'
28
- criteria = HQMF2::PopulationCriteria.new(entry.xpath('cda:definition'), @document, @id_generator)
28
+ criteria = HQMF2::PopulationCriteria.new(obs_def, @document, @id_generator)
29
29
  criteria.type = 'OBSERV'
30
30
  if @ids_by_hqmf_id["#{criteria.hqmf_id}"]
31
31
  criteria.create_human_readable_id(@ids_by_hqmf_id[criteria.hqmf_id])
@@ -39,16 +39,16 @@ module HQMF2CQL
39
39
  cql_define_function = {}
40
40
  # The at_xpath(...).values returns an array of a single element.
41
41
  # The match returns an array and since we don't want the double quotes we take the second element
42
- cql_define_function[:function_name] = entry.at_xpath("*/cda:measureObservationDefinition/cda:value/cda:expression").values.first.match('\\"([A-Za-z0-9 ]+)\\"')[1]
43
- cql_define_function[:function_aggregation_type] = entry.at_xpath("*/cda:measureObservationDefinition/cda:methodCode/cda:item").attributes['code'].value
44
- cql_define_function[:function_hqmf_oid] = entry.at_xpath("*/cda:measureObservationDefinition/cda:id").attributes['root'].value
42
+ cql_define_function[:function_name] = obs_def.at_xpath("cda:measureObservationDefinition/cda:value/cda:expression").values.first.match('\\"([A-Za-z0-9 ]+)\\"')[1]
43
+ cql_define_function[:function_aggregation_type] = obs_def.at_xpath("cda:measureObservationDefinition/cda:methodCode/cda:item").attributes['code'].value
44
+ cql_define_function[:function_hqmf_oid] = obs_def.at_xpath("cda:measureObservationDefinition/cda:id").attributes['root'].value
45
45
  # The criteria_reference_id is the id of the measurePopulationCriteria that should be used for this observation function
46
- measure_population_id = entry.at_xpath("*/cda:measureObservationDefinition/cda:component/cda:criteriaReference/cda:id").attributes['root'].value
46
+ measure_population_id = obs_def.at_xpath("cda:measureObservationDefinition/cda:component/cda:criteriaReference/cda:id").attributes['root'].value
47
47
  # Get the name of the parameter to the observation function within the measurePopulationCriteria section
48
48
 
49
- measure_population_name = entry.at_xpath("*/cda:measureObservationDefinition/cda:component/cda:criteriaReference/cda:id").attributes['extension'].value
50
- # Get the name of the parameter to the observation function within the relevant population criteria section
51
- cql_define_function[:parameter] = @doc.at_xpath("cda:QualityMeasureDocument/cda:component/cda:populationCriteriaSection/cda:component/cda:#{measure_population_name}Criteria/cda:id[@root = \"#{measure_population_id}\"]/../cda:precondition/cda:criteriaReference/cda:id").attributes['extension'].value.match('\\"([A-Za-z0-9 ]+)\\"')[1]
49
+ measure_population_name = obs_def.at_xpath("cda:measureObservationDefinition/cda:component/cda:criteriaReference/cda:id").attributes['extension'].value
50
+ criteria_reference_id = @doc.at_xpath("cda:QualityMeasureDocument/cda:component/cda:populationCriteriaSection/cda:component/cda:#{measure_population_name}Criteria/cda:id[@root = \"#{measure_population_id}\"]/../cda:precondition/cda:criteriaReference/cda:id")
51
+ cql_define_function[:parameter] = criteria_reference_id.attributes['extension'].value.match('\\"([A-Za-z0-9 ]+)\\"')[1]
52
52
 
53
53
  @observations << cql_define_function
54
54
  end
@@ -53,7 +53,7 @@ module Measures
53
53
 
54
54
  def unzip_measure_zip_into_hash(zip_file)
55
55
  folders = Hash.new { |h, k| h[k] = {files: []} }
56
- Zip::File.open zip_file do |file|
56
+ Zip::File.open zip_file.path do |file|
57
57
  file.each do |f|
58
58
  pn = Pathname(f.name)
59
59
  next if '__MACOSX'.in? pn.each_filename # ignore anything in a __MACOSX folder
@@ -26,7 +26,9 @@ module Measures
26
26
  extract_fields_from_single_code_reference_data_criteria(criteria)
27
27
  end
28
28
  hqmf_template_oid = criteria.at_css('templateId/item')['root']
29
- model = QDM::ModelFinder.by_hqmf_oid(hqmf_template_oid).new(model_fields)
29
+ model = QDM::ModelFinder.by_hqmf_oid(hqmf_template_oid)
30
+ raise "No datatype found for oid #{hqmf_template_oid}. Verify the QDM version of the measure package is correct." if model.nil?
31
+ model = model.new(model_fields)
30
32
  model.description = model.qdmTitle + ': ' + model.description
31
33
  return model
32
34
  end
@@ -42,9 +44,9 @@ module Measures
42
44
  end
43
45
 
44
46
  def extract_fields_from_single_code_reference_data_criteria(criteria)
45
- single_code_reference = criteria.css('value[codeSystem][code]').last || criteria.css('code[codeSystem][code]').last
47
+ single_code_reference = criteria.at_css('value[codeSystem][code]') || criteria.at_css('code[codeSystem][code]')
46
48
  system_id = "#{single_code_reference['codeSystem']}_#{single_code_reference['codeSystemVersion']}".to_sym
47
- concept = @single_code_concepts[system_id][single_code_reference['code'].to_sym]
49
+ concept = @single_code_concepts[system_id][single_code_reference['code'].to_sym] || get_concept_from_participation(criteria.at_css('participation'))
48
50
  value_set = concept._parent
49
51
  return {
50
52
  description: concept.display_name,
@@ -52,6 +54,14 @@ module Measures
52
54
  }
53
55
  end
54
56
 
57
+ # If QDM datatype template in MAT has includeSubTemplate, code gets nested into participation
58
+ # this method gets the codes from participation and form the code concept
59
+ def get_concept_from_participation(participation)
60
+ code_element = participation.at_css('code')
61
+ system_id = "#{code_element['codeSystem']}_#{code_element['codeSystemVersion']}".to_sym
62
+ @single_code_concepts[system_id][code_element['code'].to_sym]
63
+ end
64
+
55
65
  def map_single_code_concepts(value_sets_from_single_code_references)
56
66
  single_code_concepts = {}
57
67
  value_sets_from_single_code_references.flat_map(&:concepts).each do |concept|
@@ -1,7 +1,7 @@
1
1
  require 'pathname'
2
2
  require 'fileutils'
3
3
  require 'json'
4
- require 'hqmf-parser'
4
+ require 'cqm-parsers'
5
5
 
6
6
  namespace :hqmf do
7
7
 
@@ -138,7 +138,7 @@ module Util
138
138
  # Gets the details for a program. This may be used without credentials.
139
139
  #
140
140
  # Optional parameter program is the program to request from the API. If it is not provided it will look for
141
- # a :program in the config passed in during construction. If there is no :program in the config it will use
141
+ # a :program in the config passed in during construction. If there is no :program in the config it will use
142
142
  # the DEFAULT_PROGRAM constant for the program.
143
143
  #
144
144
  # Returns the JSON parsed response for program details.
@@ -159,7 +159,7 @@ module Util
159
159
  # }
160
160
  #
161
161
  # Optional parameter program is the program to request from the API. If it is not provided it will look for
162
- # a :program in the config passed in during construction. If there is no :program in the config it will use
162
+ # a :program in the config passed in during construction. If there is no :program in the config it will use
163
163
  # the DEFAULT_PROGRAM constant for the program.
164
164
  #
165
165
  # Returns the name of the latest profile for the given program.
@@ -242,8 +242,8 @@ module Util
242
242
  def get_multiple_valueset_raw_responses(needed_value_sets)
243
243
  service_tickets = get_service_tickets(needed_value_sets.size)
244
244
 
245
- hydra = Typhoeus::Hydra.new # Hydra executes multiple HTTP requests at once
246
- requests = needed_value_sets.map do |n|
245
+ hydra = Typhoeus::Hydra.new(max_concurrency: 1) # Hydra executes multiple HTTP requests at once
246
+ requests = needed_value_sets.map do |n|
247
247
  request = create_valueset_request(n[:value_set][:oid], service_tickets.pop, n[:vs_vsac_options])
248
248
  hydra.queue(request)
249
249
  request
@@ -258,7 +258,7 @@ module Util
258
258
  def get_service_tickets(amount)
259
259
  raise VSACNoCredentialsError.new unless @ticket_granting_ticket
260
260
  raise VSACTicketExpiredError.new if Time.now > @ticket_granting_ticket[:expires]
261
-
261
+
262
262
  hydra = Typhoeus::Hydra.new # Hydra executes multiple HTTP requests at once
263
263
  requests = amount.times.map do
264
264
  request = create_service_ticket_request
@@ -299,7 +299,7 @@ module Util
299
299
 
300
300
  # Create a typheous request for a service ticket (this must be executed later)
301
301
  def create_service_ticket_request
302
- return Typhoeus::Request.new("#{@config[:auth_url]}/Ticket/#{@ticket_granting_ticket[:ticket]}",
302
+ return Typhoeus::Request.new("#{@config[:auth_url]}/Ticket/#{@ticket_granting_ticket[:ticket]}",
303
303
  method: :post,
304
304
  params: { service: TICKET_SERVICE_PARAM})
305
305
  end
@@ -307,7 +307,7 @@ module Util
307
307
  # Use your username and password to retrive a ticket granting ticket from VSAC
308
308
  def get_ticket_granting_ticket(username, password)
309
309
  response = Typhoeus.post(
310
- "#{@config[:auth_url]}/Ticket",
310
+ "#{@config[:auth_url]}/Ticket",
311
311
  # looks like typheous sometimes switches the order of username/password when encoding
312
312
  # which vsac cant handle (!?), so encode first
313
313
  body: URI.encode_www_form(username: username, password: password)
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cqm-parsers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 3.0.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MITRE Corporation
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-01 00:00:00.000000000 Z
11
+ date: 2020-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cqm-models
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 3.0.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 3.0.0
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: mustache
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -30,84 +44,84 @@ dependencies:
30
44
  requirements:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
- version: '2.7'
47
+ version: 2.7.0
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - "~>"
39
53
  - !ruby/object:Gem::Version
40
- version: '2.7'
54
+ version: 2.7.0
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: mongoid
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - "~>"
46
60
  - !ruby/object:Gem::Version
47
- version: '6.4'
61
+ version: 5.0.0
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - "~>"
53
67
  - !ruby/object:Gem::Version
54
- version: '6.4'
68
+ version: 5.0.0
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: mongoid-tree
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '2.1'
75
+ version: 2.0.0
62
76
  type: :runtime
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '2.1'
82
+ version: 2.0.0
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: activesupport
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
87
  - - "~>"
74
88
  - !ruby/object:Gem::Version
75
- version: '5.0'
89
+ version: 4.2.0
76
90
  type: :runtime
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
94
  - - "~>"
81
95
  - !ruby/object:Gem::Version
82
- version: '5.0'
96
+ version: 4.2.0
83
97
  - !ruby/object:Gem::Dependency
84
- name: protected_attributes_continued
98
+ name: protected_attributes
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
101
  - - "~>"
88
102
  - !ruby/object:Gem::Version
89
- version: '1.4'
103
+ version: 1.0.5
90
104
  type: :runtime
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
108
  - - "~>"
95
109
  - !ruby/object:Gem::Version
96
- version: '1.4'
110
+ version: 1.0.5
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: uuid
99
113
  requirement: !ruby/object:Gem::Requirement
100
114
  requirements:
101
115
  - - "~>"
102
116
  - !ruby/object:Gem::Version
103
- version: '2.3'
117
+ version: 2.3.7
104
118
  type: :runtime
105
119
  prerelease: false
106
120
  version_requirements: !ruby/object:Gem::Requirement
107
121
  requirements:
108
122
  - - "~>"
109
123
  - !ruby/object:Gem::Version
110
- version: '2.3'
124
+ version: 2.3.7
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: builder
113
127
  requirement: !ruby/object:Gem::Requirement
@@ -126,58 +140,64 @@ dependencies:
126
140
  name: nokogiri
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - "~>"
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: 1.8.5
146
+ - - "<"
130
147
  - !ruby/object:Gem::Version
131
- version: '1.10'
148
+ version: 1.11.0
132
149
  type: :runtime
133
150
  prerelease: false
134
151
  version_requirements: !ruby/object:Gem::Requirement
135
152
  requirements:
136
- - - "~>"
153
+ - - ">="
137
154
  - !ruby/object:Gem::Version
138
- version: '1.10'
155
+ version: 1.8.5
156
+ - - "<"
157
+ - !ruby/object:Gem::Version
158
+ version: 1.11.0
139
159
  - !ruby/object:Gem::Dependency
140
160
  name: highline
141
161
  requirement: !ruby/object:Gem::Requirement
142
162
  requirements:
143
163
  - - "~>"
144
164
  - !ruby/object:Gem::Version
145
- version: '1.7'
165
+ version: 1.7.0
146
166
  type: :runtime
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
149
169
  requirements:
150
170
  - - "~>"
151
171
  - !ruby/object:Gem::Version
152
- version: '1.7'
172
+ version: 1.7.0
153
173
  - !ruby/object:Gem::Dependency
154
174
  name: rubyzip
155
175
  requirement: !ruby/object:Gem::Requirement
156
176
  requirements:
157
177
  - - "~>"
158
178
  - !ruby/object:Gem::Version
159
- version: '1.2'
179
+ version: '1.3'
160
180
  type: :runtime
161
181
  prerelease: false
162
182
  version_requirements: !ruby/object:Gem::Requirement
163
183
  requirements:
164
184
  - - "~>"
165
185
  - !ruby/object:Gem::Version
166
- version: '1.2'
186
+ version: '1.3'
167
187
  - !ruby/object:Gem::Dependency
168
188
  name: typhoeus
169
189
  requirement: !ruby/object:Gem::Requirement
170
190
  requirements:
171
- - - "~>"
191
+ - - ">="
172
192
  - !ruby/object:Gem::Version
173
- version: '1.3'
193
+ version: '0'
174
194
  type: :runtime
175
195
  prerelease: false
176
196
  version_requirements: !ruby/object:Gem::Requirement
177
197
  requirements:
178
- - - "~>"
198
+ - - ">="
179
199
  - !ruby/object:Gem::Version
180
- version: '1.3'
200
+ version: '0'
181
201
  - !ruby/object:Gem::Dependency
182
202
  name: zip-zip
183
203
  requirement: !ruby/object:Gem::Requirement
@@ -198,28 +218,28 @@ dependencies:
198
218
  requirements:
199
219
  - - "~>"
200
220
  - !ruby/object:Gem::Version
201
- version: '1.1'
221
+ version: 1.1.10
202
222
  type: :runtime
203
223
  prerelease: false
204
224
  version_requirements: !ruby/object:Gem::Requirement
205
225
  requirements:
206
226
  - - "~>"
207
227
  - !ruby/object:Gem::Version
208
- version: '1.1'
228
+ version: 1.1.10
209
229
  - !ruby/object:Gem::Dependency
210
230
  name: memoist
211
231
  requirement: !ruby/object:Gem::Requirement
212
232
  requirements:
213
233
  - - "~>"
214
234
  - !ruby/object:Gem::Version
215
- version: '0.9'
235
+ version: 0.9.1
216
236
  type: :runtime
217
237
  prerelease: false
218
238
  version_requirements: !ruby/object:Gem::Requirement
219
239
  requirements:
220
240
  - - "~>"
221
241
  - !ruby/object:Gem::Version
222
- version: '0.9'
242
+ version: 0.9.1
223
243
  description: A library for parsing HQMF documents.
224
244
  email: tacoma-list@lists.mitre.org
225
245
  executables: []
@@ -229,6 +249,7 @@ files:
229
249
  - Gemfile
230
250
  - README.md
231
251
  - Rakefile
252
+ - lib/cqm-parsers.rb
232
253
  - lib/ext/data_element.rb
233
254
  - lib/hqmf-model/attribute.rb
234
255
  - lib/hqmf-model/data_criteria.json
@@ -238,7 +259,6 @@ files:
238
259
  - lib/hqmf-model/precondition.rb
239
260
  - lib/hqmf-model/types.rb
240
261
  - lib/hqmf-model/utilities.rb
241
- - lib/hqmf-parser.rb
242
262
  - lib/hqmf-parser/1.0/attribute.rb
243
263
  - lib/hqmf-parser/1.0/comparison.rb
244
264
  - lib/hqmf-parser/1.0/data_criteria.rb