cqm-validators 3.1.3 → 4.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d1b58c405d0b4f5749dd5a97f3e8bf6d9d751276b322f7f616ec143273c546a
4
- data.tar.gz: 6c569d85fa41bdf80c2ebb2844035a0d3eca2e58d8c065f28dab833370049e34
3
+ metadata.gz: 29df45cf99b9918238f8546e963c56c83abe86cbff28f5fb82f5d6ffdc8d8521
4
+ data.tar.gz: 873a72b950d5e2a98bbffc90748270ae114ef036c8a5b294639cb8ed215326c0
5
5
  SHA512:
6
- metadata.gz: 1fac7b2669ce06bcf10402fe2e966740eb6f82e5dadd1245e251e49a7d1fcc3f3d0dc6966d235f073279ad844864b30c965101bf630fe1a88560f8b11edcf1bb
7
- data.tar.gz: c641e6e185bc0cf57efc448b280441193ce0a3c0143e5d041271a1484a6b1cf6a84d19862cce4e5ec7b1767960bd41bb19b8e2d86d5a4b508bbbfad07e7c5fb4
6
+ metadata.gz: 3386b218f4d06ffac761dfcb4707cabefc6766d7bceaad1eb16edfab038a0ef6b9f0cdb631e98338bd54c55cda9abca9dbf5f1a7879b170fc5fd5db6a3d6e79d
7
+ data.tar.gz: 428af9d72635fce454ee01d55c706d7c1b6fdf52a48c782eba7cde889dcbd448c1df79646f9933ed786cf642afbab586030d196f233f8689da698b696157ca89
@@ -13,7 +13,7 @@ jobs:
13
13
 
14
14
  strategy:
15
15
  matrix:
16
- ruby-version: [2.6, 2.7.2]
16
+ ruby-version: [2.6, 2.5]
17
17
  mongodb-version: [4.0.18, 4.4]
18
18
 
19
19
  steps:
@@ -33,4 +33,4 @@ jobs:
33
33
  bundle exec overcommit --sign
34
34
  bundle exec overcommit --run
35
35
  - name: Run tests
36
- run: bundle exec rake test
36
+ run: bundle exec rake test
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 = '3.1.3'
4
+ VERSION = '4.0.2'
5
5
  end
@@ -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