bonnie_bundler 2.2.3 → 2.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/Gemfile.lock +39 -39
  4. data/bonnie-bundler.gemspec +3 -3
  5. data/lib/bonnie_bundler.rb +0 -1
  6. data/lib/measures/loading/cql_loader.rb +234 -100
  7. data/lib/measures/loading/loader.rb +18 -24
  8. data/lib/models/cql_measure.rb +9 -0
  9. data/test/fixtures/CMSAWA_v5_6_Artifacts.zip +0 -0
  10. data/test/fixtures/CMSAWA_v5_6_Artifacts_missing_component.zip +0 -0
  11. data/test/fixtures/CMSAWA_v5_6_Artifacts_missing_composite_files.zip +0 -0
  12. data/test/fixtures/CMSAWA_v5_6_Artifacts_missing_file.zip +0 -0
  13. data/test/fixtures/not_mat_export.zip +0 -0
  14. data/test/fixtures/vcr_cassettes/load_composite_measure.yml +7305 -0
  15. data/test/fixtures/vcr_cassettes/load_composite_measure_with_missing_component.yml +6923 -0
  16. data/test/fixtures/vcr_cassettes/load_composite_measure_with_missing_composite_files.yml +57 -0
  17. data/test/fixtures/vcr_cassettes/load_composite_measure_with_missing_file.yml +5938 -0
  18. data/test/fixtures/vcr_cassettes/multi_library_webcalls.yml +156 -167
  19. data/test/fixtures/vcr_cassettes/valid_vsac_response.yml +216 -191
  20. data/test/fixtures/vcr_cassettes/valid_vsac_response_158.yml +112 -116
  21. data/test/fixtures/vcr_cassettes/valid_vsac_response_158_update.yml +121 -125
  22. data/test/fixtures/vcr_cassettes/valid_vsac_response_hospice.yml +523 -447
  23. data/test/fixtures/vcr_cassettes/valid_vsac_response_includes_draft.yml +388 -356
  24. data/test/fixtures/vcr_cassettes/valid_vsac_response_pvc_unused_libraries.yml +969 -2079
  25. data/test/fixtures/vcr_cassettes/valid_vsac_response_special_characters.yml +1715 -1715
  26. data/test/fixtures/vcr_cassettes/vs_loading_500_response.yml +26 -510
  27. data/test/fixtures/vcr_cassettes/vs_loading_empty_concept_list.yml +26 -26
  28. data/test/fixtures/vcr_cassettes/vs_loading_release.yml +106 -106
  29. data/test/fixtures/vcr_cassettes/vs_loading_version.yml +106 -106
  30. data/test/unit/composite_cql_loader_test.rb +102 -0
  31. data/test/unit/cql_loader_test.rb +18 -7
  32. data/test/unit/get_value_sets_from_measure_model_test.rb +1 -1
  33. data/test/unit/load_mat_export_test.rb +15 -9
  34. data/test/unit/measure_complexity_test.rb +1 -1
  35. data/test/unit/measure_diff_test.rb +4 -4
  36. data/test/unit/storing_mat_export_package_test.rb +1 -2
  37. data/test/unit/value_set_loading_test.rb +16 -16
  38. data/test/vcr_setup.rb +1 -1
  39. metadata +23 -8
  40. data/lib/measures/loading/base_loader_definition.rb +0 -61
@@ -0,0 +1,102 @@
1
+ require 'test_helper'
2
+ require 'vcr_setup.rb'
3
+
4
+ class CompositeCQLLoaderTest < ActiveSupport::TestCase
5
+
6
+ setup do
7
+ @composite_cql_mat_export = File.new File.join('test', 'fixtures', 'CMSAWA_v5_6_Artifacts.zip')
8
+ @missing_file_composite_cql_mat_export = File.new File.join('test', 'fixtures', 'CMSAWA_v5_6_Artifacts_missing_file.zip')
9
+ @missing_component_composite_cql_mat_export = File.new File.join('test', 'fixtures', 'CMSAWA_v5_6_Artifacts_missing_component.zip')
10
+ @missing_composite_files = File.new File.join('test', 'fixtures', 'CMSAWA_v5_6_Artifacts_missing_composite_files.zip')
11
+ end
12
+
13
+ test "Verify the composite measure to be uploaded is valid" do
14
+ is_valid = Measures::CqlLoader.mat_cql_export?(@composite_cql_mat_export)
15
+ assert_equal true, is_valid
16
+ end
17
+
18
+ test "Flag when an invalid composite measure is provided" do
19
+ is_valid = Measures::CqlLoader.mat_cql_export?(@missing_file_composite_cql_mat_export)
20
+ assert_equal false, is_valid
21
+
22
+ is_valid = Measures::CqlLoader.mat_cql_export?(@missing_composite_files)
23
+ assert_equal false, is_valid
24
+ end
25
+
26
+ test 'Loading a Composite Measure' do
27
+ VCR.use_cassette('load_composite_measure') do
28
+ dump_db
29
+ user = User.new
30
+ user.save
31
+
32
+ measure_details = { 'episode_of_care'=> false }
33
+
34
+ Measures::CqlLoader.extract_measures(@composite_cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
35
+
36
+ assert_equal 8, CqlMeasure.all.count
37
+ # Verify there is only one composite measure
38
+ assert_equal 1, CqlMeasure.all.where(composite: true).count
39
+ assert_equal 7, CqlMeasure.all.where(composite: false).count
40
+
41
+ composite_measure = CqlMeasure.all.where(composite: true).first
42
+ component_measures = CqlMeasure.all.where(composite: false).all
43
+ component_measures.each do |measure|
44
+ # Verify the component contains the composite's hqmf_set_id
45
+ assert measure.hqmf_set_id.include?(composite_measure.hqmf_set_id)
46
+ # Verify each composite measure has a unique hqmf_set_id
47
+ assert_equal 1, CqlMeasure.all.where(hqmf_set_id: measure.hqmf_set_id).count
48
+ # Verify the composite's array of components is correct
49
+ assert composite_measure.component_hqmf_set_ids.include?(measure.hqmf_set_id)
50
+ end
51
+ # Verify the composite is associated with each of the components
52
+ assert_equal 7, composite_measure.component_hqmf_set_ids.count
53
+ end
54
+ end
55
+
56
+ test 'Loading an invalid composite measure that has a component measure with missing xml file' do
57
+ VCR.use_cassette('load_composite_measure_with_missing_file') do
58
+ dump_db
59
+ user = User.new
60
+ user.save
61
+
62
+ measure_details = { 'episode_of_care'=> false }
63
+
64
+ assert_raise Measures::MeasureLoadingException do
65
+ Measures::CqlLoader.extract_measures(@missing_file_composite_cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
66
+ end
67
+ assert_equal 0, CqlMeasure.all.count
68
+ end
69
+ end
70
+
71
+ test 'Loading a composite measure with a missing component measure' do
72
+ VCR.use_cassette('load_composite_measure_with_missing_component') do
73
+ dump_db
74
+ user = User.new
75
+ user.save
76
+
77
+ measure_details = { 'episode_of_care'=> false }
78
+
79
+ assert_raise Measures::MeasureLoadingException do
80
+ Measures::CqlLoader.extract_measures(@missing_component_composite_cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
81
+ end
82
+ assert_equal 0, CqlMeasure.all.count
83
+ end
84
+ end
85
+
86
+ test 'Loading an invalid composite measure that is missing the composite measure files' do
87
+ VCR.use_cassette('load_composite_measure_with_missing_composite_files') do
88
+ dump_db
89
+ user = User.new
90
+ user.save
91
+
92
+ measure_details = { 'episode_of_care'=> false }
93
+
94
+ assert_raise Measures::MeasureLoadingException do
95
+ Measures::CqlLoader.extract_measures(@missing_composite_files, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
96
+ end
97
+ assert_equal 0, CqlMeasure.all.count
98
+ end
99
+ end
100
+
101
+
102
+ end
@@ -5,6 +5,17 @@ class CQLLoaderTest < ActiveSupport::TestCase
5
5
 
6
6
  setup do
7
7
  @cql_mat_export = File.new File.join('test', 'fixtures', 'CMS134v6.zip')
8
+ @invalid_cql_mat_export = File.new File.join('test', 'fixtures', 'not_mat_export.zip')
9
+ end
10
+
11
+ test "Verify the composite measure to be uploaded is valid" do
12
+ is_valid = Measures::CqlLoader.mat_cql_export?(@cql_mat_export)
13
+ assert_equal true, is_valid
14
+ end
15
+
16
+ test "Flag when an invalid composite measure is provided" do
17
+ is_valid = Measures::CqlLoader.mat_cql_export?(@invalid_cql_mat_export)
18
+ assert_equal false, is_valid
8
19
  end
9
20
 
10
21
  test 'Loading a measure that has a definition with the same name as a library definition' do
@@ -14,7 +25,7 @@ class CQLLoaderTest < ActiveSupport::TestCase
14
25
  user.save
15
26
 
16
27
  measure_details = { 'episode_of_care'=> false }
17
- Measures::CqlLoader.load(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
28
+ Measures::CqlLoader.extract_measures(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
18
29
  assert_equal 1, CqlMeasure.all.count
19
30
  measure = CqlMeasure.all.first
20
31
  assert_equal 'Diabetes: Medical Attention for Nephropathy', measure.title
@@ -37,7 +48,7 @@ class CQLLoaderTest < ActiveSupport::TestCase
37
48
 
38
49
  # do first load
39
50
  VCR.use_cassette('valid_vsac_response_158_update') do
40
- Measures::CqlLoader.load(direct_reference_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
51
+ Measures::CqlLoader.extract_measures(direct_reference_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
41
52
  end
42
53
  assert_equal 1, CqlMeasure.all.count
43
54
  measure = CqlMeasure.all.first
@@ -48,7 +59,7 @@ class CQLLoaderTest < ActiveSupport::TestCase
48
59
 
49
60
  # Re-load the Measure
50
61
  VCR.use_cassette('valid_vsac_response_158_update') do
51
- Measures::CqlLoader.load(direct_reference_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
62
+ Measures::CqlLoader.extract_measures(direct_reference_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
52
63
  end
53
64
 
54
65
  assert_equal 2, CqlMeasure.all.count
@@ -68,7 +79,7 @@ class CQLLoaderTest < ActiveSupport::TestCase
68
79
  user.save
69
80
 
70
81
  measure_details = { 'episode_of_care' => false }
71
- Measures::CqlLoader.load(unused_library_mat_export, user, measure_details, { include_draft: true, profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
82
+ Measures::CqlLoader.extract_measures(unused_library_mat_export, user, measure_details, { include_draft: true, profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
72
83
  assert_equal 1, CqlMeasure.all.count
73
84
  measure = CqlMeasure.all.first
74
85
 
@@ -87,7 +98,7 @@ class CQLLoaderTest < ActiveSupport::TestCase
87
98
  user.save
88
99
 
89
100
  measure_details = {'episode_of_care' => false }
90
- Measures::CqlLoader.load(measure_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket).save
101
+ Measures::CqlLoader.extract_measures(measure_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket).each {|measure| measure.save}
91
102
  assert_equal 1, CqlMeasure.all.count
92
103
  measure = CqlMeasure.all.first
93
104
  define_name = measure.elm_annotations['TobaccoUseTreatmentProvidedorOfferedTOB2TobaccoUseTreatmentTOB2a']['statements'][36]['define_name']
@@ -108,7 +119,7 @@ class CQLLoaderTest < ActiveSupport::TestCase
108
119
  user.save
109
120
 
110
121
  measure_details = { 'episode_of_care'=> false }
111
- Measures::CqlLoader.load(direct_reference_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
122
+ Measures::CqlLoader.extract_measures(direct_reference_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
112
123
  assert_equal 1, CqlMeasure.all.count
113
124
  measure = CqlMeasure.all.first
114
125
  before_value_sets = measure.value_set_oids
@@ -117,7 +128,7 @@ class CQLLoaderTest < ActiveSupport::TestCase
117
128
  before_source_data_criteria = measure.source_data_criteria
118
129
 
119
130
  # Re-load the Measure without VSAC Credentials
120
- Measures::CqlLoader.load(direct_reference_mat_export, user, measure_details, nil, nil).save
131
+ Measures::CqlLoader.extract_measures(direct_reference_mat_export, user, measure_details, nil, nil).each {|measure| measure.save}
121
132
  assert_equal 2, CqlMeasure.all.count
122
133
  measures = CqlMeasure.all
123
134
 
@@ -11,7 +11,7 @@ class GetValueSetsFromMeasureModelTest < ActiveSupport::TestCase
11
11
  user.save
12
12
  measure_details = { 'episode_of_care'=> false }
13
13
  VCR.use_cassette('valid_vsac_response_158_update') do
14
- Measures::CqlLoader.load(direct_reference_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
14
+ Measures::CqlLoader.extract_measures(direct_reference_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
15
15
  end
16
16
 
17
17
  measure = CqlMeasure.all.first
@@ -10,6 +10,12 @@ class LoadMATExportTest < ActiveSupport::TestCase
10
10
  @cql_draft_measure_mat_export = File.new File.join('test', 'fixtures', 'DRAFT_CMS2_CQL.zip')
11
11
  end
12
12
 
13
+
14
+ test "Verify the measure to be uploaded is valid" do
15
+ is_valid = Measures::CqlLoader.mat_cql_export?(@cql_mat_export)
16
+ assert_equal true, is_valid
17
+ end
18
+
13
19
  test "Loading a CQL Mat export zip file including draft, with VSAC credentials" do
14
20
  VCR.use_cassette("valid_vsac_response_includes_draft") do
15
21
  dump_db
@@ -17,7 +23,7 @@ class LoadMATExportTest < ActiveSupport::TestCase
17
23
  user.save
18
24
  measure_details = { 'episode_of_care'=> false }
19
25
 
20
- Measures::CqlLoader.load(@cql_draft_measure_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket).save
26
+ Measures::CqlLoader.extract_measures(@cql_draft_measure_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket).each {|measure| measure.save}
21
27
  assert_equal 1, CqlMeasure.all.count
22
28
  measure = CqlMeasure.all.first
23
29
  assert_equal "Screening for Depression", measure.title
@@ -39,7 +45,7 @@ class LoadMATExportTest < ActiveSupport::TestCase
39
45
 
40
46
  VCR.use_cassette("valid_vsac_response") do
41
47
  measure_details = { 'episode_of_care'=> false }
42
- Measures::CqlLoader.load(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
48
+ Measures::CqlLoader.extract_measures(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
43
49
  assert_equal 1, CqlMeasure.all.count
44
50
  end
45
51
 
@@ -57,7 +63,7 @@ class LoadMATExportTest < ActiveSupport::TestCase
57
63
  user = User.new
58
64
  user.save
59
65
  measure_details = { 'episode_of_care'=> false }
60
- Measures::CqlLoader.load(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
66
+ Measures::CqlLoader.extract_measures(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
61
67
  assert_equal 1, CqlMeasure.all.count
62
68
  measure = CqlMeasure.all.first
63
69
  assert_equal "BCSTest", measure.title
@@ -74,7 +80,7 @@ class LoadMATExportTest < ActiveSupport::TestCase
74
80
  user.save
75
81
 
76
82
  measure_details = { 'episode_of_care'=> false }
77
- Measures::CqlLoader.load(@cql_mat_5_4_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
83
+ Measures::CqlLoader.extract_measures(@cql_mat_5_4_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
78
84
  assert_equal 1, CqlMeasure.all.count
79
85
  measure = CqlMeasure.all.first
80
86
  assert_equal "Test 158", measure.title
@@ -93,7 +99,7 @@ class LoadMATExportTest < ActiveSupport::TestCase
93
99
  user.save
94
100
 
95
101
  measure_details = { 'episode_of_care'=> false }
96
- Measures::CqlLoader.load(@cql_mat_5_4_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
102
+ Measures::CqlLoader.extract_measures(@cql_mat_5_4_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
97
103
  assert_equal 1, CqlMeasure.all.count
98
104
  measure = CqlMeasure.all.first
99
105
  assert_equal "Test 158", measure.title
@@ -111,7 +117,7 @@ class LoadMATExportTest < ActiveSupport::TestCase
111
117
  user.save
112
118
 
113
119
  measure_details = { 'episode_of_care'=> false }
114
- Measures::CqlLoader.load(@cql_mat_5_4_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
120
+ Measures::CqlLoader.extract_measures(@cql_mat_5_4_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
115
121
  assert_equal 1, CqlMeasure.all.count
116
122
  measure = CqlMeasure.all.first
117
123
  assert_equal 1, CqlMeasurePackage.all.count
@@ -129,7 +135,7 @@ class LoadMATExportTest < ActiveSupport::TestCase
129
135
  user.save
130
136
 
131
137
  measure_details = { 'episode_of_care'=> false }
132
- Measures::CqlLoader.load(@cql_multi_library_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
138
+ Measures::CqlLoader.extract_measures(@cql_multi_library_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
133
139
  assert_equal 1, CqlMeasure.all.count
134
140
  measure = CqlMeasure.all.first
135
141
  assert_equal (measure.elm.instance_of? Array), true
@@ -151,7 +157,7 @@ class LoadMATExportTest < ActiveSupport::TestCase
151
157
  user2 = User.new
152
158
  user2.save
153
159
  VCR.use_cassette("valid_vsac_response_158") do
154
- Measures::CqlLoader.load(cql_mat_export, user, {}, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
160
+ Measures::CqlLoader.extract_measures(cql_mat_export, user, {}, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
155
161
  end
156
162
 
157
163
  measure = CqlMeasure.all.by_user(user).first
@@ -165,7 +171,7 @@ class LoadMATExportTest < ActiveSupport::TestCase
165
171
  # Add the same measure not associated with a user, there should be 2 measures and
166
172
  # and twice as many value sets in the db after loading
167
173
  VCR.use_cassette("valid_vsac_response_158") do
168
- Measures::CqlLoader.load(cql_mat_export, user2, {}, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
174
+ Measures::CqlLoader.extract_measures(cql_mat_export, user2, {}, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
169
175
  end
170
176
  measure2 = CqlMeasure.all.by_user(user2).first
171
177
  assert_equal 1, CqlMeasure.by_user(user).count
@@ -12,7 +12,7 @@ class MeasureComplexityTest < ActiveSupport::TestCase
12
12
  user = User.new
13
13
  user.save
14
14
  measure_details = { 'episode_of_care'=> false }
15
- Measures::CqlLoader.load(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
15
+ Measures::CqlLoader.extract_measures(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
16
16
  assert_equal 1, CqlMeasure.all.count
17
17
  measure = CqlMeasure.all.first
18
18
  assert_equal 10, measure.complexity["variables"].length
@@ -10,7 +10,7 @@ class MeasureDiffTest < ActiveSupport::TestCase
10
10
  user = User.new
11
11
  user.save
12
12
  measure_details = { 'episode_of_care'=> false }
13
- Measures::CqlLoader.load(@previous_measure, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
13
+ Measures::CqlLoader.extract_measures(@previous_measure, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
14
14
  end
15
15
  assert_equal 1, CqlMeasure.all.count
16
16
  measure = CqlMeasure.all.first
@@ -27,7 +27,7 @@ class MeasureDiffTest < ActiveSupport::TestCase
27
27
  user = User.new
28
28
  user.save
29
29
  measure_details = { 'episode_of_care'=> false }
30
- Measures::CqlLoader.load(@updated_measure, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
30
+ Measures::CqlLoader.extract_measures(@updated_measure, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
31
31
  end
32
32
  assert_equal 1, CqlMeasure.all.count
33
33
  measure = CqlMeasure.all.first
@@ -44,7 +44,7 @@ class MeasureDiffTest < ActiveSupport::TestCase
44
44
  user = User.new
45
45
  user.save
46
46
  measure_details = { 'episode_of_care'=> false }
47
- Measures::CqlLoader.load(@previous_measure, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
47
+ Measures::CqlLoader.extract_measures(@previous_measure, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
48
48
  end
49
49
  assert_equal 1, CqlMeasure.all.count
50
50
  assert_equal 1, CqlMeasurePackage.all.count
@@ -55,7 +55,7 @@ class MeasureDiffTest < ActiveSupport::TestCase
55
55
  user = User.new
56
56
  user.save
57
57
  measure_details = { 'episode_of_care'=> false }
58
- Measures::CqlLoader.load(@updated_measure, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
58
+ Measures::CqlLoader.extract_measures(@updated_measure, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
59
59
  end
60
60
  assert_equal 2, CqlMeasure.all.count
61
61
  assert_equal 2, CqlMeasurePackage.all.count
@@ -14,7 +14,7 @@ class StoringMATExportPackageTest < ActiveSupport::TestCase
14
14
  user.save
15
15
 
16
16
  measure_details = { 'episode_of_care'=> false }
17
- Measures::CqlLoader.load(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).save
17
+ Measures::CqlLoader.extract_measures(@cql_mat_export, user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket).each {|measure| measure.save}
18
18
  assert_equal 1, CqlMeasure.all.count
19
19
  measure = CqlMeasure.all.first
20
20
  assert_equal "Test 158", measure.title
@@ -41,5 +41,4 @@ class StoringMATExportPackageTest < ActiveSupport::TestCase
41
41
  end
42
42
  end
43
43
  end
44
-
45
44
  end
@@ -15,8 +15,8 @@ class ValueSetLoadingTest < ActiveSupport::TestCase
15
15
  VCR.use_cassette("vs_loading_draft_no_profile_version") do
16
16
  mat_file = File.new File.join("test", "fixtures", "vs_loading", "DocofMeds_v5_1_Artifacts.zip")
17
17
  measure_details = {}
18
- measure = Measures::CqlLoader.load(mat_file, @user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket)
19
- measure.value_sets.each do |vs|
18
+ measures = Measures::CqlLoader.extract_measures(mat_file, @user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket)
19
+ measures[0].value_sets.each do |vs|
20
20
  if vs.oid == "2.16.840.1.113883.3.600.1.1834"
21
21
  assert_equal 154, vs.concepts.count
22
22
  end
@@ -29,8 +29,8 @@ class ValueSetLoadingTest < ActiveSupport::TestCase
29
29
  VCR.use_cassette("vs_loading_draft_profile") do
30
30
  mat_file = File.new File.join("test", "fixtures", "vs_loading", "DocofMeds_v5_1_Artifacts_With_Profiles.zip")
31
31
  measure_details = {}
32
- measure = Measures::CqlLoader.load(mat_file, @user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket)
33
- measure.value_sets.each do |vs|
32
+ measures = Measures::CqlLoader.extract_measures(mat_file, @user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket)
33
+ measures[0].value_sets.each do |vs|
34
34
  if vs.oid == "2.16.840.1.113883.3.600.1.1834"
35
35
  assert_equal 154, vs.concepts.count
36
36
  end
@@ -44,8 +44,8 @@ class ValueSetLoadingTest < ActiveSupport::TestCase
44
44
  VCR.use_cassette("vs_loading_draft_verion") do
45
45
  mat_file = File.new File.join("test", "fixtures", "vs_loading", "DocofMeds_v5_1_Artifacts_Version.zip")
46
46
  measure_details = {}
47
- measure = Measures::CqlLoader.load(mat_file, @user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket)
48
- measure.value_sets.each do |vs|
47
+ measures = Measures::CqlLoader.extract_measures(mat_file, @user, measure_details, { profile: APP_CONFIG['vsac']['default_profile'], include_draft: true }, get_ticket_granting_ticket)
48
+ measures[0].value_sets.each do |vs|
49
49
  if vs.oid == "2.16.840.1.113883.3.600.1.1834"
50
50
  assert_equal 154, vs.concepts.count
51
51
  end
@@ -58,8 +58,8 @@ class ValueSetLoadingTest < ActiveSupport::TestCase
58
58
  VCR.use_cassette("vs_loading_no_profile_version") do
59
59
  mat_file = File.new File.join("test", "fixtures", "vs_loading", "DocofMeds_v5_1_Artifacts.zip")
60
60
  measure_details = {}
61
- measure = Measures::CqlLoader.load(mat_file, @user, measure_details, { measure_defined: true, profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket)
62
- measure.value_sets.each do |vs|
61
+ measures = Measures::CqlLoader.extract_measures(mat_file, @user, measure_details, { measure_defined: true, profile: APP_CONFIG['vsac']['default_profile'] }, get_ticket_granting_ticket)
62
+ measures[0].value_sets.each do |vs|
63
63
  if vs.oid == "2.16.840.1.113883.3.600.1.1834"
64
64
  assert_equal 154, vs.concepts.count
65
65
  end
@@ -72,8 +72,8 @@ class ValueSetLoadingTest < ActiveSupport::TestCase
72
72
  VCR.use_cassette("vs_loading_meausre_defined_no_backup_profile") do
73
73
  mat_file = File.new File.join("test", "fixtures", "vs_loading", "DocofMeds_v5_1_Artifacts.zip")
74
74
  measure_details = {}
75
- measure = Measures::CqlLoader.load(mat_file, @user, measure_details, { measure_defined: true }, get_ticket_granting_ticket)
76
- measure.value_sets.each do |vs|
75
+ measures = Measures::CqlLoader.extract_measures(mat_file, @user, measure_details, { measure_defined: true }, get_ticket_granting_ticket)
76
+ measures[0].value_sets.each do |vs|
77
77
  if vs.oid == "2.16.840.1.113883.3.600.1.1834"
78
78
  assert_equal 175, vs.concepts.count
79
79
  end
@@ -86,8 +86,8 @@ class ValueSetLoadingTest < ActiveSupport::TestCase
86
86
  VCR.use_cassette("vs_loading_release") do
87
87
  mat_file = File.new File.join("test", "fixtures", "vs_loading", "DocofMeds_v5_1_Artifacts.zip")
88
88
  measure_details = {}
89
- measure = Measures::CqlLoader.load(mat_file, @user, measure_details, { release: 'eCQM Update 2018 EP-EC and EH' }, get_ticket_granting_ticket)
90
- measure.value_sets.each do |vs|
89
+ measures = Measures::CqlLoader.extract_measures(mat_file, @user, measure_details, { release: 'eCQM Update 2018 EP-EC and EH' }, get_ticket_granting_ticket)
90
+ measures[0].value_sets.each do |vs|
91
91
  if vs.oid == "2.16.840.1.113883.3.600.1.1834"
92
92
  assert_equal 162, vs.concepts.count
93
93
  end
@@ -100,8 +100,8 @@ class ValueSetLoadingTest < ActiveSupport::TestCase
100
100
  VCR.use_cassette("vs_loading_profile") do
101
101
  mat_file = File.new File.join("test", "fixtures", "vs_loading", "DocofMeds_v5_1_Artifacts_With_Profiles.zip")
102
102
  measure_details = {}
103
- measure = Measures::CqlLoader.load(mat_file, @user, measure_details, { measure_defined: true }, get_ticket_granting_ticket)
104
- measure.value_sets.each do |vs|
103
+ measures = Measures::CqlLoader.extract_measures(mat_file, @user, measure_details, { measure_defined: true }, get_ticket_granting_ticket)
104
+ measures[0].value_sets.each do |vs|
105
105
  if vs.oid == "2.16.840.1.113883.3.600.1.1834"
106
106
  assert_equal 152, vs.concepts.count
107
107
  end
@@ -114,8 +114,8 @@ class ValueSetLoadingTest < ActiveSupport::TestCase
114
114
  VCR.use_cassette("vs_loading_version") do
115
115
  mat_file = File.new File.join("test", "fixtures", "vs_loading", "DocofMeds_v5_1_Artifacts_Version.zip")
116
116
  measure_details = {}
117
- measure = Measures::CqlLoader.load(mat_file, @user, measure_details, { measure_defined: true }, get_ticket_granting_ticket)
118
- measure.value_sets.each do |vs|
117
+ measures = Measures::CqlLoader.extract_measures(mat_file, @user, measure_details, { measure_defined: true }, get_ticket_granting_ticket)
118
+ measures[0].value_sets.each do |vs|
119
119
  if vs.oid == "2.16.840.1.113883.3.600.1.1834"
120
120
  assert_equal 148, vs.concepts.count
121
121
  end
data/test/vcr_setup.rb CHANGED
@@ -14,7 +14,7 @@ VCR.configure do |c|
14
14
 
15
15
  # Ensure plain text passwords do not show up during logging
16
16
  c.filter_sensitive_data('<VSAC_USERNAME>') {ENV['VSAC_USERNAME']}
17
- c.filter_sensitive_data('<VSAC_PASSWORD>') {ENV['VSAC_PASSWORD']}
17
+ c.filter_sensitive_data('<VSAC_PASSWORD>') {URI.escape(ENV['VSAC_PASSWORD'])}
18
18
  c.default_cassette_options = {record: :once }
19
19
 
20
20
  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.3
4
+ version: 2.2.4
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: 2018-10-15 00:00:00.000000000 Z
11
+ date: 2018-12-03 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.3.1
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.3.1
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
@@ -194,7 +200,6 @@ files:
194
200
  - lib/ext/valueset.rb
195
201
  - lib/measures/cql_to_elm_helper.rb
196
202
  - lib/measures/elm_parser.rb
197
- - lib/measures/loading/base_loader_definition.rb
198
203
  - lib/measures/loading/cql_loader.rb
199
204
  - lib/measures/loading/exceptions.rb
200
205
  - lib/measures/loading/loader.rb
@@ -208,10 +213,19 @@ files:
208
213
  - test/fixtures/CMS134v6.zip
209
214
  - test/fixtures/CMS158_v5_4_Artifacts.zip
210
215
  - test/fixtures/CMS158_v5_4_Artifacts_Update.zip
216
+ - test/fixtures/CMSAWA_v5_6_Artifacts.zip
217
+ - test/fixtures/CMSAWA_v5_6_Artifacts_missing_component.zip
218
+ - test/fixtures/CMSAWA_v5_6_Artifacts_missing_composite_files.zip
219
+ - test/fixtures/CMSAWA_v5_6_Artifacts_missing_file.zip
211
220
  - test/fixtures/DRAFT_CMS2_CQL.zip
212
221
  - test/fixtures/PVC2_v5_4_Unused_Support_Libraries.zip
213
222
  - test/fixtures/TOB2_v5_5_Artifacts.zip
214
223
  - test/fixtures/bonnienesting01_fixed.zip
224
+ - test/fixtures/not_mat_export.zip
225
+ - test/fixtures/vcr_cassettes/load_composite_measure.yml
226
+ - test/fixtures/vcr_cassettes/load_composite_measure_with_missing_component.yml
227
+ - test/fixtures/vcr_cassettes/load_composite_measure_with_missing_composite_files.yml
228
+ - test/fixtures/vcr_cassettes/load_composite_measure_with_missing_file.yml
215
229
  - test/fixtures/vcr_cassettes/mat_5-4_cql_export_vsac_response.yml
216
230
  - test/fixtures/vcr_cassettes/multi_library_webcalls.yml
217
231
  - test/fixtures/vcr_cassettes/valid_translation_response.yml
@@ -255,6 +269,7 @@ files:
255
269
  - test/fixtures/vs_loading/DocofMeds_v5_1_Artifacts_With_Profiles.zip
256
270
  - test/simplecov_init.rb
257
271
  - test/test_helper.rb
272
+ - test/unit/composite_cql_loader_test.rb
258
273
  - test/unit/cql_loader_test.rb
259
274
  - test/unit/get_value_sets_from_measure_model_test.rb
260
275
  - test/unit/load_mat_export_test.rb
@@ -287,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
287
302
  version: '0'
288
303
  requirements: []
289
304
  rubyforge_project:
290
- rubygems_version: 2.6.12
305
+ rubygems_version: 2.6.14
291
306
  signing_key:
292
307
  specification_version: 4
293
308
  summary: A Gem for creating and managing bonnie bundles