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.
- checksums.yaml +5 -5
- data/.github/gitleaks.toml +268 -0
- data/.github/workflows/main.yml +31 -0
- data/.travis.yml +2 -2
- data/Gemfile.lock +74 -75
- data/LICENSE.txt +201 -0
- data/README.md +12 -0
- data/bonnie-bundler.gemspec +4 -4
- data/lib/bonnie_bundler.rb +0 -1
- data/lib/measures/elm_parser.rb +7 -1
- data/lib/measures/loading/cql_loader.rb +234 -100
- data/lib/measures/loading/exceptions.rb +4 -4
- data/lib/measures/loading/loader.rb +18 -24
- data/lib/models/cql_measure.rb +25 -0
- data/lib/util/vsac_api.rb +13 -13
- data/notice.md +9 -0
- data/test/fixtures/CMSAWA_v5_6_Artifacts.zip +0 -0
- data/test/fixtures/CMSAWA_v5_6_Artifacts_missing_component.zip +0 -0
- data/test/fixtures/CMSAWA_v5_6_Artifacts_missing_composite_files.zip +0 -0
- data/test/fixtures/CMSAWA_v5_6_Artifacts_missing_file.zip +0 -0
- data/test/fixtures/TOB2_v5_5_Artifacts.zip +0 -0
- data/test/fixtures/not_mat_export.zip +0 -0
- data/test/fixtures/vcr_cassettes/load_composite_measure.yml +7305 -0
- data/test/fixtures/vcr_cassettes/load_composite_measure_with_missing_component.yml +6923 -0
- data/test/fixtures/vcr_cassettes/load_composite_measure_with_missing_composite_files.yml +57 -0
- data/test/fixtures/vcr_cassettes/load_composite_measure_with_missing_file.yml +5938 -0
- data/test/fixtures/vcr_cassettes/multi_library_webcalls.yml +156 -167
- data/test/fixtures/vcr_cassettes/valid_vsac_response.yml +216 -191
- data/test/fixtures/vcr_cassettes/valid_vsac_response_158.yml +112 -116
- data/test/fixtures/vcr_cassettes/valid_vsac_response_158_update.yml +121 -125
- data/test/fixtures/vcr_cassettes/valid_vsac_response_hospice.yml +523 -447
- data/test/fixtures/vcr_cassettes/valid_vsac_response_includes_draft.yml +388 -356
- data/test/fixtures/vcr_cassettes/valid_vsac_response_pvc_unused_libraries.yml +969 -2079
- data/test/fixtures/vcr_cassettes/valid_vsac_response_special_characters.yml +5408 -0
- data/test/fixtures/vcr_cassettes/vs_loading_500_response.yml +26 -510
- data/test/fixtures/vcr_cassettes/vs_loading_empty_concept_list.yml +26 -26
- data/test/fixtures/vcr_cassettes/vs_loading_release.yml +106 -106
- data/test/fixtures/vcr_cassettes/vs_loading_version.yml +106 -106
- data/test/test_helper.rb +1 -1
- data/test/unit/composite_cql_loader_test.rb +102 -0
- data/test/unit/cql_loader_test.rb +38 -6
- data/test/unit/get_value_sets_from_measure_model_test.rb +34 -0
- data/test/unit/load_mat_export_test.rb +15 -9
- data/test/unit/measure_complexity_test.rb +1 -1
- data/test/unit/measure_diff_test.rb +4 -4
- data/test/unit/storing_mat_export_package_test.rb +1 -2
- data/test/unit/value_set_loading_test.rb +16 -16
- data/test/unit/vsac_api_auth_test.rb +7 -31
- data/test/unit/vsac_api_test.rb +6 -6
- data/test/vcr_setup.rb +4 -6
- metadata +35 -14
- 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
|
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'],
|
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
|
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'],
|
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
|
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'],
|
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'],
|
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 = {
|
data/test/unit/vsac_api_test.rb
CHANGED
@@ -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'],
|
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'],
|
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'],
|
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'],
|
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'],
|
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'],
|
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)
|
data/test/vcr_setup.rb
CHANGED
@@ -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
|
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['
|
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('<
|
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:
|
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:
|
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:
|
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:
|
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: '
|
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: '
|
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
|
-
|
287
|
-
|
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
|