cqm-validators 3.0.0 → 4.0.0

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
- SHA1:
3
- metadata.gz: b6ac5efe9cf0f9d3b494df3e1232e4b344588f5a
4
- data.tar.gz: 1af92994e5886b95b087fef53b906b6cb57be40b
2
+ SHA256:
3
+ metadata.gz: 7f5aa4c4199a8fa00a964e8f791fff0518f3c1286425480d62e7e893c3259461
4
+ data.tar.gz: 7642850c6daf117dec474a52256801b1263ef0aeb78abcdf6d2bcb8378230431
5
5
  SHA512:
6
- metadata.gz: 6218845885507781195292331e40ae13c7049c35d567a51a63477f25918693eabcf123fd0b60ac8e5c659f8c74a8acca050183a5daae7e6c658d56943e189a17
7
- data.tar.gz: 33bc96b5f3291ca1bb9ef6e87c9f4a76ee7989f79e5a9c7645f6056aeffda672ab53f85c2f2653c6fa9f901cb7d5a73c1bd58d783e1971fa9e240214841bb747
6
+ metadata.gz: 6114df00a65a292b9e7248529175b238150eda867d1c1c4edfefdeb77400e4ded51f6d1ebec9fddd0985ecde65edef99e9b4c11d5c58b40d74ebbe638d6b0f2a
7
+ data.tar.gz: 8a1b7f742eb7107ab9ea3b0caa59935f0c8f47e084ce62262b206902464221f09aa45b62132effe697c17ef5231cc4fee07b6561d4b644bc352bec0d83af9566
@@ -0,0 +1,35 @@
1
+ name: Continuous Integration
2
+ on:
3
+ pull_request:
4
+ branches:
5
+ - master
6
+ - cqm_validators_2_x
7
+
8
+ jobs:
9
+ build:
10
+
11
+ runs-on: ubuntu-latest
12
+
13
+ strategy:
14
+ matrix:
15
+ ruby-version: [2.6, 2.5]
16
+ mongodb-version: [4.0.18, 4.4]
17
+
18
+ steps:
19
+ - uses: actions/checkout@v2
20
+ - name: Use Ruby ${{ matrix.ruby-version }}
21
+ uses: ruby/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby-version }}
24
+ - name: Install dependencies
25
+ run: bundle install
26
+ - name: Start MongoDB
27
+ uses: supercharge/mongodb-github-action@1.3.0
28
+ with:
29
+ mongodb-version: ${{ matrix.mongodb-version }}
30
+ - name: Run overcommit
31
+ run: |
32
+ bundle exec overcommit --sign
33
+ bundle exec overcommit --run
34
+ - name: Run tests
35
+ run: bundle exec rake test
data/.overcommit.yml CHANGED
@@ -7,6 +7,8 @@ PreCommit:
7
7
  exclude: ['test/fixtures/**/*', 'lib/schema/**/*', 'lib/schematron/iso-schematron-xslt1/**/*', 'lib/schematron/iso-schematron-xslt2/**/*', 'lib/schematron/qrda/**/*']
8
8
  AuthorName:
9
9
  enabled: false
10
+ AuthorEmail:
11
+ enabled: false
10
12
  CommitMsg:
11
13
  RussianNovel:
12
14
  enabled: true
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.6
2
+ TargetRubyVersion: 2.4
3
3
  Exclude:
4
4
  - bin/*
5
5
  Style/Documentation:
@@ -56,6 +56,8 @@ Metrics/CyclomaticComplexity:
56
56
  Max: 10
57
57
  Metrics/PerceivedComplexity:
58
58
  Max: 10
59
+ Exclude:
60
+ - 'lib/reported_result_extractor.rb'
59
61
  Naming/MethodParameterName:
60
62
  Enabled: false
61
63
  Style/DateTime:
data/.simplecov CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  SimpleCov.start do
2
4
  merge_timeout 3600
3
5
  end
data/Gemfile CHANGED
@@ -9,6 +9,6 @@ gemspec development_group: :test
9
9
 
10
10
  group :test do
11
11
  gem 'codecov', require: false
12
- gem 'cqm-models', git: 'https://github.com/projecttacoma/cqm-models.git', branch: 'master'
12
+ gem 'cqm-models', '~> 3.0'
13
13
  gem 'simplecov', require: false
14
14
  end
data/README.md CHANGED
@@ -25,6 +25,7 @@ Starting with version **2.0.0** released on 6/20/19, cqm-validators versioning h
25
25
  | X | QRDA Cat 1 | QRDA Cat 3 |
26
26
  | --- | --- | --- |
27
27
  | 2 | R1 STU5.1 | R1 STU2.1 |
28
+ | 3 | R1 STU5.2 | R1 STU2.1 |
28
29
 
29
30
  * **Y** indicates major changes (incompatible API changes)
30
31
 
@@ -22,7 +22,9 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_dependency 'nokogiri', '~>1.10'
25
+ spec.required_ruby_version = '>= 2.4.0'
26
+
27
+ spec.add_dependency 'nokogiri', '>= 1.8.5', '< 1.13.0'
26
28
 
27
29
  spec.add_development_dependency 'bundler'
28
30
  spec.add_development_dependency 'byebug'
@@ -30,6 +32,6 @@ Gem::Specification.new do |spec|
30
32
  spec.add_development_dependency 'minitest-reporters'
31
33
  spec.add_development_dependency 'mongoid'
32
34
  spec.add_development_dependency 'overcommit'
33
- spec.add_development_dependency 'rake', '~> 10.0'
34
- spec.add_development_dependency 'rubocop', '~> 0.60'
35
+ spec.add_development_dependency 'rake', '>= 12.3.3'
36
+ spec.add_development_dependency 'rubocop', '~> 0.93'
35
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CqmValidators
4
- VERSION = '3.0.0'
4
+ VERSION = '4.0.0'
5
5
  end
@@ -12,7 +12,7 @@ module CqmValidators
12
12
  @errors = []
13
13
  @doc = get_document(file)
14
14
  @doc.root.add_namespace_definition('cda', 'urn:hl7-org:v3')
15
- measure_ids = CQM::Measure.all.map(&:hqmf_id)
15
+ measure_ids = CQM::Measure.pluck(:hqmf_id)
16
16
  doc_measure_ids = @doc.xpath(measure_selector).map(&:value).map(&:upcase)
17
17
  # list of all of the set ids in the QRDA
18
18
  doc_neutral_ids = @doc.xpath(neutral_measure_selector).map(&:value).map(&:upcase).sort
@@ -35,10 +35,13 @@ module CqmValidators
35
35
  denexcep = 0
36
36
  denom = 0
37
37
  numer = 0
38
+ numex = 0
38
39
  denex = reported_result['DENEX'] unless reported_result['DENEX'].nil?
39
40
  denexcep = reported_result['DENEXCEP'] unless reported_result['DENEXCEP'].nil?
40
41
  denom = reported_result['DENOM'] unless reported_result['DENOM'].nil?
41
42
  numer = reported_result['NUMER'] unless reported_result['NUMER'].nil?
43
+ numex = reported_result['NUMEX'] unless reported_result['NUMEX'].nil?
44
+ numer -= numex
42
45
  denom = denom - denex - denexcep
43
46
  pr = if denom.zero?
44
47
  'NA'
@@ -8,7 +8,7 @@ module CqmValidators
8
8
  # returns nil if nothing matching is found
9
9
  # returns a hash with the values of the populations filled out along with the population_ids added to the result
10
10
 
11
- ALL_POPULATION_CODES = %w[IPP DENOM NUMER NUMEX DENEX DENEXCEP MSRPOPL MSRPOPLEX OBSERV].freeze
11
+ ALL_POPULATION_CODES = %w[IPP DENOM NUMER NUMEX DENEX DENEXCEP MSRPOPL MSRPOPLEX].freeze
12
12
 
13
13
  def extract_results_by_ids(measure, poulation_set_id, doc, stratification_id = nil)
14
14
  results = nil
@@ -36,21 +36,14 @@ module CqmValidators
36
36
  end
37
37
 
38
38
  def get_measure_components(n, population_set, stratification_id)
39
- results = { supplemental_data: {} }
39
+ # observations are a hash of population/value. For example {"DENOM"=>108.0, "NUMER"=>2}
40
+ results = { supplemental_data: {}, observations: {} }
40
41
  stratification = stratification_id ? population_set.stratifications.where(stratification_id: stratification_id).first.hqmf_id : nil
41
42
  ALL_POPULATION_CODES.each do |pop_code|
42
- next unless population_set.populations[pop_code] || pop_code == 'OBSERV'
43
+ next unless population_set.populations[pop_code]
43
44
 
44
- val = nil
45
- sup = nil
46
- if pop_code == 'OBSERV'
47
- next unless population_set.populations['MSRPOPL']
48
-
49
- msrpopl = population_set.populations['MSRPOPL']['hqmf_id']
50
- val, sup = extract_cv_value(n, population_set.observations.first.hqmf_id, msrpopl, stratification)
51
- else
52
- val, sup, pr = extract_component_value(n, pop_code, population_set.populations[pop_code]['hqmf_id'], stratification)
53
- end
45
+ get_observed_values(results, n, pop_code, population_set, stratification)
46
+ val, sup, pr = extract_component_value(n, pop_code, population_set.populations[pop_code]['hqmf_id'], stratification)
54
47
  unless val.nil?
55
48
  results[pop_code] = val
56
49
  results[:supplemental_data][pop_code] = sup
@@ -60,8 +53,19 @@ module CqmValidators
60
53
  results
61
54
  end
62
55
 
63
- def extract_cv_value(node, id, msrpopl, strata = nil)
64
- xpath_observation = %( cda:component/cda:observation[./cda:value[@code = "MSRPOPL"] and ./cda:reference/cda:externalObservation/cda:id[#{translate('@root')}='#{msrpopl.upcase}']])
56
+ def get_observed_values(results, n, pop_code, population_set, stratification)
57
+ statement_name = population_set.populations[pop_code]['statement_name']
58
+ # 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 }
60
+ # return unless an observation is found
61
+ unless statement_observation.empty?
62
+ 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)
64
+ end
65
+ end
66
+
67
+ def extract_cv_value(node, id, msrpopl, pop_code, strata = nil)
68
+ xpath_observation = %( cda:component/cda:observation[./cda:value[@code = "#{pop_code}"] and ./cda:reference/cda:externalObservation/cda:id[#{translate('@root')}='#{msrpopl.upcase}']])
65
69
  cv = node.at_xpath(xpath_observation)
66
70
  return nil unless cv
67
71
 
@@ -73,7 +77,7 @@ module CqmValidators
73
77
  else
74
78
  val = get_cv_value(cv, id)
75
79
  end
76
- [val, (strata.nil? ? extract_supplemental_data(cv) : nil)]
80
+ val
77
81
  end
78
82
 
79
83
  def extract_component_value(node, code, id, strata = nil)