cqm-validators 3.0.1 → 3.1.1

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: ee2392d581780f96f7b1b57b2e39bb007d8d450f69f0f903b8c0b18bac2fad9d
4
- data.tar.gz: ad2ef24b759d799e4c6fe49cb6438a4aec9c4af8f002ec67d136b97357e1eabf
3
+ metadata.gz: 96971e9494dc87c94e53e26ed2aee36b3e0b9b9c7003e6fbb69e1270d6aee483
4
+ data.tar.gz: e3b1fe620f241d2e087d85479781f0fe92381cc648597a7db087b0550debb8fa
5
5
  SHA512:
6
- metadata.gz: 2f57e881a5825ce58d928f46559c42279faec7b41ba7f1dade50ece69ee72a50443be5b59aef15683aee670809712dc832afe66c6b81c7988fba59783239f84f
7
- data.tar.gz: ad889cec773305338b0d4d268f1b4fd5fc33abe3edb81636c3013eac715eab7fbc88ddc899bac42dd3fae08eecf4b5e4742e2921e43640f39ff37215be923e4a
6
+ metadata.gz: 9291acde236868177f5f286c9b39490548de760f52d31b09aef673ffa39672a2a68d119d647e2b339167f0dcf74e881ca6f8da3d63ede32ba1cced2711721151
7
+ data.tar.gz: bda319adce20a97cdbfde7592ef615ca5aa93c7ed8bd612410c4b110787163bea73ddfb700b60a32cca06fdc2791acdec36ae590fcc0d1202c64bcfb78322015
@@ -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.5
2
+ TargetRubyVersion: 2.4
3
3
  Exclude:
4
4
  - bin/*
5
5
  Style/Documentation:
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
@@ -22,9 +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.required_ruby_version = '>= 2.5.0'
25
+ spec.required_ruby_version = '>= 2.4.0'
26
26
 
27
- spec.add_dependency 'nokogiri', '~>1.10'
27
+ spec.add_dependency 'nokogiri', '>= 1.8.5', '< 1.12.0'
28
28
 
29
29
  spec.add_development_dependency 'bundler'
30
30
  spec.add_development_dependency 'byebug'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CqmValidators
4
- VERSION = '3.0.1'
4
+ VERSION = '3.1.1'
5
5
  end
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cqm-validators
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laura
@@ -9,22 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-11-18 00:00:00.000000000 Z
12
+ date: 2021-06-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: nokogiri
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
+ - !ruby/object:Gem::Version
20
+ version: 1.8.5
21
+ - - "<"
19
22
  - !ruby/object:Gem::Version
20
- version: '1.10'
23
+ version: 1.12.0
21
24
  type: :runtime
22
25
  prerelease: false
23
26
  version_requirements: !ruby/object:Gem::Requirement
24
27
  requirements:
25
- - - "~>"
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: 1.8.5
31
+ - - "<"
26
32
  - !ruby/object:Gem::Version
27
- version: '1.10'
33
+ version: 1.12.0
28
34
  - !ruby/object:Gem::Dependency
29
35
  name: bundler
30
36
  requirement: !ruby/object:Gem::Requirement
@@ -146,11 +152,11 @@ extensions: []
146
152
  extra_rdoc_files: []
147
153
  files:
148
154
  - ".github/PULL_REQUEST_TEMPLATE.md"
155
+ - ".github/workflows/ci.yml"
149
156
  - ".gitignore"
150
157
  - ".overcommit.yml"
151
158
  - ".rubocop.yml"
152
159
  - ".simplecov"
153
- - ".travis.yml"
154
160
  - Gemfile
155
161
  - LICENSE.txt
156
162
  - QRDA_Schematron_License.txt
@@ -226,7 +232,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
226
232
  requirements:
227
233
  - - ">="
228
234
  - !ruby/object:Gem::Version
229
- version: 2.5.0
235
+ version: 2.4.0
230
236
  required_rubygems_version: !ruby/object:Gem::Requirement
231
237
  requirements:
232
238
  - - ">="
data/.travis.yml DELETED
@@ -1,20 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.6
4
- - 2.5
5
- cache:
6
- - bundler
7
- sudo: required
8
- services:
9
- - mongodb
10
- branches:
11
- only:
12
- - master
13
- - cqm_validators_2_x
14
- before_script:
15
- - git config --global user.email "travis@travis.ci"
16
- - git config --global user.name "Travis CI"
17
- script:
18
- - bundle exec overcommit --sign
19
- - bundle exec overcommit --run
20
- - travis_retry bundle exec rake test