bonnie_bundler 2.2.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +5 -5
  2. data/.github/gitleaks.toml +268 -0
  3. data/.github/workflows/main.yml +31 -0
  4. data/.travis.yml +2 -2
  5. data/Gemfile.lock +74 -75
  6. data/LICENSE.txt +201 -0
  7. data/README.md +12 -0
  8. data/bonnie-bundler.gemspec +4 -4
  9. data/lib/bonnie_bundler.rb +0 -1
  10. data/lib/measures/elm_parser.rb +7 -1
  11. data/lib/measures/loading/cql_loader.rb +234 -100
  12. data/lib/measures/loading/exceptions.rb +4 -4
  13. data/lib/measures/loading/loader.rb +18 -24
  14. data/lib/models/cql_measure.rb +25 -0
  15. data/lib/util/vsac_api.rb +13 -13
  16. data/notice.md +9 -0
  17. data/test/fixtures/CMSAWA_v5_6_Artifacts.zip +0 -0
  18. data/test/fixtures/CMSAWA_v5_6_Artifacts_missing_component.zip +0 -0
  19. data/test/fixtures/CMSAWA_v5_6_Artifacts_missing_composite_files.zip +0 -0
  20. data/test/fixtures/CMSAWA_v5_6_Artifacts_missing_file.zip +0 -0
  21. data/test/fixtures/TOB2_v5_5_Artifacts.zip +0 -0
  22. data/test/fixtures/not_mat_export.zip +0 -0
  23. data/test/fixtures/vcr_cassettes/load_composite_measure.yml +7305 -0
  24. data/test/fixtures/vcr_cassettes/load_composite_measure_with_missing_component.yml +6923 -0
  25. data/test/fixtures/vcr_cassettes/load_composite_measure_with_missing_composite_files.yml +57 -0
  26. data/test/fixtures/vcr_cassettes/load_composite_measure_with_missing_file.yml +5938 -0
  27. data/test/fixtures/vcr_cassettes/multi_library_webcalls.yml +156 -167
  28. data/test/fixtures/vcr_cassettes/valid_vsac_response.yml +216 -191
  29. data/test/fixtures/vcr_cassettes/valid_vsac_response_158.yml +112 -116
  30. data/test/fixtures/vcr_cassettes/valid_vsac_response_158_update.yml +121 -125
  31. data/test/fixtures/vcr_cassettes/valid_vsac_response_hospice.yml +523 -447
  32. data/test/fixtures/vcr_cassettes/valid_vsac_response_includes_draft.yml +388 -356
  33. data/test/fixtures/vcr_cassettes/valid_vsac_response_pvc_unused_libraries.yml +969 -2079
  34. data/test/fixtures/vcr_cassettes/valid_vsac_response_special_characters.yml +5408 -0
  35. data/test/fixtures/vcr_cassettes/vs_loading_500_response.yml +26 -510
  36. data/test/fixtures/vcr_cassettes/vs_loading_empty_concept_list.yml +26 -26
  37. data/test/fixtures/vcr_cassettes/vs_loading_release.yml +106 -106
  38. data/test/fixtures/vcr_cassettes/vs_loading_version.yml +106 -106
  39. data/test/test_helper.rb +1 -1
  40. data/test/unit/composite_cql_loader_test.rb +102 -0
  41. data/test/unit/cql_loader_test.rb +38 -6
  42. data/test/unit/get_value_sets_from_measure_model_test.rb +34 -0
  43. data/test/unit/load_mat_export_test.rb +15 -9
  44. data/test/unit/measure_complexity_test.rb +1 -1
  45. data/test/unit/measure_diff_test.rb +4 -4
  46. data/test/unit/storing_mat_export_package_test.rb +1 -2
  47. data/test/unit/value_set_loading_test.rb +16 -16
  48. data/test/unit/vsac_api_auth_test.rb +7 -31
  49. data/test/unit/vsac_api_test.rb +6 -6
  50. data/test/vcr_setup.rb +4 -6
  51. metadata +35 -14
  52. data/lib/measures/loading/base_loader_definition.rb +0 -61
@@ -4,10 +4,10 @@ require 'vcr_setup.rb'
4
4
  # Tests that ensure VSAC authentication related situations are handled
5
5
  class VSACAPIAuthTest < ActiveSupport::TestCase
6
6
 
7
- test 'valid username and password provided' do
7
+ test 'valid api_key provided' do
8
8
  VCR.use_cassette("vsac_auth_good_credentials") do
9
9
  assert_nothing_raised do
10
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: ENV['VSAC_USERNAME'], password: ENV['VSAC_PASSWORD'])
10
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: ENV['VSAC_API_KEY'])
11
11
  assert_not_nil api.ticket_granting_ticket
12
12
  assert_not_nil api.ticket_granting_ticket[:ticket]
13
13
  assert_not_nil api.ticket_granting_ticket[:expires]
@@ -15,42 +15,18 @@ class VSACAPIAuthTest < ActiveSupport::TestCase
15
15
  end
16
16
  end
17
17
 
18
- test 'invalid username and password provided' do
18
+ test 'invalid api_key provided' do
19
19
  VCR.use_cassette("vsac_auth_bad_credentials") do
20
20
  assert_raise Util::VSAC::VSACInvalidCredentialsError do
21
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: 'baduser', password: 'badpass')
21
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: 'badapikey')
22
22
  end
23
23
  end
24
24
  end
25
25
 
26
- test 'empty username and password provided' do
26
+ test 'empty api_key provided' do
27
27
  api = nil
28
28
  assert_nothing_raised do
29
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: nil, password: nil)
30
- end
31
-
32
- # now attempt to get a valueset
33
- assert_raise Util::VSAC::VSACNoCredentialsError do
34
- api.get_valueset('2.16.840.1.113762.1.4.1')
35
- end
36
- end
37
-
38
- test 'provided username but no password' do
39
- api = nil
40
- assert_nothing_raised do
41
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: "vsacuser")
42
- end
43
-
44
- # now attempt to get a valueset
45
- assert_raise Util::VSAC::VSACNoCredentialsError do
46
- api.get_valueset('2.16.840.1.113762.1.4.1')
47
- end
48
- end
49
-
50
- test 'provided password but no username' do
51
- api = nil
52
- assert_nothing_raised do
53
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: "vsacuser")
29
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: nil)
54
30
  end
55
31
 
56
32
  # now attempt to get a valueset
@@ -62,7 +38,7 @@ class VSACAPIAuthTest < ActiveSupport::TestCase
62
38
  test 'valid ticket_granting_ticket provided and used' do
63
39
  VCR.use_cassette("vsac_auth_good_credentials_and_simple_call") do
64
40
  # first get a ticket_granting_ticket
65
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: ENV['VSAC_USERNAME'], password: ENV['VSAC_PASSWORD'])
41
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: ENV['VSAC_API_KEY'])
66
42
  assert_not_nil api.ticket_granting_ticket
67
43
 
68
44
  reused_ticket_granting_ticket = {
@@ -18,7 +18,7 @@ class VSACApiTest < ActiveSupport::TestCase
18
18
 
19
19
  test 'get_valueset with version' do
20
20
  VCR.use_cassette("vsac_vs_version") do
21
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: ENV['VSAC_USERNAME'], password: ENV['VSAC_PASSWORD'])
21
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: ENV['VSAC_API_KEY'])
22
22
  vs = api.get_valueset("2.16.840.1.113883.3.600.1.1834", version: "MU2 EP Update 2014-07-01")
23
23
  assert_not_nil vs
24
24
  doc = Nokogiri::XML(vs)
@@ -28,7 +28,7 @@ class VSACApiTest < ActiveSupport::TestCase
28
28
 
29
29
  test 'get_valuest with include_draft no profile' do
30
30
  VCR.use_cassette("vsac_vs_include_draft_no_profile") do
31
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: ENV['VSAC_USERNAME'], password: ENV['VSAC_PASSWORD'])
31
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: ENV['VSAC_API_KEY'])
32
32
  assert_raise Util::VSAC::VSACArgumentError do
33
33
  api.get_valueset("2.16.840.1.113883.3.600.1.1834", include_draft: true)
34
34
  end
@@ -37,7 +37,7 @@ class VSACApiTest < ActiveSupport::TestCase
37
37
 
38
38
  test 'get_valueset with include_draft specified profile' do
39
39
  VCR.use_cassette("vsac_vs_include_draft_with_profile") do
40
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: ENV['VSAC_USERNAME'], password: ENV['VSAC_PASSWORD'])
40
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: ENV['VSAC_API_KEY'])
41
41
  vs = api.get_valueset("2.16.840.1.113762.1.4.1", include_draft: true, profile: "eCQM Update 2018-05-04")
42
42
  assert_not_nil vs
43
43
  doc = Nokogiri::XML(vs)
@@ -47,7 +47,7 @@ class VSACApiTest < ActiveSupport::TestCase
47
47
 
48
48
  test 'get_valueset no options' do
49
49
  VCR.use_cassette("vsac_vs_no_options") do
50
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: ENV['VSAC_USERNAME'], password: ENV['VSAC_PASSWORD'])
50
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: ENV['VSAC_API_KEY'])
51
51
  vs = api.get_valueset("2.16.840.1.113762.1.4.1")
52
52
  assert_not_nil vs
53
53
  doc = Nokogiri::XML(vs)
@@ -57,7 +57,7 @@ class VSACApiTest < ActiveSupport::TestCase
57
57
 
58
58
  test 'get_valueset not found' do
59
59
  VCR.use_cassette("vsac_vs_not_found") do
60
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: ENV['VSAC_USERNAME'], password: ENV['VSAC_PASSWORD'])
60
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: ENV['VSAC_API_KEY'])
61
61
  assert_raise Util::VSAC::VSNotFoundError do
62
62
  api.get_valueset("bad.oid")
63
63
  end
@@ -66,7 +66,7 @@ class VSACApiTest < ActiveSupport::TestCase
66
66
 
67
67
  test 'get_valueset with release' do
68
68
  VCR.use_cassette("vsac_vs_release") do
69
- api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], username: ENV['VSAC_USERNAME'], password: ENV['VSAC_PASSWORD'])
69
+ api = Util::VSAC::VSACAPI.new(config: APP_CONFIG['vsac'], api_key: ENV['VSAC_API_KEY'])
70
70
  vs = api.get_valueset("2.16.840.1.113762.1.4.1", release: "MU2 EP Update 2014-05-30")
71
71
  assert_not_nil vs
72
72
  doc = Nokogiri::XML(vs)
@@ -5,16 +5,14 @@ VCR.configure do |c|
5
5
  # This is where the various cassettes will be recorded to
6
6
  c.cassette_library_dir = 'test/fixtures/vcr_cassettes'
7
7
  c.hook_into :webmock
8
-
8
+
9
9
  # To avoid storing plain text VSAC credentials or requiring the VSAC credentials
10
- # be provided at every run of the rake tests, provide the VSAC_USERNAME and VSAC_PASSWORD
10
+ # be provided at every run of the rake tests, provide the VSAC_API_KEY
11
11
  # whenever you need to record a cassette that requires valid credentials
12
- ENV['VSAC_USERNAME'] = "vcrtest" unless ENV['VSAC_USERNAME']
13
- ENV['VSAC_PASSWORD'] = "vcrpass" unless ENV['VSAC_PASSWORD']
12
+ ENV['VSAC_API_KEY'] = "vcrpass" unless ENV['VSAC_API_KEY']
14
13
 
15
14
  # Ensure plain text passwords do not show up during logging
16
- c.filter_sensitive_data('<VSAC_USERNAME>') {ENV['VSAC_USERNAME']}
17
- c.filter_sensitive_data('<VSAC_PASSWORD>') {ENV['VSAC_PASSWORD']}
15
+ c.filter_sensitive_data('<VSAC_API_KEY>') {URI.escape(ENV['VSAC_API_KEY'])}
18
16
  c.default_cassette_options = {record: :once }
19
17
 
20
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bonnie_bundler
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - The MITRE Corporation
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-13 00:00:00.000000000 Z
11
+ date: 2020-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: health-data-standards
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '4.0'
19
+ version: 4.3.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '4.0'
26
+ version: 4.3.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: quality-measure-engine
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +84,22 @@ dependencies:
84
84
  name: rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '4.2'
90
+ - - "<"
91
+ - !ruby/object:Gem::Version
92
+ version: '6.0'
90
93
  type: :runtime
91
94
  prerelease: false
92
95
  version_requirements: !ruby/object:Gem::Requirement
93
96
  requirements:
94
- - - "~>"
97
+ - - ">="
95
98
  - !ruby/object:Gem::Version
96
99
  version: '4.2'
100
+ - - "<"
101
+ - !ruby/object:Gem::Version
102
+ version: '6.0'
97
103
  - !ruby/object:Gem::Dependency
98
104
  name: mongoid
99
105
  requirement: !ruby/object:Gem::Requirement
@@ -162,14 +168,14 @@ dependencies:
162
168
  requirements:
163
169
  - - "~>"
164
170
  - !ruby/object:Gem::Version
165
- version: '1.13'
171
+ version: '2.7'
166
172
  type: :runtime
167
173
  prerelease: false
168
174
  version_requirements: !ruby/object:Gem::Requirement
169
175
  requirements:
170
176
  - - "~>"
171
177
  - !ruby/object:Gem::Version
172
- version: '1.13'
178
+ version: '2.7'
173
179
  description: A Gem for creating and managing bonnie bundles
174
180
  email: pophealth-talk@googlegroups.com
175
181
  executables: []
@@ -178,10 +184,13 @@ extra_rdoc_files: []
178
184
  files:
179
185
  - ".github/CONTRIBUTING.md"
180
186
  - ".github/PULL_REQUEST_TEMPLATE.md"
187
+ - ".github/gitleaks.toml"
188
+ - ".github/workflows/main.yml"
181
189
  - ".gitignore"
182
190
  - ".travis.yml"
183
191
  - Gemfile
184
192
  - Gemfile.lock
193
+ - LICENSE.txt
185
194
  - README.md
186
195
  - Rakefile
187
196
  - bonnie-bundler.gemspec
@@ -194,7 +203,6 @@ files:
194
203
  - lib/ext/valueset.rb
195
204
  - lib/measures/cql_to_elm_helper.rb
196
205
  - lib/measures/elm_parser.rb
197
- - lib/measures/loading/base_loader_definition.rb
198
206
  - lib/measures/loading/cql_loader.rb
199
207
  - lib/measures/loading/exceptions.rb
200
208
  - lib/measures/loading/loader.rb
@@ -204,13 +212,24 @@ files:
204
212
  - lib/models/cql_measure.rb
205
213
  - lib/models/measure.rb
206
214
  - lib/util/vsac_api.rb
215
+ - notice.md
207
216
  - test/fixtures/BCS_v5_0_Artifacts.zip
208
217
  - test/fixtures/CMS134v6.zip
209
218
  - test/fixtures/CMS158_v5_4_Artifacts.zip
210
219
  - test/fixtures/CMS158_v5_4_Artifacts_Update.zip
220
+ - test/fixtures/CMSAWA_v5_6_Artifacts.zip
221
+ - test/fixtures/CMSAWA_v5_6_Artifacts_missing_component.zip
222
+ - test/fixtures/CMSAWA_v5_6_Artifacts_missing_composite_files.zip
223
+ - test/fixtures/CMSAWA_v5_6_Artifacts_missing_file.zip
211
224
  - test/fixtures/DRAFT_CMS2_CQL.zip
212
225
  - test/fixtures/PVC2_v5_4_Unused_Support_Libraries.zip
226
+ - test/fixtures/TOB2_v5_5_Artifacts.zip
213
227
  - test/fixtures/bonnienesting01_fixed.zip
228
+ - test/fixtures/not_mat_export.zip
229
+ - test/fixtures/vcr_cassettes/load_composite_measure.yml
230
+ - test/fixtures/vcr_cassettes/load_composite_measure_with_missing_component.yml
231
+ - test/fixtures/vcr_cassettes/load_composite_measure_with_missing_composite_files.yml
232
+ - test/fixtures/vcr_cassettes/load_composite_measure_with_missing_file.yml
214
233
  - test/fixtures/vcr_cassettes/mat_5-4_cql_export_vsac_response.yml
215
234
  - test/fixtures/vcr_cassettes/multi_library_webcalls.yml
216
235
  - test/fixtures/vcr_cassettes/valid_translation_response.yml
@@ -220,6 +239,7 @@ files:
220
239
  - test/fixtures/vcr_cassettes/valid_vsac_response_hospice.yml
221
240
  - test/fixtures/vcr_cassettes/valid_vsac_response_includes_draft.yml
222
241
  - test/fixtures/vcr_cassettes/valid_vsac_response_pvc_unused_libraries.yml
242
+ - test/fixtures/vcr_cassettes/valid_vsac_response_special_characters.yml
223
243
  - test/fixtures/vcr_cassettes/vs_loading_500_response.yml
224
244
  - test/fixtures/vcr_cassettes/vs_loading_draft_no_profile_version.yml
225
245
  - test/fixtures/vcr_cassettes/vs_loading_draft_profile.yml
@@ -253,7 +273,9 @@ files:
253
273
  - test/fixtures/vs_loading/DocofMeds_v5_1_Artifacts_With_Profiles.zip
254
274
  - test/simplecov_init.rb
255
275
  - test/test_helper.rb
276
+ - test/unit/composite_cql_loader_test.rb
256
277
  - test/unit/cql_loader_test.rb
278
+ - test/unit/get_value_sets_from_measure_model_test.rb
257
279
  - test/unit/load_mat_export_test.rb
258
280
  - test/unit/measure_complexity_test.rb
259
281
  - test/unit/measure_diff_test.rb
@@ -268,7 +290,7 @@ homepage: http://github.com/projecttacoma/bonnie_bundler
268
290
  licenses:
269
291
  - Apache-2.0
270
292
  metadata: {}
271
- post_install_message:
293
+ post_install_message:
272
294
  rdoc_options: []
273
295
  require_paths:
274
296
  - lib
@@ -283,9 +305,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
283
305
  - !ruby/object:Gem::Version
284
306
  version: '0'
285
307
  requirements: []
286
- rubyforge_project:
287
- rubygems_version: 2.6.12
288
- signing_key:
308
+ rubygems_version: 3.0.8
309
+ signing_key:
289
310
  specification_version: 4
290
311
  summary: A Gem for creating and managing bonnie bundles
291
312
  test_files: []
@@ -1,61 +0,0 @@
1
- module Measures
2
- # Base Class for the different types of loader formats Bonnie Bundler supports.
3
- class BaseLoaderDefinition
4
-
5
- def self.extract(zip_file, entry, out_dir)
6
- out_file = File.join(out_dir,Pathname.new(entry.name).basename.to_s)
7
- zip_file.extract(entry, out_file)
8
- out_file
9
- end
10
-
11
- # Wrapper function that performs checks before extracting all xml files in the given zip
12
- # Returns a hash with the type of xml files present and their paths.
13
- # Ex: {:HQMF_XML => '/var/149825825jf/Test111_eMeasure.xml'}
14
- def self.extract_xml_files(zip_file, files, output_directory=nil)
15
- file_paths_hash = {}
16
- if files.count > 0
17
- # If no directory is given, create a new temporary directory.
18
- if output_directory.nil?
19
- # Create a temporary directory to extract all xml files contained in the zip.
20
- Dir.mktmpdir do |dir|
21
- file_paths_hash = extract_to_temporary_location(zip_file, files, dir)
22
- end
23
- # Use the provided directory to extract the files to.
24
- else
25
- file_paths_hash = extract_to_temporary_location(zip_file, files, output_directory)
26
- end
27
- end
28
- file_paths_hash
29
- end
30
-
31
- private
32
-
33
- # Extracts the xml files from the zip and provides a key value pair for HQMF and ELM xml files.
34
- # Currently only checks for HQMF xml, ELM xml and SIMPLE xml. Uses the root node in each of the files.
35
- # {file_type => file_path}
36
- def self.extract_to_temporary_location(zip_file, files, output_directory)
37
- file_paths_hash = {}
38
- file_paths_hash[:ELM_XML] = []
39
- begin
40
- # Iterate over all files passed in, extract file to temporary directory.
41
- files.each do |xml_file|
42
- if xml_file && xml_file.size > 0
43
- xml_file_path = extract(zip_file, xml_file, output_directory)
44
- # Open up xml file and read contents.
45
- doc = Nokogiri::XML.parse(File.read(xml_file_path))
46
- # Check if root node in xml file matches either the HQMF file or ELM file.
47
- if doc.root.name == 'QualityMeasureDocument' # Root node for HQMF XML
48
- file_paths_hash[:HQMF_XML] = xml_file_path
49
- elsif doc.root.name == 'library' # Root node for ELM XML
50
- file_paths_hash[:ELM_XML] << xml_file_path
51
- end
52
- end
53
- end
54
- rescue Exception => e
55
- raise MeasureLoadingException.new "Error Checking MAT Export: #{e.message}"
56
- end
57
- file_paths_hash
58
- end
59
-
60
- end
61
- end