cqm-validators 4.0.1 → 4.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3072faa685de768a4a80ed90fae5da72b0ae2ee1b1d86bea76a9f90fc5a198c6
4
- data.tar.gz: c90de36ea0e134ba07345cc58842682e98c2494ace3f04aeeb65e9aa1511b57b
3
+ metadata.gz: aba5de67708f22d92bb0f20c31d7173bfc0e8382bd8e536ac571d8fde83116d2
4
+ data.tar.gz: 339ba96bb7af5bf2b6b9e2ddb8ff448bc1a0456443273083de3fd014fe0d3f13
5
5
  SHA512:
6
- metadata.gz: 5358b31884f39aea4f44a48c9a4aee3f548f89646bcfc29d64e124e2992ef0a152aa58d4bca08d0bf0e38682347f89bb6c591077443e565a5c4d01494ef14abc
7
- data.tar.gz: c6aee722e6e323d37a8ef25ed2df495fd3b0eb399b194d30134ded1bd7f591f0692a6b73cb52413151559a314e7f29b33d0c62a6707ee69d68065d39c417639b
6
+ metadata.gz: 187eb234fd776e9935809d756ee9fcf3f258d30bf6cfbe07d4f0a4cd7bf5fad3ef18ce00a0b1e06b02f70b825b14794322b25c7f1a6f0d3c7fc75a8d49c9ac42
7
+ data.tar.gz: a276379056beb2530eafaea43df030a0fbaff0a52384ab2c4c7d609c91d9a06e08283dff40a51fc8140d97888033abd4e34a27c5533f65348c31a952ed934652
data/.rubocop.yml CHANGED
@@ -58,6 +58,10 @@ Metrics/PerceivedComplexity:
58
58
  Max: 10
59
59
  Exclude:
60
60
  - 'lib/reported_result_extractor.rb'
61
+ Metrics/ParameterLists:
62
+ Max: 5
63
+ Exclude:
64
+ - 'lib/reported_result_extractor.rb'
61
65
  Naming/MethodParameterName:
62
66
  Enabled: false
63
67
  Style/DateTime:
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CqmValidators
4
- VERSION = '4.0.1'
4
+ VERSION = '4.0.3'
5
5
  end
@@ -17,6 +17,8 @@ module CqmValidators
17
17
  measure_ids = document.xpath(measure_selector).map(&:value).map(&:upcase)
18
18
  measure_ids.each do |measure_id|
19
19
  measure = CQM::Measure.where(hqmf_id: measure_id).first
20
+ next unless measure
21
+
20
22
  measure.population_sets.each do |population_set|
21
23
  reported_result, = extract_results_by_ids(measure, population_set.population_set_id, document)
22
24
  # only check performace rate when there is one
@@ -20,7 +20,10 @@ module CqmValidators
20
20
  end
21
21
 
22
22
  nodes.each do |n|
23
- results = get_measure_components(n, measure.population_sets.where(population_set_id: poulation_set_id).first, stratification_id)
23
+ popset_index = measure.population_sets.map(&:population_set_id).find_index do |pop_set|
24
+ pop_set == poulation_set_id
25
+ end
26
+ results = get_measure_components(n, measure.population_sets.where(population_set_id: poulation_set_id).first, stratification_id, popset_index)
24
27
  break if !results.nil? || (!results.nil? && !results.empty?)
25
28
  end
26
29
  return nil if results.nil?
@@ -35,14 +38,14 @@ module CqmValidators
35
38
  doc.xpath(xpath_measures)
36
39
  end
37
40
 
38
- def get_measure_components(n, population_set, stratification_id)
41
+ def get_measure_components(n, population_set, stratification_id, popset_index)
39
42
  # observations are a hash of population/value. For example {"DENOM"=>108.0, "NUMER"=>2}
40
43
  results = { supplemental_data: {}, observations: {} }
41
44
  stratification = stratification_id ? population_set.stratifications.where(stratification_id: stratification_id).first.hqmf_id : nil
42
45
  ALL_POPULATION_CODES.each do |pop_code|
43
46
  next unless population_set.populations[pop_code]
44
47
 
45
- get_observed_values(results, n, pop_code, population_set, stratification)
48
+ get_observed_values(results, n, pop_code, population_set, stratification, popset_index)
46
49
  val, sup, pr = extract_component_value(n, pop_code, population_set.populations[pop_code]['hqmf_id'], stratification)
47
50
  unless val.nil?
48
51
  results[pop_code] = val
@@ -53,14 +56,14 @@ module CqmValidators
53
56
  results
54
57
  end
55
58
 
56
- def get_observed_values(results, n, pop_code, population_set, stratification)
59
+ def get_observed_values(results, n, pop_code, population_set, stratification, popset_index)
57
60
  statement_name = population_set.populations[pop_code]['statement_name']
58
61
  # look to see if there is an observation that corresponds to the specific statement_name
59
- statement_observation = population_set.observations.select { |obs| obs.observation_parameter.statement_name == statement_name }
62
+ statement_observation = population_set.observations.select { |obs| obs.observation_parameter.statement_name == statement_name }[popset_index]
60
63
  # return unless an observation is found
61
- unless statement_observation.empty?
64
+ unless statement_observation.nil?
62
65
  hqmf_id = population_set.populations[pop_code]['hqmf_id']
63
- results[:observations][pop_code] = extract_cv_value(n, statement_observation.first.hqmf_id, hqmf_id, pop_code, stratification)
66
+ results[:observations][pop_code] = extract_cv_value(n, statement_observation.hqmf_id, hqmf_id, pop_code, stratification)
64
67
  end
65
68
  end
66
69