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
@@ -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